]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
arm64/syscalls: Move address limit check in loop
authorThomas Garnier <thgarnie@google.com>
Thu, 7 Sep 2017 15:30:47 +0000 (08:30 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Tue, 27 Feb 2018 16:32:31 +0000 (11:32 -0500)
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: cf7de27ab351 ("arm64/syscalls: Check address limit on user-mode return")
Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Thomas Garnier <thgarnie@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Pratyush Anand <panand@redhat.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: Will Drewry <wad@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: David Howells <dhowells@redhat.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-api@vger.kernel.org
Cc: Yonghong Song <yhs@fb.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1504798247-48833-5-git-send-email-keescook@chromium.org
(cherry picked from commit a2048e34d4655c06d31400646ae495bbfeb16b27)

CVE-2017-5753
CVE-2017-5715
CVE-2017-5754

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/arm64/kernel/signal.c

index e3e3293d1123957d9529160f068f2cc07b69705e..8e2705983e1d7b4de5fe4258eddfe6a2eb6357a5 100644 (file)
@@ -751,10 +751,10 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
         */
        trace_hardirqs_off();
 
-       /* Check valid user FS if needed */
-       addr_limit_user_check();
-
        do {
+               /* Check valid user FS if needed */
+               addr_limit_user_check();
+
                if (thread_flags & _TIF_NEED_RESCHED) {
                        schedule();
                } else {