From nobody Fri Apr 10 01:01:18 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DDC8337AA76; Thu, 5 Mar 2026 09:31:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772703107; cv=none; b=EXld9y+14/V/i62McgSRrCShFf3KjDFBgePlUh+RpGD+D0iqp9cz5s8/8Ce6d2Rq+ODjODf5H0uMDCHoFkaQN24CfHAC+5qLOzrtrVa8SdH7kM6wqbZHeRp7ka4ESCx8g+cWyMkMTp+fv7qqLUdSimkpDI4zAU32WhHMmSs4HQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772703107; c=relaxed/simple; bh=82oL3WtgAN64LHuHNcsjPBuF0YKIbNmJsitQ2BVqkYo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X+PWn0BNH1MuaR423Ic2tGhczasLoWWBXeterYnsYLVkh3i0JPwLyUHK5Dqq2rB4YpaSL/c6QwNh7dw53qE4jCSIlNwgzbbjN5+4npWQkXlANMEVVZFXn4kJGWA90AjpNX5DPam3bmh/DeOWxRaDLRfHveajXnj8T9x3qGvIn6Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=a1wtCuT4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oIH8L7Ca; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="a1wtCuT4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oIH8L7Ca" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1772703101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J9omS7dgQ8BXV+q++KcFWhKgcxzIXmvC9J+vXgoKmAc=; b=a1wtCuT4kbdfqFBMSFsUN/+Jv5gS3A2ijamCz78QGDuVJjgfBMTOyfhSF2b6QXP7pfEKDg DHXnQU+6pyFD5fDlttMREOvNCk3vjh2K9nY0gvjY7O90DFjTCB/SbgOZz0AkXPLZmzAQmu HOZ/OIJkIEGjBddrtpM2cS2diZcpOMKhC1RDLGdrKuJNsiVMWPt5oVVy25kA/4kV/cvzwR ppkqPQD9IGWYFzHP4pIn5rukSpn5n/eIfcOzUwkFW4ok7PuEEb8RGwz2k73wVz7H+U1Ucu s4aRvqF7FYuqgxRnSfLGGGciWSTIR4ZoVnAiBGoaETIuZwGSQoVe9l6NVKGamw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1772703101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J9omS7dgQ8BXV+q++KcFWhKgcxzIXmvC9J+vXgoKmAc=; b=oIH8L7Ca04BHMvndYJhlfynKj/xQQIXNBQI1L9G8ANj4P5hJK9BKK6DPvvhg9jaW2N1+8p v87O6WFnnBevDACg== Date: Thu, 05 Mar 2026 10:31:41 +0100 Subject: [PATCH v3 5/8] module: Move 'struct module_signature' to UAPI 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" Content-Transfer-Encoding: quoted-printable Message-Id: <20260305-module-signature-uapi-v3-5-92f45ea6028c@linutronix.de> References: <20260305-module-signature-uapi-v3-0-92f45ea6028c@linutronix.de> In-Reply-To: <20260305-module-signature-uapi-v3-0-92f45ea6028c@linutronix.de> To: David Howells , David Woodhouse , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , Paul Moore , James Morris , "Serge E. Hallyn" , Nathan Chancellor , Nicolas Schier , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, linux-s390@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kbuild@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1772703098; l=3350; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=82oL3WtgAN64LHuHNcsjPBuF0YKIbNmJsitQ2BVqkYo=; b=b7OnbRvjkCM/Ukho8W12uwactly22IwUxgp+MCGw8str44A0U30SwJC1GT+wl2r5nicWUr7Nm KMoqSDIWDg0C38kZW5Q61vEJQwBqNNdxuZQcONaPYuuBQXANJZTkQoQ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= This structure definition is used outside the kernel proper. For example in kmod and the kernel build environment. To allow reuse, move it to a new UAPI header. While it is not a true UAPI, it is a common practice to have non-UAPI interface definitions in the kernel's UAPI headers. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Petr Pavlu --- include/linux/module_signature.h | 28 +----------------------- include/uapi/linux/module_signature.h | 41 +++++++++++++++++++++++++++++++= ++++ 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/include/linux/module_signature.h b/include/linux/module_signat= ure.h index 915549c779dc..db335d46787f 100644 --- a/include/linux/module_signature.h +++ b/include/linux/module_signature.h @@ -10,33 +10,7 @@ #define _LINUX_MODULE_SIGNATURE_H =20 #include - -/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ -#define MODULE_SIGNATURE_MARKER "~Module signature appended~\n" - -enum module_signature_type { - MODULE_SIGNATURE_TYPE_PKCS7 =3D 2, /* Signature in PKCS#7 message */ -}; - -/* - * Module signature information block. - * - * The constituents of the signature section are, in order: - * - * - Signer's name - * - Key identifier - * - Signature data - * - Information block - */ -struct module_signature { - u8 algo; /* Public-key crypto algorithm [0] */ - u8 hash; /* Digest algorithm [0] */ - u8 id_type; /* Key identifier type [enum module_signature_type] */ - u8 signer_len; /* Length of signer's name [0] */ - u8 key_id_len; /* Length of key identifier [0] */ - u8 __pad[3]; - __be32 sig_len; /* Length of signature data */ -}; +#include =20 int mod_check_sig(const struct module_signature *ms, size_t file_len, const char *name); diff --git a/include/uapi/linux/module_signature.h b/include/uapi/linux/mod= ule_signature.h new file mode 100644 index 000000000000..634c9f1c8fc2 --- /dev/null +++ b/include/uapi/linux/module_signature.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* + * Module signature handling. + * + * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + */ + +#ifndef _UAPI_LINUX_MODULE_SIGNATURE_H +#define _UAPI_LINUX_MODULE_SIGNATURE_H + +#include + +/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */ +#define MODULE_SIGNATURE_MARKER "~Module signature appended~\n" + +enum module_signature_type { + MODULE_SIGNATURE_TYPE_PKCS7 =3D 2, /* Signature in PKCS#7 message */ +}; + +/* + * Module signature information block. + * + * The constituents of the signature section are, in order: + * + * - Signer's name + * - Key identifier + * - Signature data + * - Information block + */ +struct module_signature { + __u8 algo; /* Public-key crypto algorithm [0] */ + __u8 hash; /* Digest algorithm [0] */ + __u8 id_type; /* Key identifier type [enum module_signature_type] */ + __u8 signer_len; /* Length of signer's name [0] */ + __u8 key_id_len; /* Length of key identifier [0] */ + __u8 __pad[3]; + __be32 sig_len; /* Length of signature data */ +}; + +#endif /* _UAPI_LINUX_MODULE_SIGNATURE_H */ --=20 2.53.0