Message ID | 20170726170051.28328-3-thgarnie@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EA0C602B1 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 26 Jul 2017 17:02:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2102128798 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 26 Jul 2017 17:02:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15B282879F; Wed, 26 Jul 2017 17:02:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A45D128798 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 26 Jul 2017 17:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=niGO1Hy5qm6Rmn8GNS4lHAj/II18QYa4//JAUtUwmJU=; b=cUllQOeXjT3F6nHHXIWm2jrJ41 VVpxI467HR3I6bMvc68btj09zzPFH2lJrq+WufJpz6UqknoIqsL34BrXfykHM3BneJd6zz4guGF7u LceuKB7AHvYeLrn2vuMet92J6zcaVjECPqa5332Wz0Jr+u4uCFliFaZSaHBmVnSL8GsVeIXaHSDhD fiYrjIrY67LO6aWGwVq5asYxQfJQXHTToj/i1ETav8EFhJ2ScZXZTBgXow5Sbz6YsyinygbOdh3Gx kjzANjH7ilO7bj4j3QiRHfaKc5LdWBxSpL4SSIFKSQeE1kqDNUl+qvYixY7L1Bd/OKHR8lNZ3HNTk X+1f875A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1daPh5-0002FG-Ml; Wed, 26 Jul 2017 17:01:55 +0000 Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1daPgs-0001vf-8V for linux-arm-kernel@lists.infradead.org; Wed, 26 Jul 2017 17:01:49 +0000 Received: by mail-pg0-x22a.google.com with SMTP id v190so86730785pgv.2 for <linux-arm-kernel@lists.infradead.org>; Wed, 26 Jul 2017 10:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DtWPYw73LKJB7rLDHlgzB0R3cLtrTH1Vet0Nx1Tfang=; b=IhMAIA9CzVFPWapYu4sRiYpYsu0zAWOpoNVQWnQ1rpOLXV3GQ3JNR64Ofla9N8M0tW So3dY6d/3JtOIoavDiG/VrwipHQuoA55d3+cPhH/jCejYhS6RjH3Ws7ZIhbbyNu0gEAP VY8GCXT46CltjVVZjQovHFBZdxPKVbqdguU5lH3XOMfboL8RIdG3t9mu0G+qmuMKlnba NWcyJodjAhc4pvPepviSEgCRopwvpfjrsEEqbGyiKVwDBig7YakioT8oqqQvEs9Sx7A/ umHCLhF9LSZggNrzlugYZEIIduGiTbT2Mlla1fy8w6XyhsD1UdyQuKMz0KuYX2Uw5qZU 16hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DtWPYw73LKJB7rLDHlgzB0R3cLtrTH1Vet0Nx1Tfang=; b=LK4chUowC18DVa/OdmYDa9rp8uy+53+ss3TSSM57IpfsAF3Ohd8Drfiy07NIHYF37l yHYRRj8zz91otK1cpEaRh9tl3i9BWiJTTQKoDWPV9DAtnVfXDLXLVdz7gIobukAtEQw2 egXz8csQeAcwxdqd/NgQsrbx7WiydrS6FpHNTCXVLkuzoZ6QfYkQBVFUR3UxRY8JXI8j 5GTizHhX8tkvfskr1fEeAeYs/dx/yfXWbcMO80cVaP+LWjtnESXuxUdudkFq4abWlaSU ahl6DM8aHGtVttrM22bznggazrB4fE9qNhnkkIS3O8ZIr9CcLdTfdzc4CoaxZbKj4Lju Pw2g== X-Gm-Message-State: AIVw112UXGj/ViUtmt+Ts9/fDHIysMyctY84iM1keH7LcO0Noo0iPaCu J03YXrJbqgPcaytN X-Received: by 10.99.107.70 with SMTP id g67mr1463252pgc.426.1501088486106; Wed, 26 Jul 2017 10:01:26 -0700 (PDT) Received: from skynet.sea.corp.google.com ([172.31.92.33]) by smtp.gmail.com with ESMTPSA id m65sm3392641pfi.94.2017.07.26.10.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Jul 2017 10:01:25 -0700 (PDT) From: Thomas Garnier <thgarnie@google.com> To: Russell King <linux@armlinux.org.uk>, Kees Cook <keescook@chromium.org>, Andy Lutomirski <luto@amacapital.net>, Will Drewry <wad@chromium.org>, Thomas Garnier <thgarnie@google.com>, Thomas Gleixner <tglx@linutronix.de>, Al Viro <viro@zeniv.linux.org.uk>, Dave Martin <Dave.Martin@arm.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Pratyush Anand <panand@redhat.com>, Chris Metcalf <cmetcalf@mellanox.com>, leonard.crestez@nxp.com Subject: [PATCH v2 3/3] arm64/syscalls: Move address limit check in loop Date: Wed, 26 Jul 2017 10:00:51 -0700 Message-Id: <20170726170051.28328-3-thgarnie@google.com> X-Mailer: git-send-email 2.14.0.rc0.400.g1c36432dff-goog In-Reply-To: <20170726170051.28328-1-thgarnie@google.com> References: <20170726170051.28328-1-thgarnie@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170726_100143_111451_858EB6AD X-CRM114-Status: GOOD ( 12.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index e3e3293d1123..8e2705983e1d 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -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 {
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> --- arch/arm64/kernel/signal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)