Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3530088pxf; Mon, 15 Mar 2021 11:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+tE3RpIEyl3rsZJc4sp9Pkvu2D3wN4IitK5kdBoTwb0MvTxGJGCavtihyQ3aKPgmtoGpN X-Received: by 2002:a17:906:f203:: with SMTP id gt3mr9929346ejb.346.1615833378249; Mon, 15 Mar 2021 11:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833378; cv=none; d=google.com; s=arc-20160816; b=eEmgE/5v76H4rS5GyL3WXpURfHSQPImqaP/wZrx4QAQmoIwPYUD0J61K0wheAMNvbb 0xj6K8zu4KAczEuILX9SSa4d13Y9ha7ZWNMHSH226qjDktlKT1sffuMA5X3zbfSRHMCM W4OS8oSd1B8jrmKT/xx56+ZlvCQg1siZNaosEb5RzIU2p79WcP3PsLy4I5f1bOjM5ec+ iafKCZng3U/I5qepf6ZFU8M9aYg5SwF8VnlS2tplbbx3SMIQ5SBLPDXPjtdRnwdm1dBw ueGBiWKTlL1N02CMRFLLgvHWGI10DYONqKvZX7fIjM3MXmJt5jGL68SsStUn5/b7nc7t +iwA== 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=gf6Xuqj8YAnMRjMnuw7YUMm+NR8TPFbMECV48b5E5wyZPHwvaDzxu8nA22N879Bh4C 50laC2OdB4JMS7mZTve1P2P/nZcNuoO734d3hXTHRbxNGu7EtrZwoNLTarEvlUpw8Bxd nXHNIz4JW+QkKcO+YmhtGbqP2ThfjMl0MKdyae8OvFsOvc+Sdy/lr3jUycqdBufQlOlY ck8puqEonjgdzbiEiYss3kG3Qbtnk2uYe93BFwc7sLoWvLeUPB7Dp0msJPMfAtd8il+J YdBjT1wl31Wvv721pf9TeYO7FP73Y5Iml0fcxke8NrPhqZwJcNStoco9JGlCwlZzhWr1 OqnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mYqZvrhL; 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 b5si11371677edq.537.2021.03.15.11.35.55; Mon, 15 Mar 2021 11:36:18 -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=mYqZvrhL; 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 S239494AbhCOOrB (ORCPT + 99 others); Mon, 15 Mar 2021 10:47:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234655AbhCOOEo (ORCPT ); Mon, 15 Mar 2021 10:04:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97F8464F38; Mon, 15 Mar 2021 14:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817083; bh=lv+0TvJd6eDnBA65zQK+qLe6zQ/VSNK8Tkf105+Wgi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mYqZvrhLGOpg0fGD7WrofLZtnzcYuY7quSFUZWFsRZIoBsq7PZKRMzilopcQs8cw6 eOjf5s8yoC2OnC3ygKDdIeV8JPWcT2i6v8SmHLp8hSLc7683IZgSZHpDB1o7tM/24Q JSAfU1Wgk65l0WQUyZq5cfXrBgTM/+rDHjCzfqV0= 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.11 291/306] x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls Date: Mon, 15 Mar 2021 14:55:54 +0100 Message-Id: <20210315135517.526776954@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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; }