Skip to contentSkip to conversation

sanity.bbclass: raise_sanity_error if /tmp is noexec

PATCH New Michal Sieron 1 participant 1 message Feb 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sanity.bbclass: raise_sanity_error if /tmp is noexec

Older meson versions save 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.

---
 meta/classes-global/sanity.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes-global/sanity.bbclass +4 -0
index 1bd74e1935..bbbc41ddae 100644
@@ -840,6 +840,10 @@ 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
+    if os.statvfs("/tmp").f_flag & os.ST_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:
Signature · 1 line
2.43.0