Skip to content

Commit 4916ca4

Browse files
luciangeparis
authored andcommitted
security: remove unused security_sysctl hook
The only user for this hook was selinux. sysctl routes every call through /proc/sys/. Selinux and other security modules use the file system checks for sysctl too, so no need for this hook any more. Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com> Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 8e6c969 commit 4916ca4

4 files changed

Lines changed: 0 additions & 29 deletions

File tree

‎include/linux/security.h‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,12 +1259,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
12591259
* @cap contains the capability <include/linux/capability.h>.
12601260
* @audit: Whether to write an audit message or not
12611261
* Return 0 if the capability is granted for @tsk.
1262-
* @sysctl:
1263-
* Check permission before accessing the @table sysctl variable in the
1264-
* manner specified by @op.
1265-
* @table contains the ctl_table structure for the sysctl variable.
1266-
* @op contains the operation (001 = search, 002 = write, 004 = read).
1267-
* Return 0 if permission is granted.
12681262
* @syslog:
12691263
* Check permission before accessing the kernel message ring or changing
12701264
* logging to the console.
@@ -1385,7 +1379,6 @@ struct security_operations {
13851379
const kernel_cap_t *permitted);
13861380
int (*capable) (struct task_struct *tsk, const struct cred *cred,
13871381
int cap, int audit);
1388-
int (*sysctl) (struct ctl_table *table, int op);
13891382
int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
13901383
int (*quota_on) (struct dentry *dentry);
13911384
int (*syslog) (int type);
@@ -1668,7 +1661,6 @@ int security_capset(struct cred *new, const struct cred *old,
16681661
int security_capable(int cap);
16691662
int security_real_capable(struct task_struct *tsk, int cap);
16701663
int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1671-
int security_sysctl(struct ctl_table *table, int op);
16721664
int security_quotactl(int cmds, int type, int id, struct super_block *sb);
16731665
int security_quota_on(struct dentry *dentry);
16741666
int security_syslog(int type);
@@ -1887,11 +1879,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
18871879
return ret;
18881880
}
18891881

1890-
static inline int security_sysctl(struct ctl_table *table, int op)
1891-
{
1892-
return 0;
1893-
}
1894-
18951882
static inline int security_quotactl(int cmds, int type, int id,
18961883
struct super_block *sb)
18971884
{

‎kernel/sysctl.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,13 +1691,8 @@ static int test_perm(int mode, int op)
16911691

16921692
int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
16931693
{
1694-
int error;
16951694
int mode;
16961695

1697-
error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1698-
if (error)
1699-
return error;
1700-
17011696
if (root->permissions)
17021697
mode = root->permissions(root, current->nsproxy, table);
17031698
else

‎security/capability.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
#include <linux/security.h>
1414

15-
static int cap_sysctl(ctl_table *table, int op)
16-
{
17-
return 0;
18-
}
19-
2015
static int cap_syslog(int type)
2116
{
2217
return 0;
@@ -881,7 +876,6 @@ void __init security_fixup_ops(struct security_operations *ops)
881876
set_to_cap_if_null(ops, capable);
882877
set_to_cap_if_null(ops, quotactl);
883878
set_to_cap_if_null(ops, quota_on);
884-
set_to_cap_if_null(ops, sysctl);
885879
set_to_cap_if_null(ops, syslog);
886880
set_to_cap_if_null(ops, settime);
887881
set_to_cap_if_null(ops, vm_enough_memory);

‎security/security.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
182182
return ret;
183183
}
184184

185-
int security_sysctl(struct ctl_table *table, int op)
186-
{
187-
return security_ops->sysctl(table, op);
188-
}
189-
190185
int security_quotactl(int cmds, int type, int id, struct super_block *sb)
191186
{
192187
return security_ops->quotactl(cmds, type, id, sb);

0 commit comments

Comments
 (0)