From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 2C8B9C4338F for ; Fri, 30 Jul 2021 12:24:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E560260F9B for ; Fri, 30 Jul 2021 12:24:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E560260F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iandej7du14UlGMR4pkr7F8cIFHygDGdssUOA4XyzE4=; b=bjvR2Qi1kQN145 pzvcPH1hB3VMIWZjNSwpuCv3gZanKvmyxhN33Dxhmz9JIB6dX8IWTsfQzDgN+D/Nzic+jy0F4ekcf CcCLImF6tIren7s4PqiqSoegog/eCr+E/uWQTNzRe9MECWfUHxfbc9cLFQZ/uBuT1nMa70PJjIfFi cxW5E5TOmJus/juZsXFa6QDsw/7Q1xnnqiVvx4nq3JgKx0jHxCNUGnGqgKVUOZHdg9dBui5pYQu8N v6g8WzSH3qnl+2y4/bQRS0k3E5uTdXCbBzH9DHt3t/vJbMq8QGcc02Mwqh37PogEHSsMvCy7+2U/2 J1+qYRukDTklY4iwz7Nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9RXL-008ZR2-C4; Fri, 30 Jul 2021 12:22:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9RXG-008ZPO-BQ for linux-arm-kernel@lists.infradead.org; Fri, 30 Jul 2021 12:22:43 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73F3360F0F; Fri, 30 Jul 2021 12:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627647761; bh=6rPDKOhXYLbds6nrD5HJGHt+dOnovarXwROp9/CyKZQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WlMh3a4XCuGOTkoRFslKFOC5+jQetKCuY/TGSoGMd8duetvdFMbYrlk/juRI5DszS o/21RNLixzIm0twxsanZdlfA9ud7qzIXIoCTJy+w35c9BZN88mAzALUXUYZ+0BC6SE bgQQk3N64Kl+qQs+4ne9MHMNxzLRLU77mcDeA+Nk8307mNHaa4l6Rje9ium3weZmQB aRt65/xJkTlgY899amR/yd+aDgBxS8/hVeVb5eQiCGPasZEEsgfLWvyOYFYQpUY7rb ZaEVIQOLmgwZOHs93DOhsRVASXlP9jOud2GALq738PRXWobe6a4Gzy9Zu0iaobh8oo F89/OkH6DsLBg== Date: Fri, 30 Jul 2021 13:22:37 +0100 From: Will Deacon To: Yuchen Wei , mark.rutland@arm.com Cc: catalin.marinas@arm.com, vincenzo.frascino@arm.com, keescook@chromium.org, pcc@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: audit: fix return value high 32bit truncation problem Message-ID: <20210730122236.GE23589@willie-the-truck> References: <20210722060707.531-1-weiyuchen3@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210722060707.531-1-weiyuchen3@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210730_052242_455331_6445C191 X-CRM114-Status: GOOD ( 20.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 22, 2021 at 02:07:07PM +0800, Yuchen Wei wrote: > From: weiyuchen > > Add error code judgment in invoke_syscall() to prevent kernel > components such as audit and tracepoint from obtaining incorrect > return values. For example: > > type=SYSCALL msg=audit(342.780:69): arch=40000028 syscall=235 > success=yes exit=4294967235 > > The syscall return value is -61, but due to the following process in > invoke_syscall(): > > if (is_compat_task()) > ret = lower_32_bits(ret); > regs->regs[0] = ret; > > The return value audit or tracepoint get from regs[0] is 4294967235, > which is an incorrect return value. > > Signed-off-by: weiyuchen > --- > arch/arm64/kernel/syscall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c > index 263d6c1a525f..f9f042d9a088 100644 > --- a/arch/arm64/kernel/syscall.c > +++ b/arch/arm64/kernel/syscall.c > @@ -54,7 +54,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno, > ret = do_ni_syscall(regs, scno); > } > > - if (is_compat_task()) > + if (is_compat_task() && !IS_ERR_VALUE(ret)) > ret = lower_32_bits(ret); Hmm, I'm worried this might break other users who don't expect to see non-zero bits for the upper 32-bits of a compat task. Mark -- I remember you looking into this relatively recently. Where did you get to with it? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel