Skip to contentSkip to conversation

POSIX capability broken pseudo

PATCH Kumar, Shrawan 1 participant 1 message Jul 9, 2018

lore
Share & tools
lore
#0 lore raw

Hello Team,

Under DISTRO_VERSION = "2.0.2" ("jethro"), I was using the attached “setcap.patch” on pseudo_1.7.4 to get POSIX capability set in the files as below :

pkg_postinst_${PN}() {

setcap cap_net_raw+ep $D$bindir/helloworld

}

This was working fine.

However, recently switched to DISTRO_VERSION = "2.2.2" ("morty") - pseudo_1.8.1, where the patch is getting applied but the POSIX capabilities are not getting set.

Can someone help here?

Regards
Shrawan

ports/linux/guts/capset.c new file +13 -0
new file mode 100644
index 0000000..51e0cdf
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2016 Wind River Systems; see
+ * guts/COPYRIGHT for information.
+ *
+ * int capset(cap_user_header_t hdrp, const cap_user_data_t datap)
+ *	int rc = -1;
+ */
+
+	rc = real_capset(hdrp, datap);
+
+/*	return rc;
+ * }
+ */
ports/linux/portdefs.h +2 -0
index f0a0e40..d8c5020 100644
@@ -25,3 +25,5 @@ GLIBC_COMPAT_SYMBOL(memcpy,2.2.5);
 #elif defined(__i386__)
 GLIBC_COMPAT_SYMBOL(memcpy,2.0);
 #endif
+
+#include <linux/capability.h>
ports/linux/pseudo_wrappers.c +7 -0
index 26b29b0..c6c072b 100644
@@ -31,3 +31,10 @@ int
 pseudo_fstat64(int fd, struct stat64 *buf) {
 	return real___fxstat64(_STAT_VER, fd, buf);
 }
+
+int pseudo_capset(cap_user_header_t hdrp, const cap_user_data_t datap) {
+	(void)hdrp;
+	(void)datap;
+
+	return 0;
+}
ports/linux/wrapfuncs.in +1 -0
index 3b8955a..578db35 100644
@@ -51,3 +51,4 @@ int euidaccess(const char *path, int mode);
 int getpw(uid_t uid, char *buf);
 int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp);
 int getgrent_r(struct group *gbuf, char *buf, size_t buflen, struct group **gbufp);
+int capset(cap_user_header_t hdrp, const cap_user_data_t datap); /* real_func=pseudo_capset */
Signature · 1 line
2.8.0