public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing v2] tests; skip non-root sendmsg_fs_cve
@ 2021-08-22 12:49 Pavel Begunkov
  0 siblings, 0 replies; only message in thread
From: Pavel Begunkov @ 2021-08-22 12:49 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Ammar Faizi

Skip sendmsg_fd_cve if we don't have enough privileges to chroot().

Cc: Ammar Faizi <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---

v2: fix error checking (Ammar Faizi)

 test/sendmsg_fs_cve.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/sendmsg_fs_cve.c b/test/sendmsg_fs_cve.c
index 8de220a..3866e5d 100644
--- a/test/sendmsg_fs_cve.c
+++ b/test/sendmsg_fs_cve.c
@@ -154,7 +154,13 @@ int main(int argc, char *argv[])
 	if (!c) {
 		close(rcv_sock);
 
-		if (chroot(tmpdir)) {
+		r = chroot(tmpdir);
+		if (r) {
+			if (errno == EPERM) {
+				fprintf(stderr, "chroot not allowed, skip\n");
+				return 0;
+			}
+
 			perror("chroot()");
 			return 1;
 		}
-- 
2.32.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-22 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-22 12:49 [PATCH liburing v2] tests; skip non-root sendmsg_fs_cve Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox