Skip to content

Commit a2048e3

Browse files
thgarnieKAGA-KOKO
authored andcommitted
arm64/syscalls: Move address limit check in loop
A bug was reported on ARM where set_fs might be called after it was checked on the work pending function. ARM64 is not affected by this bug but has a similar construct. In order to avoid any similar problems in the future, the addr_limit_user_check function is moved at the beginning of the loop. Fixes: cf7de27 ("arm64/syscalls: Check address limit on user-mode return") Reported-by: Leonard Crestez <[email protected]> Signed-off-by: Thomas Garnier <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Pratyush Anand <[email protected]> Cc: Dave Martin <[email protected]> Cc: Will Drewry <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Russell King <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: David Howells <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Al Viro <[email protected]> Cc: [email protected] Cc: Yonghong Song <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected]
1 parent e33f8d3 commit a2048e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm64/kernel/signal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,10 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
751751
*/
752752
trace_hardirqs_off();
753753

754-
/* Check valid user FS if needed */
755-
addr_limit_user_check();
756-
757754
do {
755+
/* Check valid user FS if needed */
756+
addr_limit_user_check();
757+
758758
if (thread_flags & _TIF_NEED_RESCHED) {
759759
schedule();
760760
} else {

0 commit comments

Comments
 (0)