From: Ross Burton <Ross.Burton@arm.com>
To: "michalwsieron@gmail.com" <michalwsieron@gmail.com>
Cc: "openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] sanity.bbclass: raise_sanity_error if /tmp is noexec
Date: Fri, 9 Feb 2024 15:57:39 +0000 [thread overview]
Message-ID: <94AE8BC1-9AA9-4DFB-B7B6-80CC83897ACD@arm.com> (raw)
In-Reply-To: <20240209140939.186588-1-michalwsieron@gmail.com>
On 9 Feb 2024, at 14:09, Michal Sieron via lists.openembedded.org <michalwsieron=gmail.com@lists.openembedded.org> wrote:
> + # Ensure /tmp is NOT mounted with noexec
> + with open("/proc/mounts", "r") as f:
> + for line in f:
> + # format is described in fstab(5)
> + _, fs_file, _, fs_mntops, *_ = line.split()
> +
> + # we only want to check /tmp
> + if fs_file != "/tmp":
> + continue
> +
> + # iterate through the options from the end
> + for opt in reversed(fs_mntops.split(",")):
> + if opt == "noexec":
> + raise_sanity_error("/tmp shouldn't be mounted with noexec.", d)
> +
Alternatively, this is neater:
os.statvfs("/tmp").f_flag & os.ST_NOEXEC
Ross
next prev parent reply other threads:[~2024-02-09 15:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 14:09 [PATCH] sanity.bbclass: raise_sanity_error if /tmp is noexec Michal Sieron
2024-02-09 15:57 ` Ross Burton [this message]
2024-02-21 7:18 ` [OE-core] " ChenQi
2024-02-21 9:48 ` Ross Burton
2024-02-21 10:08 ` Alexander Kanavin
2024-02-21 21:36 ` Randy MacLeod
2024-02-22 9:41 ` michalwsieron
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=94AE8BC1-9AA9-4DFB-B7B6-80CC83897ACD@arm.com \
--to=ross.burton@arm.com \
--cc=michalwsieron@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox