From nobody Wed Apr 8 02:48:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FFF030B52C; Tue, 10 Mar 2026 15:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773155297; cv=none; b=Kezv/I4iKKz5H1d3phS6etUzS9gJXAIY2zt4g0dvGPzLMFNZJENycbAcGmd+XiGlyCQ4Q3eAWt/oJ1fWmVs4Qg7IxqrEyBGFIdnEl4+/L3cMsNnRYEpEN2hrw9oXaa4PO8gMC57VQiZe7Kgwy8QRa8eLYrickqXjf9vrIO5AuDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773155297; c=relaxed/simple; bh=qqYMWrM29fKZ0bq5/e1TqlgdXppZ9irTHMV+0rGa9XY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=P/AY/AYkAjdAISjSUiwQtEO3uqvGhVry3Tbu2N+D42Bg//7QX68K3xjX3xYD8sTPeGZh12wRQUCutlrVVLsg1hUdksAnfsfTzBQHUSRJBPZ2EcqQQXF5JISV1aTsrFki0u4OAWQ2l6e1+O5aav2xAb33VMw7iGHqRyhk8tLPHsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o5FS6g8L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o5FS6g8L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C413FC19423; Tue, 10 Mar 2026 15:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773155296; bh=qqYMWrM29fKZ0bq5/e1TqlgdXppZ9irTHMV+0rGa9XY=; h=From:To:Cc:Subject:Date:From; b=o5FS6g8LyNefMnJSHguOW5tuLdFfRIHKBXcEjdN+EA0QLHFNwalNQCBE79sgbBBmR qfKMp2ApyllMLf/owAh4L0Oh1HpdcTGyCaYY7UxCUJe4zYek4LSRCRNResNE2POgQQ PyakZH4flOttFCzVH8kkNJuBzDu98G51Y+ksD82jF1BgtAoMouN/S6lZyxafxQQtDu iLAva3urM8ppBZOmq/7W8Fcv8GCzd4anslAHHuvbJCyRX9gxrD7aalkKqrjkVsbnT+ Ze51iPAKyYoga9AViSgK74ZUNyUsI/Uht49nFD/dC0Gd7ul3Tu75HJ2CI5+cExgvzZ bPJz0AR1GxRAQ== From: "Christophe Leroy (CS GROUP)" To: Michael Ellerman , Nicholas Piggin , Madhavan Srinivasan , Paul Moore , Eric Paris , Venkat Rao Bagalkote Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, audit@vger.kernel.org, Thomas Weissschuh , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v3] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC Date: Tue, 10 Mar 2026 16:08:07 +0100 Message-ID: <261b1be5b8dc526b83d73e8281e682a73536ea28.1773155031.git.chleroy@kernel.org> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=6632; i=chleroy@kernel.org; h=from:subject:message-id; bh=U0nKvdJf3YL3PNU5hi1XIC6LU4/nhFywRBRqUPF+Rik=; b=owGbwMvMwCV2d0KB2p7V54MZT6slMWRuML4xq0m8YsZ0Y0mZ1wt4/p6RVUsTV9SZ8d/1UHRPo VVoVIFZRykLgxgXg6yYIsvx/9y7ZnR9Sc2fuksfZg4rE8gQBi5OAZhI8Q5GhifdSz0Xal+Mfxhz ZtVb2yzXdK+1P7Y/q7aZecsquW/GrZUM/4xTNNVb7qT98+P+4G7lUDUny3PmEacEcb4bwU0yZ1y W8wMA X-Developer-Key: i=chleroy@kernel.org; a=openpgp; fpr=10FFE6F8B390DE17ACC2632368A92FEB01B8DD78 Content-Transfer-Encoding: quoted-printable From: Christophe Leroy Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal targets") added generic support for AUDIT but that didn't include support for bi-arch like powerpc. Commit 4b58841149dc ("audit: Add generic compat syscall support") added generic support for bi-arch. Convert powerpc to that bi-arch generic audit support. With this change generated text is similar. Thomas has confirmed that the previously failing filter_exclude/test is now successful both without and with this patch, see [1] [1] https://lore.kernel.org/all/20260306115350-ef265661-6d6b-4043-9bd0-8e6b= 437d0d67@linutronix.de/ Link: https://github.com/linuxppc/issues/issues/412 Signed-off-by: Christophe Leroy Reviewed-by: C=C3=A9dric Le Goater --- Venkat, a test result with https://github.com/linux-audit/audit-testsuite w= ould be appreciated. v3: Rebased on v7.0-rc1 v2: https://lore.kernel.org/all/a4b3951d1191d4183d92a07a6097566bde60d00a.16= 29812058.git.christophe.leroy@csgroup.eu/ --- arch/powerpc/Kconfig | 5 +- arch/powerpc/include/asm/unistd32.h | 7 +++ arch/powerpc/kernel/Makefile | 3 - arch/powerpc/kernel/audit.c | 87 ----------------------------- arch/powerpc/kernel/compat_audit.c | 49 ---------------- 5 files changed, 8 insertions(+), 143 deletions(-) create mode 100644 arch/powerpc/include/asm/unistd32.h delete mode 100644 arch/powerpc/kernel/audit.c delete mode 100644 arch/powerpc/kernel/compat_audit.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 10240cb80904..4bb8cfa37d79 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -188,6 +188,7 @@ config PPC select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if PPC_RADIX_MMU select ARCH_WANTS_MODULES_DATA_IN_VMALLOC if PPC_BOOK3S_32 || PPC_8xx select ARCH_WEAK_RELEASE_ACQUIRE + select AUDIT_ARCH_COMPAT_GENERIC select BINFMT_ELF select BUILDTIME_TABLE_SORT select CLONE_BACKWARDS @@ -370,10 +371,6 @@ config GENERIC_TBSYNC bool default y if PPC32 && SMP =20 -config AUDIT_ARCH - bool - default y - config GENERIC_BUG bool default y diff --git a/arch/powerpc/include/asm/unistd32.h b/arch/powerpc/include/asm= /unistd32.h new file mode 100644 index 000000000000..07689897d206 --- /dev/null +++ b/arch/powerpc/include/asm/unistd32.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _ASM_POWERPC_UNISTD32_H_ +#define _ASM_POWERPC_UNISTD32_H_ + +#include + +#endif /* _ASM_POWERPC_UNISTD32_H_ */ diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 2f0a2e69c607..7bf6b16b2d93 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -149,9 +149,6 @@ obj-$(CONFIG_PCI) +=3D pci_$(BITS).o $(pci64-y) \ pci-common.o pci_of_scan.o obj-$(CONFIG_PCI_MSI) +=3D msi.o =20 -obj-$(CONFIG_AUDIT) +=3D audit.o -obj64-$(CONFIG_AUDIT) +=3D compat_audit.o - obj-y +=3D trace/ =20 ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c deleted file mode 100644 index 92298d6a3a37..000000000000 --- a/arch/powerpc/kernel/audit.c +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include - -#include "audit_32.h" - -static unsigned dir_class[] =3D { -#include -~0U -}; - -static unsigned read_class[] =3D { -#include -~0U -}; - -static unsigned write_class[] =3D { -#include -~0U -}; - -static unsigned chattr_class[] =3D { -#include -~0U -}; - -static unsigned signal_class[] =3D { -#include -~0U -}; - -int audit_classify_arch(int arch) -{ -#ifdef CONFIG_PPC64 - if (arch =3D=3D AUDIT_ARCH_PPC) - return 1; -#endif - return 0; -} - -int audit_classify_syscall(int abi, unsigned syscall) -{ -#ifdef CONFIG_PPC64 - if (abi =3D=3D AUDIT_ARCH_PPC) - return ppc32_classify_syscall(syscall); -#endif - switch(syscall) { - case __NR_open: - return AUDITSC_OPEN; - case __NR_openat: - return AUDITSC_OPENAT; - case __NR_socketcall: - return AUDITSC_SOCKETCALL; - case __NR_execve: - return AUDITSC_EXECVE; - case __NR_openat2: - return AUDITSC_OPENAT2; - default: - return AUDITSC_NATIVE; - } -} - -static int __init audit_classes_init(void) -{ -#ifdef CONFIG_PPC64 - extern __u32 ppc32_dir_class[]; - extern __u32 ppc32_write_class[]; - extern __u32 ppc32_read_class[]; - extern __u32 ppc32_chattr_class[]; - extern __u32 ppc32_signal_class[]; - audit_register_class(AUDIT_CLASS_WRITE_32, ppc32_write_class); - audit_register_class(AUDIT_CLASS_READ_32, ppc32_read_class); - audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ppc32_dir_class); - audit_register_class(AUDIT_CLASS_CHATTR_32, ppc32_chattr_class); - audit_register_class(AUDIT_CLASS_SIGNAL_32, ppc32_signal_class); -#endif - audit_register_class(AUDIT_CLASS_WRITE, write_class); - audit_register_class(AUDIT_CLASS_READ, read_class); - audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); - audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); - audit_register_class(AUDIT_CLASS_SIGNAL, signal_class); - return 0; -} - -__initcall(audit_classes_init); diff --git a/arch/powerpc/kernel/compat_audit.c b/arch/powerpc/kernel/compa= t_audit.c deleted file mode 100644 index 57b38c592b9f..000000000000 --- a/arch/powerpc/kernel/compat_audit.c +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#undef __powerpc64__ -#include -#include - -#include "audit_32.h" - -unsigned ppc32_dir_class[] =3D { -#include -~0U -}; - -unsigned ppc32_chattr_class[] =3D { -#include -~0U -}; - -unsigned ppc32_write_class[] =3D { -#include -~0U -}; - -unsigned ppc32_read_class[] =3D { -#include -~0U -}; - -unsigned ppc32_signal_class[] =3D { -#include -~0U -}; - -int ppc32_classify_syscall(unsigned syscall) -{ - switch(syscall) { - case __NR_open: - return AUDITSC_OPEN; - case __NR_openat: - return AUDITSC_OPENAT; - case __NR_socketcall: - return AUDITSC_SOCKETCALL; - case __NR_execve: - return AUDITSC_EXECVE; - case __NR_openat2: - return AUDITSC_OPENAT2; - default: - return AUDITSC_COMPAT; - } -} --=20 2.49.0