Skip to contentSkip to conversation

busybox.inc: Add sanity check to test if the suid binary provides sh

PATCH New Nathan Rossi 1 participant 1 message Jan 24, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 busybox.inc: Add sanity check to test if the suid binary provides sh

Add a sanity check during the do_compile task to fail if the suid busybox provides /bin/sh. This is considered as a hard fail since not only is providing sh as suid problematic for security reasons but also because the sh configured for suid is less functional than the nosuid configured sh and breaks a number of required features (e.g. 64-bit test).

---
Changes in v2:
* Rebase on master

---
 meta/recipes-core/busybox/busybox.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-core/busybox/busybox.inc +6 -0
index 4012f921c6..157aea3968 100644
@@ -183,6 +183,12 @@ do_compile() {
 			oe_runmake busybox.links
 			mv busybox.links busybox.links.$s
 		done
+
+		# hard fail if sh is being linked to the suid busybox (detects bug 10346)
+		if grep -q -x "/bin/sh" busybox.links.suid; then
+			bbfatal "busybox suid binary incorrectly provides /bin/sh"
+		fi
+
 		# copy .config.orig back to .config, because the install process may check this file
 		cp .config.orig .config
 		# cleanup
Signature · 1 line
2.15.1