coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] selinux-h: only disable SELinux when a warning is provided


From: Pádraig Brady
Subject: Re: [PATCH] selinux-h: only disable SELinux when a warning is provided
Date: Sat, 10 Jan 2026 19:50:52 +0000
User-agent: Mozilla Thunderbird Beta

On 10/01/2026 03:12, Pádraig Brady wrote:
On 10/01/2026 01:53, Bruno Haible via Gnulib discussion list wrote:
Hi Michael,

This patch has two problems:

1) It very much looks like it has not been tested.
     If you submit a patch, by default, we assume that we can trust it because
     you have tested it. You can, alternatively, submit an untested patch,
     but then _say_so_, that it is untested.

The && and in the wrong place yes,
but the patch is reviewable.


2) The patch confuses two functionalities:
       - (a) whether to interface with libselinux,
       - (b) whether to build the chcon, runcon programs.
     By the GNU Coding Standards [1], (a) should be triggered by a --with-*
     configure option; whereas (b) should be triggered by a --enable-*
     configure option.

     So, instead of changing the meaning of the --with-selinux /
     --without-selinux options, what we would need is a patch that
     enables the build of the chcon, runcon programs conditionally based
     on some --enable-* option.

Bruno

[1] https://www.gnu.org/prep/standards/html_node/Configuration.html


runcon and chcon do link with libselinux on my Fedora system,
but yes the stubs don't need libselinux.

The idea with the coreutils 9.9 change¹ was to not bother
building stub chcon and runcon on systems without libselinux,
though you could override that default and force building those utils
with the --with-selinux option. I didn't think adding another
config variable was warranted for this.

Also buildilng of those utils can be controlled directly with the
./configure --enable-install-program=runcon,chcon
(and vice versa with --enable-no-install-program=PROG_LIST).
We just thought this was better default behavior,
but we can revert that change if it's problematic.

But yes in testing now without libselinux and --with-selinux
the stubs are not built because without Michael's change
with_selinux is forced to no, which impacts the
coreutils configure logic. I'll think a bit more about all this tomorrow.

BTW that `test -d /selinux` should be updated to
also check for the "/sys/fs/selinux" dir.

cheers,
Padraig

¹ https://github.com/coreutils/coreutils/commit/8ba47d09a

I've changed this instead to the following 2 patches.
The first fixes this issue by only overriding the with_selinux variable
in the default case where neither --with-selinux or --without-selinux is 
provided.
This better aligns with what the user requested, and also seems more consistent
since there are no other instances of this in gnulib as indicated by
  git grep -E 'with_[a-z]*=(yes|no) m4
I tested this in coretuils with and without libselinux,
with and without selinux.h, and with various ./configure option combinations.

The second patch uses the more modern /sys/fs/selinux path
so that we now warn if users are building without selinux devel libs
on a system that is in fact running selinux.

cheers,
Padraig

Attachment: 0001-selinux-h-only-override-default-with-selinux-user-se.patch
Description: Text Data

Attachment: 0002-selinux-h-warning-about-missing-libselinux-on-modern.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]