Skip to contentSkip to conversation

capabilities: define get_vfs_caps_from_disk when file caps are not enabled

PATCH In review Eric Paris 2 participants 2 messages Nov 13, 2008 – Nov 14, 2008

Subsystems (2)
lore
Share & tools
lore

Eric Paris

author
#0 lore raw

PATCH 1/1 capabilities: define get_vfs_caps_from_disk when file caps are not enabled

When CONFIG_SECURITY_FILE_CAPABILITIES is not set the audit system may try to call into the capabilities function vfs_cap_from_file. This patch defines that function so kernels can build and work.

---

 security/commoncap.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
security/commoncap.c +6 -0
index 0b88160..574a70b 100644
@@ -337,6 +337,12 @@ int cap_inode_killpriv(struct dentry *dentry)
 	return 0;
 }
 
+int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps)
+{
+	memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data));
+	return -ENODATA;
+}
+
 static inline int get_file_caps(struct linux_binprm *bprm)
 {
 	bprm_clear_caps(bprm);
maintainer
#1 lore raw
Quoted 16 lines · Eric Paris

When CONFIG_SECURITY_FILE_CAPABILITIES is not set the audit system may try to call into the capabilities function vfs_cap_from_file. This patch defines that function so kernels can build and work.

---

 security/commoncap.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
security/commoncap.c +0 -0
index 0b88160..574a70b 100644

security/commoncap.c int cap_inode_killpriv(struct dentry *dentry) · line 345

Quoted 9 lines
security/commoncap.c +6 -0
@@ -337,6 +337,12 @@ int cap_inode_killpriv(struct dentry *dentry)
 	return 0;
 }
 
+int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps)
+{
+	memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data));
+	return -ENODATA;
+}
+

As the function is returning an error, the caller should not depend on the state of any modifiable arguments, so I suggest removing the memset.

Quoted 5 lines
security/commoncap.c +0 -0
 static inline int get_file_caps(struct linux_binprm *bprm)
 {
 	bprm_clear_caps(bprm);
Signature · 2 lines
James Morris
<[email protected]>