Skip to content

Commit bfe00c5

Browse files
Christoph Hellwigtorvalds
authored andcommitted
syscalls: use uaccess_kernel in addr_limit_user_check
Patch series "clean up address limit helpers", v2. In preparation for eventually phasing out direct use of set_fs(), this series removes the segment_eq() arch helper that is only used to implement or duplicate the uaccess_kernel() API, and then adds descriptive helpers to force the kernel address limit. This patch (of 6): Use the uaccess_kernel helper instead of duplicating it. [hch@lst.de: arm: don't call addr_limit_user_check for nommu] Link: http://lkml.kernel.org/r/20200721045834.GA9613@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Nick Hu <nickhu@andestech.com> Cc: Greentime Hu <green.hu@gmail.com> Cc: Vincent Chen <deanbo422@gmail.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Link: http://lkml.kernel.org/r/20200714105505.935079-1-hch@lst.de Link: http://lkml.kernel.org/r/20200710135706.537715-1-hch@lst.de Link: http://lkml.kernel.org/r/20200710135706.537715-2-hch@lst.de Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b956b5a commit bfe00c5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎arch/arm/kernel/signal.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,9 @@ struct page *get_signal_page(void)
713713
/* Defer to generic check */
714714
asmlinkage void addr_limit_check_failed(void)
715715
{
716+
#ifdef CONFIG_MMU
716717
addr_limit_user_check();
718+
#endif
717719
}
718720

719721
#ifdef CONFIG_DEBUG_RSEQ

‎include/linux/syscalls.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static inline void addr_limit_user_check(void)
263263
return;
264264
#endif
265265

266-
if (CHECK_DATA_CORRUPTION(!segment_eq(get_fs(), USER_DS),
266+
if (CHECK_DATA_CORRUPTION(uaccess_kernel(),
267267
"Invalid address limit on user-mode return"))
268268
force_sig(SIGKILL);
269269

0 commit comments

Comments
 (0)