From patchwork Tue Feb 23 05:50:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 386650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B720AC433DB for ; Tue, 23 Feb 2021 05:51:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5684A64E58 for ; Tue, 23 Feb 2021 05:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231431AbhBWFvS (ORCPT ); Tue, 23 Feb 2021 00:51:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:54486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbhBWFvR (ORCPT ); Tue, 23 Feb 2021 00:51:17 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DFD3964E60; Tue, 23 Feb 2021 05:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614059434; bh=IPkD+572EaUq/Ouy9LtIH5yCNhFOhkYfrxu8FFiUTRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stGgyRsuhqDn1KY3wVlD82Jr93tvHhs6l6I2q1NPz5eBsWWPldliFJ3gHhLiew/f2 1QsogMswaYaz1/BUKkKGo98IxBbY3JUcFRyf/W9fxrhbO9l9PuAWgp9p7DwgQmfCXN 1kbl0IsKdkxB+BFPEPCckDwZBdikUAjPhydSd0xwxdrz65y+GOlZhJX3hul1cMpGfO jgcZRgcm+haCHQt9iFHSnDR1bzrMnF6Q8bBz9u5GLEss7nIKzbf5GizLZRDFMtZUk0 91eQaW3r6WpGHbQqeUx+geojFYxnr/iXHSeamApQ0d3hBjQjyqpFbQ7tKzrgjNZ09m EXATPoakyyGMw== From: Andy Lutomirski To: x86@kernel.org Cc: LKML , Andy Lutomirski , stable@vger.kernel.org Subject: [PATCH 2/3] x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls Date: Mon, 22 Feb 2021 21:50:28 -0800 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 exit work. This would confuse audit and ptrace. This is a minimal fix intended for ease of backporting. A more complete cleanup is coming. Cc: stable@vger.kernel.org Fixes: 0b085e68f407 ("x86/entry: Consolidate 32/64 bit syscall entry") Signed-off-by: Andy Lutomirski --- 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 0904f5676e4d..cf4dcf346ca8 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(); + exit_to_user_mode(); return false; }