Skip to contentSkip to conversation

capabilities: remove cap_mmap_file()

RFC PATCH In review Paul Moore 3 participants 10 messages Sep 25, 2024 – Oct 2, 2024

Subsystems (2)
lore
Share & tools
lore

Paul Moore

author maintainer
#0 lore raw

RFC PATCH 1/1 capabilities: remove cap_mmap_file()

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

---
 security/commoncap.c | 7 -------
 1 file changed, 7 deletions(-)
security/commoncap.c +0 -7
index cefad323a0b1..3d103069903b 100644
@@ -1428,12 +1428,6 @@ int cap_mmap_addr(unsigned long addr)
 	return ret;
 }
 
-int cap_mmap_file(struct file *file, unsigned long reqprot,
-		  unsigned long prot, unsigned long flags)
-{
-	return 0;
-}
-
 #ifdef CONFIG_SECURITY
 
 static const struct lsm_id capability_lsmid = {
@@ -1453,7 +1447,6 @@ static struct security_hook_list capability_hooks[] __ro_after_init = {
 	LSM_HOOK_INIT(inode_killpriv, cap_inode_killpriv),
 	LSM_HOOK_INIT(inode_getsecurity, cap_inode_getsecurity),
 	LSM_HOOK_INIT(mmap_addr, cap_mmap_addr),
-	LSM_HOOK_INIT(mmap_file, cap_mmap_file),
 	LSM_HOOK_INIT(task_fix_setuid, cap_task_fix_setuid),
 	LSM_HOOK_INIT(task_prctl, cap_task_prctl),
 	LSM_HOOK_INIT(task_setscheduler, cap_task_setscheduler),
Signature · 1 line
2.46.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 29 lines
---
 security/commoncap.c | 7 -------
 1 file changed, 7 deletions(-)
security/commoncap.c +0 -7
index cefad323a0b1..3d103069903b 100644
@@ -1428,12 +1428,6 @@ int cap_mmap_addr(unsigned long addr)
 	return ret;
 }
 
-int cap_mmap_file(struct file *file, unsigned long reqprot,
-		  unsigned long prot, unsigned long flags)
-{
-	return 0;
-}
-
 #ifdef CONFIG_SECURITY
 
 static const struct lsm_id capability_lsmid = {
@@ -1453,7 +1447,6 @@ static struct security_hook_list capability_hooks[] __ro_after_init = {
 	LSM_HOOK_INIT(inode_killpriv, cap_inode_killpriv),
 	LSM_HOOK_INIT(inode_getsecurity, cap_inode_getsecurity),
 	LSM_HOOK_INIT(mmap_addr, cap_mmap_addr),
-	LSM_HOOK_INIT(mmap_file, cap_mmap_file),
 	LSM_HOOK_INIT(task_fix_setuid, cap_task_fix_setuid),
 	LSM_HOOK_INIT(task_prctl, cap_task_prctl),
 	LSM_HOOK_INIT(task_setscheduler, cap_task_setscheduler),
maintainer Reviewed-by
#2 lore raw
Quoted 7 lines · Casey Schaufler
Quoted 4 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 30 lines
Quoted 30 lines
---
 security/commoncap.c | 7 -------
 1 file changed, 7 deletions(-)
security/commoncap.c +0 -7
index cefad323a0b1..3d103069903b 100644
@@ -1428,12 +1428,6 @@ int cap_mmap_addr(unsigned long addr)
 	return ret;
 }
 
-int cap_mmap_file(struct file *file, unsigned long reqprot,
-		  unsigned long prot, unsigned long flags)
-{
-	return 0;
-}
-
 #ifdef CONFIG_SECURITY
 
 static const struct lsm_id capability_lsmid = {
@@ -1453,7 +1447,6 @@ static struct security_hook_list capability_hooks[] __ro_after_init = {
 	LSM_HOOK_INIT(inode_killpriv, cap_inode_killpriv),
 	LSM_HOOK_INIT(inode_getsecurity, cap_inode_getsecurity),
 	LSM_HOOK_INIT(mmap_addr, cap_mmap_addr),
-	LSM_HOOK_INIT(mmap_file, cap_mmap_file),
 	LSM_HOOK_INIT(task_fix_setuid, cap_task_fix_setuid),
 	LSM_HOOK_INIT(task_prctl, cap_task_prctl),
 	LSM_HOOK_INIT(task_setscheduler, cap_task_setscheduler),
author maintainer
#3 lore raw
Quoted 10 lines · Serge E. Hallyn
Quoted 7 lines · Casey Schaufler
Quoted 4 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Signature · 1 line
paul-moore.com
maintainer
#4 lore raw
Quoted 6 lines · Paul Moore
Quoted 5 lines · Serge E. Hallyn
Quoted 4 lines · Casey Schaufler
Quoted 3 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Oh, jinkeys - I guess should take it through the capabilities tree if only to check that it still works!

thanks,
-serge

author maintainer
#5 lore raw
Quoted 11 lines · Serge E. Hallyn
Quoted 10 lines · Paul Moore
Quoted 9 lines · Serge E. Hallyn
Quoted 7 lines · Casey Schaufler
Quoted 4 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Oh, jinkeys - I guess should take it through the capabilities tree if only to check that it still works!

:)

Sounds good, if you change your mind let me know and I'll pick this up.

Signature · 1 line
paul-moore.com
maintainer
#6 lore raw
Quoted 17 lines · Paul Moore
Quoted 16 lines · Serge E. Hallyn
Quoted 14 lines · Paul Moore
Quoted 10 lines · Serge E. Hallyn
Quoted 7 lines · Casey Schaufler
Quoted 4 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Quoted 6 lines
Quoted 2 lines

Oh, jinkeys - I guess should take it through the capabilities tree if only to check that it still works!

:)

Sounds good, if you change your mind let me know and I'll pick this up.

Just got access back to my kernel.org account. Too late for 6.12 cycle, so I'll keep it ready for 6.13 window. I suppose I should see about hooking back into the -next kernel for testing.

author maintainer
#7 lore raw
Quoted 21 lines · Serge E. Hallyn
Quoted 20 lines · Paul Moore
Quoted 18 lines · Serge E. Hallyn
Quoted 6 lines · Paul Moore
Quoted 5 lines · Serge E. Hallyn
Quoted 4 lines · Casey Schaufler
Quoted 3 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Oh, jinkeys - I guess should take it through the capabilities tree if only to check that it still works!

Quoted 7 lines
Quoted 3 lines

:)

Sounds good, if you change your mind let me know and I'll pick this up.

Just got access back to my kernel.org account. Too late for 6.12 cycle, so I'll keep it ready for 6.13 window. I suppose I should see about hooking back into the -next kernel for testing.

Sorry for the delay, network access was spotty over the past few days, and what little I did have was just my phone.

Anyway, yes, this was intended for v6.13 anyway so no harm there. Glad you're setup again on kernel.org.

Hooking up to linux-next is pretty easy, basically just send some mail, but if I can offer a suggestion you might want to make your linux-next branch a automatically generated "composite" branch so you are better able to get both linux-stable and linux-next patches tested via the normal linux-next mechanisms. I'm sure you've seen this already, but here is the approach I take with the LSM tree:

https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git/tree/README.md#n94

Signature · 1 line
paul-moore.com
maintainer
#8 lore raw
Quoted 36 lines · Paul Moore
Quoted 21 lines · Serge E. Hallyn
Quoted 20 lines · Paul Moore
Quoted 18 lines · Serge E. Hallyn
Quoted 6 lines · Paul Moore
Quoted 5 lines · Serge E. Hallyn
Quoted 4 lines · Casey Schaufler
Quoted 3 lines · Paul Moore

The cap_mmap_file() LSM callback returns the default value for the security_mmap_file() LSM hook and can be safely removed.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks Serge. Any interest in pulling this via the capabilities tree or would you prefer I take this via the LSM tree?

Oh, jinkeys - I guess should take it through the capabilities tree if only to check that it still works!

Quoted 7 lines
Quoted 3 lines

:)

Sounds good, if you change your mind let me know and I'll pick this up.

Just got access back to my kernel.org account. Too late for 6.12 cycle, so I'll keep it ready for 6.13 window. I suppose I should see about hooking back into the -next kernel for testing.

Sorry for the delay, network access was spotty over the past few days, and what little I did have was just my phone.

Anyway, yes, this was intended for v6.13 anyway so no harm there. Glad you're setup again on kernel.org.

Quoted 8 lines

Hooking up to linux-next is pretty easy, basically just send some mail, but if I can offer a suggestion you might want to make your linux-next branch a automatically generated "composite" branch so you are better able to get both linux-stable and linux-next patches tested via the normal linux-next mechanisms. I'm sure you've seen this already, but here is the approach I take with the LSM tree:

https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git/tree/README.md#n94

Thanks! I thought in the past there had been "how to best work with linux-next" guides out there, but I spent some time looking through linux.git/Documentation, linux-next/, lore.kernel.org, and kernelnewbies and google and came up with nothing.

-serge

author maintainer
#9 lore raw
Quoted 8 lines · Serge E. Hallyn
Quoted 7 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 5 lines · Paul Moore
Quoted 4 lines · Serge E. Hallyn
Quoted 3 lines · Paul Moore
Quoted 2 lines · Serge E. Hallyn
Quoted 1 line · Casey Schaufler

On 9/25/2024 12:20 PM, Paul Moore wrote:

...

Quoted 17 lines
Quoted 17 lines
Quoted 3 lines

Just got access back to my kernel.org account. Too late for 6.12 cycle, so I'll keep it ready for 6.13 window. I suppose I should see about hooking back into the -next kernel for testing.

Sorry for the delay, network access was spotty over the past few days, and what little I did have was just my phone.

Anyway, yes, this was intended for v6.13 anyway so no harm there. Glad you're setup again on kernel.org.

Hooking up to linux-next is pretty easy, basically just send some mail, but if I can offer a suggestion you might want to make your linux-next branch a automatically generated "composite" branch so you are better able to get both linux-stable and linux-next patches tested via the normal linux-next mechanisms. I'm sure you've seen this already, but here is the approach I take with the LSM tree:

Quoted 6 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git/tree/README.md#n94

Thanks! I thought in the past there had been "how to best work with linux-next" guides out there, but I spent some time looking through linux.git/Documentation, linux-next/, lore.kernel.org, and kernelnewbies and google and came up with nothing.

Full disclosure, the guidance above is based simply on WORKSFORME based on experience and discussions with the linux-next folks, please don't take it as any official guide, I post it only so that people who are contributing know what to expect.

Signature · 1 line
paul-moore.com