Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3529383pxf; Mon, 15 Mar 2021 11:35:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/8malNbjl+bNompzdT8HheuJbfxrU8o1N37hcMNcNVDohWrJijTc4bIpRxgbKRbc4TZ6U X-Received: by 2002:a50:ec81:: with SMTP id e1mr31230821edr.0.1615833321057; Mon, 15 Mar 2021 11:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833321; cv=none; d=google.com; s=arc-20160816; b=wWTx6s+AU3NmUPai3r5KaEE8q6vg6V3hQ9tvYGZ+4DuVShAnZORdlnCFjDaHjffrWh 0S4eCqBuGITAm6xOPz3CQ1SpQGgUEvXcnk3PhQ4ZjUqkluhCFsHSoSNwjJQvroNj7GuY +V7YWlZRbrgyWf6bB4ViA5Z6RNoH5b/qwraO5z/IMMe5YrrjhO9Ccezshkh1dbPrkdvS iaQuuV70Y1Y///fZNFaeJsXDAJ9KQ4YxCDVPyzgO2zqlVtgq9evO2uVGrbk5zXTHuTbc AnpjqS7rCQehBvD47PvlwqM+zVIOWPyTpSD+E8BgKy6T6uAjRla62kTVX56kQiXFGBa4 L0dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WhaIpKRPfgz0y6vRXcBtV/g0JgKwFLn8I4fFjn7AoXo=; b=BK0t5M0u/ivbuMVopDahui8Y8biwSqDVmzntvtz7f4DjCUv453oit8gJaE77WJs4kP Gda0nctANqpx5biKWCRhqAWbUI9hb/BJAitEHZwzJkpDVYiPxhPAcsx5UsZfWgQ2J6nV HxHkORoLGj90VchEh57HZt8cM2C8uhaDin79bapjrrPGD6YvRjCPhGYD8FkA3FXiuhcr c/6TDHbnPLD1aTJ0TTB+7Mo0UGgNYCf6APlcChDEG6c+HROhSj98rXJoZImMF4wQGOuA gQMfpvVS3PFvPlmGmVJpUsX9FFQRT0QAZSkSla3XtSmcLkyFsWxLVjbE22loV4dTEBCg K5vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WFVpLZLk; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si11273784ejx.201.2021.03.15.11.34.58; Mon, 15 Mar 2021 11:35:21 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=WFVpLZLk; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239165AbhCOOqn (ORCPT + 99 others); Mon, 15 Mar 2021 10:46:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:52488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234625AbhCOOEe (ORCPT ); Mon, 15 Mar 2021 10:04:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C82C64F8E; Mon, 15 Mar 2021 14:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817072; bh=lv+0TvJd6eDnBA65zQK+qLe6zQ/VSNK8Tkf105+Wgi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFVpLZLkGcQszZht/yBslsHWf0cnWOZhJp33nEGFxaVL2GXnA6T+CQvZuvZbuXyhu 6BmLimuKBDX3FBL5e2icrMAcvt8GlLSFNzH8RNiRBHev7mK5Uw82sn6aD9CykbpGPt ZAVyx+i5ro+eLN2K2wh/ZocqYVJnjZEur6CCq97w= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Thomas Gleixner , Borislav Petkov Subject: [PATCH 5.10 275/290] x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls Date: Mon, 15 Mar 2021 14:56:08 +0100 Message-Id: <20210315135551.327241513@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Andy Lutomirski commit 5d5675df792ff67e74a500c4c94db0f99e6a10ef upstream. 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 Signed-off-by: Greg Kroah-Hartman --- arch/x86/entry/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32 regs->ax = -EFAULT; instrumentation_end(); - syscall_exit_to_user_mode(regs); + local_irq_disable(); + irqentry_exit_to_user_mode(regs); return false; }