Re: [PATCH RFC v2] m68k: remove get_fs()/set_fs()
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-07-09 20:14:10
Also in:
linux-m68k
On Fri, Jul 9, 2021 at 1:03 PM Linus Torvalds [off-list ref] wrote:
Except maybe there's some 32-bit architecture that doesn't support 8-byte get/put_user(), which may be why it's a copy_to_user(). I _think_ we made the rule be that everybody had to support 1/2/4/8 byte accesses, but maybe I remember incorrectly.
We're _almost_ correct.
nios2 doesn't seem to support 8-byte user accesses.
Everybody else does seem to have a 'case 8:' at least according to my
simplistic grep (but that grep might have been _too_ simplistic).
Added nios2 and the arch list.
I think we could easily just say "you have to support a 8-byte
get/put_user()". At worst, an architecture can just implement it using
copy_from_user() like some already do, ie something like
case 8: { \
u64 __x; \
if (unlikely(copy_from_user(&__x, ptr, 8))) { \
retval = -EFAULT; \
(x) = (__typeof__(*(ptr)))0; \
} else { \
(x) = *(__force __typeof__(*(ptr)) *)&__x; \
} \
break; \
} \
so if somebody wants to make 'sys_llseek()' use put_user(), I'm ok with that.
Linus