security: mark nf ops in SELinux and Smack as __ro_after_init
Subsystems (3)
James Morris
maintainerRFC PATCH 2/4 security: mark nf ops in SELinux and Smack as __ro_after_init
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as __ro_after_init.
--- security/selinux/hooks.c | 2 +- security/smack/smack_netfilter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
security/selinux/hooks.c +1 -1
@@ -6379,7 +6379,7 @@ void selinux_complete_init(void) #if defined(CONFIG_NETFILTER) -static struct nf_hook_ops selinux_nf_ops[] = { +static struct nf_hook_ops selinux_nf_ops[] __ro_after_init = { { .hook = selinux_ipv4_postroute, .pf = NFPROTO_IPV4,
security/smack/smack_netfilter.c +1 -1
@@ -57,7 +57,7 @@ static unsigned int smack_ipv4_output(void *priv,return NF_ACCEPT ; } -static struct nf_hook_ops smack_nf_ops[] = { +static struct nf_hook_ops smack_nf_ops[]__ro_after_init = { { .hook = smack_ipv4_output, .pf =NFPROTO_IPV4 ,
Signature · 1 line
1.7.1
Quoted 4 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Signed-off-by James Morris <[email protected]>
This patch breaks CONFIG_SECURITY_SELINUX_DISABLE=y + SELINUX=disabled in /etc/selinux/config case, doesn't it? Although I heard that SELinux is planning to remove CONFIG_SECURITY_SELINUX_DISABLE, CONFIG_SECURITY_SELINUX_DISABLE is valid as of current linux-security.git#next .
Quoted 9 lines · Tetsuo Handa
Quoted 4 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Signed-off-by James Morris <[email protected]>This patch breaks
CONFIG_SECURITY_SELINUX_DISABLE=y+ SELINUX=disabled in/etc/selinux/configcase, doesn't it? Although I heard that SELinux is planning to removeCONFIG_SECURITY_SELINUX_DISABLE,CONFIG_SECURITY_SELINUX_DISABLEis valid as of current linux-security.git#next .
We could fold that removal into this series?
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Quoted 10 lines · Kees Cook
Quoted 8 lines · Tetsuo Handa
Quoted 5 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Signed-off-by James Morris <[email protected]>
Quoted 8 lines
Quoted 6 lines
This patch breaks
CONFIG_SECURITY_SELINUX_DISABLE=y+ SELINUX=disabled in/etc/selinux/configcase,
doesn't it? Although I heard that SELinux is planning to removeCONFIG_SECURITY_SELINUX_DISABLE,CONFIG_SECURITY_SELINUX_DISABLEis valid as of current linux- security.git#next .We could fold that removal into this series?
I'm personally in favor of removing it, but that support was originally requested by the Fedora distro folks on the grounds that it is too painful to manage kernel boot parameters on some platforms, and therefore they needed an alternative to booting with selinux=0 on the kernel command line. The documented way to disable SELinux on such distros is through the use of /etc/selinux/config SELINUX=disabled, which relies on this mechanism. So you'd have to work through removal with the distro folks.
Maybe in the interim we could just wrap the ro-after-init markings under a conditional dependent on !CONFIG_SECURITY_SELINUX_DISABLE so that systems (e.g. Android) that do not rely on this feature could benefit.
Casey Schaufler
maintainerQuoted 24 lines · Stephen Smalley
Quoted 6 lines · Kees Cook
Quoted 4 lines · Tetsuo Handa
Quoted 3 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by James Morris <[email protected]>This patch breaks
CONFIG_SECURITY_SELINUX_DISABLE=y+ SELINUX=disabled in/etc/selinux/configcase,
doesn't it? Although I heard that SELinux is planning to removeCONFIG_SECURITY_SELINUX_DISABLE,CONFIG_SECURITY_SELINUX_DISABLEis valid as of current linux- security.git#next .We could fold that removal into this series?
I'm personally in favor of removing it, but that support was originally requested by the Fedora distro folks on the grounds that it is too painful to manage kernel boot parameters on some platforms, and therefore they needed an alternative to booting with selinux=0 on the kernel command line. The documented way to disable SELinux on such distros is through the use of
/etc/selinux/configSELINUX=disabled, which relies on this mechanism. So you'd have to work through removal with the distro folks.
Quoted 4 lines
Maybe in the interim we could just wrap the ro-after-init markings under a conditional dependent on !CONFIG_SECURITY_SELINUX_DISABLE so that systems (e.g. Android) that do not rely on this feature could benefit.
If we changed CONFIG_SECURITY_SELINUX_DISABLE to CONFIG_SECURITY_DYNAMIC_MODULES and put the __ro_after_init under !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Casey Schaufler
Quoted 24 lines · Stephen Smalley
Quoted 6 lines · Kees Cook
Quoted 4 lines · Tetsuo Handa
Quoted 3 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by James Morris <[email protected]>This patch breaks
CONFIG_SECURITY_SELINUX_DISABLE=y+ SELINUX=disabled in/etc/selinux/configcase,
doesn't it? Although I heard that SELinux is planning to removeCONFIG_SECURITY_SELINUX_DISABLE,CONFIG_SECURITY_SELINUX_DISABLEis valid as of current linux- security.git#next .We could fold that removal into this series?
I'm personally in favor of removing it, but that support was originally requested by the Fedora distro folks on the grounds that it is too painful to manage kernel boot parameters on some platforms, and therefore they needed an alternative to booting with selinux=0 on the kernel command line. The documented way to disable SELinux on such distros is through the use of
/etc/selinux/configSELINUX=disabled, which relies on this mechanism. So you'd have to work through removal with the distro folks.Quoted 4 lines
Maybe in the interim we could just wrap the ro-after-init markings under a conditional dependent on !CONFIG_SECURITY_SELINUX_DISABLE so that systems (e.g. Android) that do not rely on this feature could benefit.
Quoted 4 lines
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.
Something like...
#ifdef CONFIG_SECURITY_DYNAMIC_LSM
# define lsm_ro_after_init __ro_after_init # define lsm_const const #else # define lsm_ro_after_init # define lsm_const #endif
?
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Casey Schaufler
maintainerQuoted 37 lines · Kees Cook
Quoted 25 lines · Casey Schaufler
Quoted 24 lines · Stephen Smalley
Quoted 6 lines · Kees Cook
Quoted 4 lines · Tetsuo Handa
Quoted 3 lines · James Morris
Both SELinux and Smack register Netfilter operations during init, which then don't change. Mark these ops as
__ro_after_init.Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by James Morris <[email protected]>This patch breaks
CONFIG_SECURITY_SELINUX_DISABLE=y+ SELINUX=disabled in/etc/selinux/configcase,
doesn't it? Although I heard that SELinux is planning to removeCONFIG_SECURITY_SELINUX_DISABLE,CONFIG_SECURITY_SELINUX_DISABLEis valid as of current linux- security.git#next .We could fold that removal into this series?
I'm personally in favor of removing it, but that support was originally requested by the Fedora distro folks on the grounds that it is too painful to manage kernel boot parameters on some platforms, and therefore they needed an alternative to booting with selinux=0 on the kernel command line. The documented way to disable SELinux on such distros is through the use of
/etc/selinux/configSELINUX=disabled, which relies on this mechanism. So you'd have to work through removal with the distro folks.Quoted 8 lines
Quoted 4 lines
Maybe in the interim we could just wrap the ro-after-init markings under a conditional dependent on !CONFIG_SECURITY_SELINUX_DISABLE so that systems (e.g. Android) that do not rely on this feature could benefit.
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.Something like...
#ifdef
CONFIG_SECURITY_DYNAMIC_LSM
Quoted 8 lines
# define lsm_ro_after_init __ro_after_init # define lsm_const const #else # define lsm_ro_after_init # define lsm_const #endif?
That's more elaborate than I was thinking, but sure. I was going to put ifdefs in the respective declarations, but this may be more in line with modern tastes.
Quoted 3 lines
-Kees
Re: [kernel-hardening] Re: [RFC PATCH 2/4] security: mark nf ops inSELinux and Smack as __ro_after_init
In reply to Kees CookQuoted 9 lines · Kees Cook
Quoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.Something like...
#ifdef
CONFIG_SECURITY_DYNAMIC_LSM
Quoted 8 lines
# define lsm_ro_after_init __ro_after_init # define lsm_const const #else # define lsm_ro_after_init # define lsm_const #endif?
Fedora/RHEL won't use CONFIG_SECURITY_DYNAMIC_LSM=y whereas LKM based LSMs are targeted for such distributions.
I don't worry much about Android, for manufactures who ship their products with TOMOYO enabled can rebuild their kernels. But asking for rebuild of Fedora/RHEL kernels to end users is too painful.
Re: [kernel-hardening] Re: [RFC PATCH 2/4] security: mark nf ops inSELinux and Smack as __ro_after_init
Quoted 17 lines · Tetsuo Handa
Quoted 16 lines · Kees Cook
Quoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.Something like...
#ifdef
CONFIG_SECURITY_DYNAMIC_LSM# define lsm_ro_after_init __ro_after_init # define lsm_const const #else # define lsm_ro_after_init # define lsm_const #endif
Quoted 8 lines
Quoted 1 line
?
Fedora/RHEL won't use
CONFIG_SECURITY_DYNAMIC_LSM=ywhereas LKM based LSMs are targeted for such distributions.I don't worry much about Android, for manufactures who ship their products with TOMOYO enabled can rebuild their kernels. But asking for rebuild of Fedora/RHEL kernels to end users is too painful.
I thought the argument was that Fedora WOULD ship that way, since it needs to have the run-time selinux disabling feature?
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Quoted 24 lines · Kees Cook
Quoted 22 lines · Tetsuo Handa
Quoted 9 lines · Kees Cook
Quoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.Something like...
#ifdef
CONFIG_SECURITY_DYNAMIC_LSMQuoted 8 lines
# define lsm_ro_after_init __ro_after_init # define lsm_const const #else # define lsm_ro_after_init # define lsm_const #endif?
Fedora/RHEL won't use
CONFIG_SECURITY_DYNAMIC_LSM=ywhereas LKM based LSMs are targeted for such distributions.
Quoted 6 lines
Quoted 3 lines
I don't worry much about Android, for manufactures who ship their products with TOMOYO enabled can rebuild their kernels. But asking for rebuild of Fedora/RHEL kernels to end users is too painful.
I thought the argument was that Fedora WOULD ship that way, since it needs to have the run-time selinux disabling feature?
True only if Fedora/RHEL doesn't separate kernel packages. They can build separate kernel packages for with-/etc/selinux/config environments and without-/etc/selinux/config environments because modules needed for those environments would differ.
James Morris
maintainerQuoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.
We don't need to solve issues which don't exist and ideally will not exist.
Signature · 2 lines
James Morris <[email protected]>
Casey Schaufler
maintainerQuoted 9 lines · James Morris
Quoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.We don't need to solve issues which don't exist and ideally will not exist.
There is a problem with CONFIG_SECURITY_SELINUX_DISABLE and __ro_after_init that does exist. Whether the possible future issue should or shouldn't exist has no bearing on the existing issue. It's true that we don't need to change CONFIG_SECURITY_SELINUX_DISABLE to CONFIG_SECURITY_DYNAMIC_MODULES to solve the current problem. I suggest that we leave that change to the separate debate on loadable security modules.
James Morris
maintainerQuoted 10 lines · Casey Schaufler
Quoted 9 lines · James Morris
Quoted 4 lines · Casey Schaufler
If we changed
CONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESand put the__ro_after_initunder !CONFIG_SECURITY_DYNAMIC_MODULES we solve both the current and potential future issues.We don't need to solve issues which don't exist and ideally will not exist.
Quoted 7 lines
There is a problem with
CONFIG_SECURITY_SELINUX_DISABLEand__ro_after_initthat does exist. Whether the possible future issue should or shouldn't exist has no bearing on the existing issue. It's true that we don't need to changeCONFIG_SECURITY_SELINUX_DISABLEtoCONFIG_SECURITY_DYNAMIC_MODULESto solve the current problem. I suggest that we leave that change to the separate debate on loadable security modules.
Agreed.
Signature · 2 lines
James Morris <[email protected]>