diff mbox series

[meta-oe,16/26] leancrypto: drop redundant <linux/prctl.h> include

Message ID 20260929225723.1046705-16-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,01/26] canvenient: include <sys/time.h> for struct timeval on musl | expand

Commit Message

Khem Raj Sept. 29, 2026, 10:57 p.m. UTC
secure_execution_linux.c includes both <sys/prctl.h> and
<linux/prctl.h>; musl's <sys/prctl.h> already declares everything
needed, and including the raw uapi header afterwards redefines struct
prctl_mm_map.

AI-Generated: Uses Claude Code

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ..._linux-drop-redundant-linux-prctl.h-.patch | 35 +++++++++++++++++++
 .../leancrypto/leancrypto_1.9.0.bb            |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta-oe/recipes-crypto/leancrypto/files/0001-secure_execution_linux-drop-redundant-linux-prctl.h-.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-crypto/leancrypto/files/0001-secure_execution_linux-drop-redundant-linux-prctl.h-.patch b/meta-oe/recipes-crypto/leancrypto/files/0001-secure_execution_linux-drop-redundant-linux-prctl.h-.patch
new file mode 100644
index 0000000000..dd6db04c2d
--- /dev/null
+++ b/meta-oe/recipes-crypto/leancrypto/files/0001-secure_execution_linux-drop-redundant-linux-prctl.h-.patch
@@ -0,0 +1,35 @@ 
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Tue, 29 Sep 2026 02:14:39 +0000
+Subject: [PATCH] secure_execution_linux: drop redundant linux/prctl.h include
+
+<sys/prctl.h> alone already provides everything this file needs
+(PR_SET_SPECULATION_CTRL, the PR_SPEC_* constants, and struct
+prctl_mm_map on libcs that define it). Do not also include
+<linux/prctl.h>: musl's <sys/prctl.h> defines struct prctl_mm_map
+unconditionally, and <linux/prctl.h> defines the identical struct with
+no compatibility guard against it, so including both is a hard
+"redefinition of 'prctl_mm_map'" error.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+diff --git a/internal/src/secure_execution_linux.c b/internal/src/secure_execution_linux.c
+index 7264edf..df57a88 100644
+--- a/internal/src/secure_execution_linux.c
++++ b/internal/src/secure_execution_linux.c
+@@ -17,7 +17,14 @@
+  * DAMAGE.
+  */
+
+-#include <linux/prctl.h>
++/*
++ * <sys/prctl.h> alone already provides everything this file needs
++ * (PR_SET_SPECULATION_CTRL, the PR_SPEC_* constants, and on some libcs
++ * struct prctl_mm_map). Do not also include <linux/prctl.h>: musl's
++ * <sys/prctl.h> defines struct prctl_mm_map unconditionally, and
++ * <linux/prctl.h> defines the identical struct with no compatibility
++ * guard against it, so including both is a hard "redefinition" error.
++ */
+ #include <sys/prctl.h>
+
+ #include "ext_headers_internal.h"
diff --git a/meta-oe/recipes-crypto/leancrypto/leancrypto_1.9.0.bb b/meta-oe/recipes-crypto/leancrypto/leancrypto_1.9.0.bb
index 566f44fb76..5cd9f02254 100644
--- a/meta-oe/recipes-crypto/leancrypto/leancrypto_1.9.0.bb
+++ b/meta-oe/recipes-crypto/leancrypto/leancrypto_1.9.0.bb
@@ -13,6 +13,7 @@  LIC_FILES_CHKSUM = " \
 SECTION = "libs"
 SRC_URI = "git://github.com/smuellerDD/leancrypto.git;branch=master;protocol=https;tag=v${PV} \
            file://leancrypto-tests.sh \
+           file://0001-secure_execution_linux-drop-redundant-linux-prctl.h-.patch \
            "
 SRCREV = "0110b781707c7bdde88482933811387b744d21eb"