From: Michal Sieron <michalwsieron@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Michal Sieron <michalwsieron@gmail.com>
Subject: [PATCH] sanity.bbclass: raise_sanity_error if /tmp is noexec
Date: Fri, 9 Feb 2024 15:09:39 +0100 [thread overview]
Message-ID: <20240209140939.186588-1-michalwsieron@gmail.com> (raw)
meson saves its temporary scripts in /tmp.
Similarly some recipies also do that (e.g. ccan in sbsigntool).
As this can lead to unexpected build failures with no simple way
to workaround, make such setup a fatal error.
Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
---
meta/classes-global/sanity.bbclass | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 1bd74e1935..205516bf6a 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -840,6 +840,21 @@ def check_sanity_everybuild(status, d):
status.addresult("Please use a umask which allows a+rx and u+rwx\n")
os.umask(omask)
+ # Ensure /tmp is NOT mounted with noexec
+ with open("/proc/mounts", "r") as f:
+ for line in f:
+ # format is described in fstab(5)
+ _, fs_file, _, fs_mntops, *_ = line.split()
+
+ # we only want to check /tmp
+ if fs_file != "/tmp":
+ continue
+
+ # iterate through the options from the end
+ for opt in reversed(fs_mntops.split(",")):
+ if opt == "noexec":
+ raise_sanity_error("/tmp shouldn't be mounted with noexec.", d)
+
if d.getVar('TARGET_ARCH') == "arm":
# This path is no longer user-readable in modern (very recent) Linux
try:
--
2.43.0
next reply other threads:[~2024-02-09 14:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 14:09 Michal Sieron [this message]
2024-02-09 15:57 ` [OE-core] [PATCH] sanity.bbclass: raise_sanity_error if /tmp is noexec Ross Burton
2024-02-21 7:18 ` ChenQi
2024-02-21 9:48 ` Ross Burton
2024-02-21 10:08 ` Alexander Kanavin
2024-02-21 21:36 ` Randy MacLeod
2024-02-22 9:41 ` michalwsieron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240209140939.186588-1-michalwsieron@gmail.com \
--to=michalwsieron@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox