From: Petr Lautrbach <plautrba@redhat.com>
To: selinux@vger.kernel.org
Cc: Topi Miettinen <toiwoton@gmail.com>
Subject: Re: [PATCH v2] libselinux: mount selinuxfs noexec and nosuid
Date: Mon, 4 May 2020 10:41:35 +0200 [thread overview]
Message-ID: <20200504084135.GA246062@workstation> (raw)
In-Reply-To: <20200428111142.6072-1-toiwoton@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]
On Tue, Apr 28, 2020 at 02:11:42PM +0300, Topi Miettinen wrote:
> Mount selinuxfs with mount flags noexec and nosuid. It's not likely
> that this has any effect, but it's visually more pleasing.
>
> Option nodev can't be used because of /sys/fs/selinux/null device,
> which is used by Android.
>
> Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Applied.
> ---
> libselinux/src/load_policy.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libselinux/src/load_policy.c b/libselinux/src/load_policy.c
> index fa1a3bf1..2aea826f 100644
> --- a/libselinux/src/load_policy.c
> +++ b/libselinux/src/load_policy.c
> @@ -279,7 +279,8 @@ int selinux_init_load_policy(int *enforce)
> const char *mntpoint = NULL;
> /* First make sure /sys is mounted */
> if (mount("sysfs", "/sys", "sysfs", 0, 0) == 0 || errno == EBUSY) {
> - if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
> + /* MS_NODEV can't be set because of /sys/fs/selinux/null device, used by Android */
> + if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, MS_NOEXEC | MS_NOSUID, 0) == 0 || errno == EBUSY) {
> mntpoint = SELINUXMNT;
> } else {
> /* check old mountpoint */
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2020-05-04 8:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 11:11 [PATCH v2] libselinux: mount selinuxfs noexec and nosuid Topi Miettinen
2020-04-29 15:30 ` Stephen Smalley
2020-05-04 8:41 ` Petr Lautrbach [this message]
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=20200504084135.GA246062@workstation \
--to=plautrba@redhat.com \
--cc=selinux@vger.kernel.org \
--cc=toiwoton@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.