From: Jacob Moody <moody@mail.posixcafe.org> To: 9front@9front.org Subject: [9front] [PATCH] kernel: disallow executing from #| or #d Date: Tue, 10 May 2022 00:40:44 -0600 [thread overview] Message-ID: <28db6450-6d7c-977f-aaff-62f152e79968@posixcafe.org> (raw) Hello, I noticed that you could execute from #| and #d. ex: cpu% bind '#|' /n/pipetest cpu% /n/pipetest/data1 & cpu% echo '#!/bin/rc' >> /n/pipetest/data cpu% echo 'echo hello' >> /n/pipetest/data cpu% hello I believe this would also work for binaries if the writer could predict what parts of the binary the kernel will want to read. I am inclined to block this behavior but would be curious what others think. Included is a patch to error on OEXEC opens in devdup and devpipe. thanks, moody --- diff 6ca8e6bbafcc871301a90aa7bd4ca10533b1999a 521f304f5db4c74740b3e00503e2bf22e9f60dc6 --- a/sys/src/9/port/devdup.c Mon May 9 11:22:00 2022 +++ b/sys/src/9/port/devdup.c Tue May 10 00:35:16 2022 @@ -63,7 +63,7 @@ Chan *f; int fd, twicefd; - if(omode & ORCLOSE) + if(omode & ORCLOSE || omode & OEXEC) error(Eperm); if(c->qid.type & QTDIR){ if(omode != 0) --- a/sys/src/9/port/devpipe.c Mon May 9 11:22:00 2022 +++ b/sys/src/9/port/devpipe.c Tue May 10 00:35:16 2022 @@ -228,6 +228,8 @@ c->offset = 0; return c; } + if(omode == OEXEC) + error(Eperm); p = c->aux; qlock(p);
next reply other threads:[~2022-05-10 6:43 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 6:40 Jacob Moody [this message] 2022-05-10 14:40 ` ori 2022-05-10 16:34 ` Jacob Moody 2022-05-10 19:59 ` Amavect 2022-05-10 22:47 ` Jacob Moody 2022-05-11 4:21 ` Amavect 2022-05-11 6:31 ` Jacob Moody 2022-05-11 16:32 ` Amavect 2022-05-11 16:50 ` Jacob Moody 2022-05-15 2:43 ` Amavect 2022-05-15 15:26 ` Amavect 2022-05-15 16:28 ` Jacob Moody 2022-05-10 20:52 ` [9front] " Anthony Martin
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=28db6450-6d7c-977f-aaff-62f152e79968@posixcafe.org \ --to=moody@mail.posixcafe.org \ --cc=9front@9front.org \ --subject='Re: [9front] [PATCH] kernel: disallow executing from #| or #d' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).