Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp867392pxb; Tue, 1 Feb 2022 12:04:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY1VDFqgiOypmDxjeU1WBzYRGQgxvcWWR0gAtkPBgM7b/OFqPhFNjSRTU1EuV+04UhQ7bi X-Received: by 2002:a17:907:1624:: with SMTP id hb36mr21834241ejc.183.1643745874806; Tue, 01 Feb 2022 12:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745874; cv=none; d=google.com; s=arc-20160816; b=usTqeq25WGgxzDUeoTyXi3JRPz36Srw33LEGDONnwmrIkcXxAN3O8m5hQPsluKQZn9 G+EOH8Pxo5KVHPBpH1xyFTIyJ/JqAYgzeGqC7EwFyOXUJy4vtn4f1oxo0yGewdnu9rRL eA1mlQfcTOYUxpe3/2QDurmYSOSUUrIGldF2ZdBRkBBmmi++XVFL/cEqFNG9DoG9F7iD 0rbims3jsTpS2Fp50lIN+tbwg/tP+W9iviohWSTWyS/29MbVIHy0vvjr83rp0ISh1JGn T4zE4Vi4NJ2Rou9pPpugILNPECmRQaWyJxKXrCBB3gW46In1kn/F8VCf+TiUwxUEkkY4 p94A== 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=e5gFd0Ka4BUp77PxMxdK8mXjl7x2nqUWPDkOQ0svDG4=; b=XH4FDB31joFu5ZhM437CKrgJe96YoTdNxYycwCqxVMn5VYrs4eJ/0ItnuLNrDLx4W5 /720vUpA5WzW7U3Ka1l4u4lyyDUGd5Au48pKSnnm9gQcaIvrwnhUQDNVla6RiGKzLNzr bQqG4ZPjtACXR9gzyI8di6yD0FmlZlnJ3anqEI9vz0kgVMyNmtsH0a1m+AHmZelMWfE9 u5J0wB541xaUmv4ZK4GxhadFIsc4ZSMaXRobw+1fFtxjmq8zK3K2kRR3lMmxTVkhp+jY FXwOmuGIb2hi4T9Aiem+rF1FvWRa21y0I4BB7yJuv2RuauieLT+YA72vNpj18lpDDoHI 7bXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l0mLmNW1; 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 g10si10170467edz.128.2022.02.01.12.04.09; Tue, 01 Feb 2022 12:04:34 -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=@linuxfoundation.org header.s=korg header.b=l0mLmNW1; 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 S1377465AbiAaLSR (ORCPT + 99 others); Mon, 31 Jan 2022 06:18:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377568AbiAaLKM (ORCPT ); Mon, 31 Jan 2022 06:10:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88F0C061401; Mon, 31 Jan 2022 03:09:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67E2760F96; Mon, 31 Jan 2022 11:09:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C002C340E8; Mon, 31 Jan 2022 11:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627368; bh=RXJiMghcv4iaFoYHI7dB/1o8hostNGLl4333WgzAptc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0mLmNW1mJ1PuP3GPcPHLWu85X493Ggex1Ba33azSfxYZPThizJKtWQlU02VsK3gq s9hmV8BncrEDTY4vq+HaVwpI4c/f74Yijup6Yluq0JllvUivhhICQhsURNy7UZKQfe H+SLezlmSIStpCRwLLNC50lIat/p5sQqXJFB+7ok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Dmitry V. Levin" , Christophe Leroy , Michael Ellerman Subject: [PATCH 5.15 028/171] powerpc/audit: Fix syscall_get_arch() Date: Mon, 31 Jan 2022 11:54:53 +0100 Message-Id: <20220131105230.972888808@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105229.959216821@linuxfoundation.org> References: <20220131105229.959216821@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: Christophe Leroy commit 252745240ba0ae774d2f80c5e185ed59fbc4fb41 upstream. Commit 770cec16cdc9 ("powerpc/audit: Simplify syscall_get_arch()") and commit 898a1ef06ad4 ("powerpc/audit: Avoid unneccessary #ifdef in syscall_get_arguments()") replaced test_tsk_thread_flag(task, TIF_32BIT)) by is_32bit_task(). But is_32bit_task() applies on current task while be want the test done on task 'task' So add a new macro is_tsk_32bit_task() to check any task. Fixes: 770cec16cdc9 ("powerpc/audit: Simplify syscall_get_arch()") Fixes: 898a1ef06ad4 ("powerpc/audit: Avoid unneccessary #ifdef in syscall_get_arguments()") Cc: stable@vger.kernel.org Reported-by: Dmitry V. Levin Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/c55cddb8f65713bf5859ed675d75a50cb37d5995.1642159570.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/syscall.h | 4 ++-- arch/powerpc/include/asm/thread_info.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -90,7 +90,7 @@ static inline void syscall_get_arguments unsigned long val, mask = -1UL; unsigned int n = 6; - if (is_32bit_task()) + if (is_tsk_32bit_task(task)) mask = 0xffffffff; while (n--) { @@ -115,7 +115,7 @@ static inline void syscall_set_arguments static inline int syscall_get_arch(struct task_struct *task) { - if (is_32bit_task()) + if (is_tsk_32bit_task(task)) return AUDIT_ARCH_PPC; else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) return AUDIT_ARCH_PPC64LE; --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h @@ -165,8 +165,10 @@ static inline bool test_thread_local_fla #ifdef CONFIG_COMPAT #define is_32bit_task() (test_thread_flag(TIF_32BIT)) +#define is_tsk_32bit_task(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT)) #else #define is_32bit_task() (IS_ENABLED(CONFIG_PPC32)) +#define is_tsk_32bit_task(tsk) (IS_ENABLED(CONFIG_PPC32)) #endif #if defined(CONFIG_PPC64)