Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp431469pxb; Sat, 6 Mar 2021 04:37:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJz43QpZ+2zS7f7+ezxra3tx4r/94U7fYifygEujpXnrNLcegZavbP+UUm/rYfeJOkF9L4Hp X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr6776952eju.532.1615034252918; Sat, 06 Mar 2021 04:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615034252; cv=none; d=google.com; s=arc-20160816; b=Q9xANzeVaFXWNorbrWSekg6J6i6Qm7xQMxZkyNjT7EAg+JTF1H7yst0PjGLr0NEQ10 911sJJ2gx87DbrU9pqkXmDZVGoM3H7H1z4+1fYxIjJIMOMINko9xNrGluPgvYHXxVPIe l26p4AvfFleGHH42NkxVYR0En7g52zVT/BsxbmdGzhBnfMsLWYj6v3Y/tZS5A+NiVtJX sLBsfp9Sj/Vccbit68gVIRZVRWdQnpjaZ6x3ppYauCU5PK+u5HODJVrVUv1pQb5+ZcKI ENJVHnjEGOolUbnCpjrkUtc+tGm28fM1NIhCgtpi/2bFMBx6R/Al0q2/I/yPW8Siry1f M/HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=swRG/lx6ZVeZhXLtw+XF0xoUI0mK+OTa5IpeAqMH+8A=; b=odfD49oPL53pB9OdDsc7ybprqFujYh6qxCYTvMB3lydQ1FTpKBU22w7tv6+IMz9Bl7 Y+JED6nl+Kgo0WAdemPcVUyQikPmdsNFDxBDG45EcgdIQ0YDRs40yRKOlYXpc+L1Hx3h fctTM7vdhN71ZVidWWeO1FrrWbKXSqFxz7gXecVR2Zs+X/spHSnu2TuhWUrJGdpXi0pU A0kIGgz8tWG89lz8Dgjl8feHZWOAvIhMOlug6FWCpNjAlS0qn60lhkXihUQNqkZrW/Zd PEkGGjagOnJ59fzBVkSo5NosiPGD/1KzdWbKWHjIWzcOn5gFThEWFWEcfEXRVB0Wsc84 Xa7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KiDB7skk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9utgGPWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si3232663ejy.55.2021.03.06.04.37.10; Sat, 06 Mar 2021 04:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KiDB7skk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9utgGPWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbhCFMTO (ORCPT + 99 others); Sat, 6 Mar 2021 07:19:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbhCFMSz (ORCPT ); Sat, 6 Mar 2021 07:18:55 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A401C06174A; Sat, 6 Mar 2021 04:18:55 -0800 (PST) Date: Sat, 06 Mar 2021 12:18:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1615033133; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swRG/lx6ZVeZhXLtw+XF0xoUI0mK+OTa5IpeAqMH+8A=; b=KiDB7skkMxT2rUea6cms31lVqrOMWVkQlQPuVuSpwrStbFuZlEsKdUHAA0L9s7EeT+WczJ 8ovztZ3bD1M47EoUvJK6lfn2HHTNTKIakDpCiNK2gI2WpCFGCeGeX0dL1CU/ktGbVnqOTa +96FMHot2w6w84WmoZ0noMHYR8GsR56Xo+la9MeHps4NvoL9jRiVk16lUJZqkk8OPGcfNt U1FRxqIeJ4Fr8U9CO9jBkzF6fC2oKlFITBTyJwNzD8R8tSDM2kPv5WsYrw411uVBwEXHS3 NkBuSL1VhuNiLaX0OssUhradakPbYaVaV+R357nZ8v7XsyLyyR2jSNODck2E6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1615033133; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swRG/lx6ZVeZhXLtw+XF0xoUI0mK+OTa5IpeAqMH+8A=; b=9utgGPWwrrfbkJ179KsUqsID3EDZnCIYP3VngOC56G3C0Bl+k0zxDsvend1Cj4TcR/AksW CtCvwrSzp0WIiiCw== From: "tip-bot2 for Andy Lutomirski" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls Cc: Andy Lutomirski , Thomas Gleixner , Borislav Petkov , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <8c82296ddf803b91f8d1e5eac89e5803ba54ab0e.1614884673.git.luto@kernel.org> References: <8c82296ddf803b91f8d1e5eac89e5803ba54ab0e.1614884673.git.luto@kernel.org> MIME-Version: 1.0 Message-ID: <161503313284.398.1974484550470289869.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 5d5675df792ff67e74a500c4c94db0f99e6a10ef Gitweb: https://git.kernel.org/tip/5d5675df792ff67e74a500c4c94db0f99e6a10ef Author: Andy Lutomirski AuthorDate: Thu, 04 Mar 2021 11:05:54 -08:00 Committer: Borislav Petkov CommitterDate: Sat, 06 Mar 2021 13:10:06 +01:00 x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls On a 32-bit fast syscall that fails to read its arguments from user memory, the kernel currently does syscall exit work but not syscall entry work. This confuses audit and ptrace. For example: $ ./tools/testing/selftests/x86/syscall_arg_fault_32 ... strace: pid 264258: entering, ptrace_syscall_info.op == 2 ... This is a minimal fix intended for ease of backporting. A more complete cleanup is coming. Fixes: 0b085e68f407 ("x86/entry: Consolidate 32/64 bit syscall entry") Signed-off-by: Andy Lutomirski Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/8c82296ddf803b91f8d1e5eac89e5803ba54ab0e.1614884673.git.luto@kernel.org --- arch/x86/entry/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index a2433ae..4efd39a 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) regs->ax = -EFAULT; instrumentation_end(); - syscall_exit_to_user_mode(regs); + local_irq_disable(); + irqentry_exit_to_user_mode(regs); return false; }