Skip to content

Commit cbfee34

Browse files
AdrianBunkLinus Torvalds
authored andcommitted
security/ cleanups
This patch contains the following cleanups that are now possible: - remove the unused security_operations->inode_xattr_getsuffix - remove the no longer used security_operations->unregister_security - remove some no longer required exit code - remove a bunch of no longer used exports Signed-off-by: Adrian Bunk <bunk@kernel.org> Acked-by: James Morris <jmorris@namei.org> Cc: Chris Wright <chrisw@sous-sol.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b537677 commit cbfee34

11 files changed

Lines changed: 1 addition & 143 deletions

File tree

‎drivers/usb/core/usb.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,6 @@ EXPORT_SYMBOL(usb_altnum_to_altsetting);
982982

983983
EXPORT_SYMBOL(__usb_get_extra_descriptor);
984984

985-
EXPORT_SYMBOL(usb_find_device);
986985
EXPORT_SYMBOL(usb_get_current_frame_number);
987986

988987
EXPORT_SYMBOL(usb_buffer_alloc);

‎fs/exec.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ int core_uses_pid;
6464
char core_pattern[CORENAME_MAX_SIZE] = "core";
6565
int suid_dumpable = 0;
6666

67-
EXPORT_SYMBOL(suid_dumpable);
6867
/* The maximal length of core_pattern is also specified in sysctl.c */
6968

7069
static LIST_HEAD(formats);
@@ -1662,7 +1661,6 @@ void set_dumpable(struct mm_struct *mm, int value)
16621661
break;
16631662
}
16641663
}
1665-
EXPORT_SYMBOL_GPL(set_dumpable);
16661664

16671665
int get_dumpable(struct mm_struct *mm)
16681666
{

‎include/linux/security.h‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,6 @@ struct request_sock;
11581158
* allow module stacking.
11591159
* @name contains the name of the security module being stacked.
11601160
* @ops contains a pointer to the struct security_operations of the module to stack.
1161-
* @unregister_security:
1162-
* remove a stacked module.
1163-
* @name contains the name of the security module being unstacked.
1164-
* @ops contains a pointer to the struct security_operations of the module to unstack.
11651161
*
11661162
* @secid_to_secctx:
11671163
* Convert secid to security context.
@@ -1259,7 +1255,6 @@ struct security_operations {
12591255
int (*inode_removexattr) (struct dentry *dentry, char *name);
12601256
int (*inode_need_killpriv) (struct dentry *dentry);
12611257
int (*inode_killpriv) (struct dentry *dentry);
1262-
const char *(*inode_xattr_getsuffix) (void);
12631258
int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
12641259
int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
12651260
int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
@@ -1350,8 +1345,6 @@ struct security_operations {
13501345
/* allow module stacking */
13511346
int (*register_security) (const char *name,
13521347
struct security_operations *ops);
1353-
int (*unregister_security) (const char *name,
1354-
struct security_operations *ops);
13551348

13561349
void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
13571350

@@ -1432,9 +1425,7 @@ struct security_operations {
14321425
/* prototypes */
14331426
extern int security_init (void);
14341427
extern int register_security (struct security_operations *ops);
1435-
extern int unregister_security (struct security_operations *ops);
14361428
extern int mod_reg_security (const char *name, struct security_operations *ops);
1437-
extern int mod_unreg_security (const char *name, struct security_operations *ops);
14381429
extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
14391430
struct dentry *parent, void *data,
14401431
const struct file_operations *fops);
@@ -1518,7 +1509,6 @@ int security_inode_listxattr(struct dentry *dentry);
15181509
int security_inode_removexattr(struct dentry *dentry, char *name);
15191510
int security_inode_need_killpriv(struct dentry *dentry);
15201511
int security_inode_killpriv(struct dentry *dentry);
1521-
const char *security_inode_xattr_getsuffix(void);
15221512
int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
15231513
int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
15241514
int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
@@ -1923,11 +1913,6 @@ static inline int security_inode_killpriv(struct dentry *dentry)
19231913
return cap_inode_killpriv(dentry);
19241914
}
19251915

1926-
static inline const char *security_inode_xattr_getsuffix (void)
1927-
{
1928-
return NULL ;
1929-
}
1930-
19311916
static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
19321917
{
19331918
return -EOPNOTSUPP;

‎kernel/capability.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
1818
kernel_cap_t cap_bset = CAP_INIT_EFF_SET;
1919

20-
EXPORT_SYMBOL(securebits);
21-
EXPORT_SYMBOL(cap_bset);
22-
2320
/*
2421
* This lock protects task->cap_* for all tasks including current.
2522
* Locking rule: acquire this prior to tasklist_lock.
@@ -244,7 +241,6 @@ int __capable(struct task_struct *t, int cap)
244241
}
245242
return 0;
246243
}
247-
EXPORT_SYMBOL(__capable);
248244

249245
int capable(int cap)
250246
{

‎mm/mmap.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
181181
return -ENOMEM;
182182
}
183183

184-
EXPORT_SYMBOL(__vm_enough_memory);
185-
186184
/*
187185
* Requires inode->i_mapping->i_mmap_lock
188186
*/

‎mm/nommu.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
4444
int heap_stack_gap = 0;
4545

4646
EXPORT_SYMBOL(mem_map);
47-
EXPORT_SYMBOL(__vm_enough_memory);
4847
EXPORT_SYMBOL(num_physpages);
4948

5049
/* list of shareable VMAs */

‎security/commoncap.c‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
3030
return 0;
3131
}
3232

33-
EXPORT_SYMBOL(cap_netlink_send);
34-
3533
int cap_netlink_recv(struct sk_buff *skb, int cap)
3634
{
3735
if (!cap_raised(NETLINK_CB(skb).eff_cap, cap))
@@ -532,22 +530,3 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
532530
return __vm_enough_memory(mm, pages, cap_sys_admin);
533531
}
534532

535-
EXPORT_SYMBOL(cap_capable);
536-
EXPORT_SYMBOL(cap_settime);
537-
EXPORT_SYMBOL(cap_ptrace);
538-
EXPORT_SYMBOL(cap_capget);
539-
EXPORT_SYMBOL(cap_capset_check);
540-
EXPORT_SYMBOL(cap_capset_set);
541-
EXPORT_SYMBOL(cap_bprm_set_security);
542-
EXPORT_SYMBOL(cap_bprm_apply_creds);
543-
EXPORT_SYMBOL(cap_bprm_secureexec);
544-
EXPORT_SYMBOL(cap_inode_setxattr);
545-
EXPORT_SYMBOL(cap_inode_removexattr);
546-
EXPORT_SYMBOL(cap_task_post_setuid);
547-
EXPORT_SYMBOL(cap_task_kill);
548-
EXPORT_SYMBOL(cap_task_setscheduler);
549-
EXPORT_SYMBOL(cap_task_setioprio);
550-
EXPORT_SYMBOL(cap_task_setnice);
551-
EXPORT_SYMBOL(cap_task_reparent_to_init);
552-
EXPORT_SYMBOL(cap_syslog);
553-
EXPORT_SYMBOL(cap_vm_enough_memory);

‎security/dummy.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,6 @@ static int dummy_inode_listsecurity(struct inode *inode, char *buffer, size_t bu
401401
return 0;
402402
}
403403

404-
static const char *dummy_inode_xattr_getsuffix(void)
405-
{
406-
return NULL;
407-
}
408-
409404
static int dummy_file_permission (struct file *file, int mask)
410405
{
411406
return 0;
@@ -915,11 +910,6 @@ static int dummy_register_security (const char *name, struct security_operations
915910
return -EINVAL;
916911
}
917912

918-
static int dummy_unregister_security (const char *name, struct security_operations *ops)
919-
{
920-
return -EINVAL;
921-
}
922-
923913
static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
924914
{
925915
return;
@@ -1034,7 +1024,6 @@ void security_fixup_ops (struct security_operations *ops)
10341024
set_to_dummy_if_null(ops, inode_removexattr);
10351025
set_to_dummy_if_null(ops, inode_need_killpriv);
10361026
set_to_dummy_if_null(ops, inode_killpriv);
1037-
set_to_dummy_if_null(ops, inode_xattr_getsuffix);
10381027
set_to_dummy_if_null(ops, inode_getsecurity);
10391028
set_to_dummy_if_null(ops, inode_setsecurity);
10401029
set_to_dummy_if_null(ops, inode_listsecurity);
@@ -1095,7 +1084,6 @@ void security_fixup_ops (struct security_operations *ops)
10951084
set_to_dummy_if_null(ops, netlink_send);
10961085
set_to_dummy_if_null(ops, netlink_recv);
10971086
set_to_dummy_if_null(ops, register_security);
1098-
set_to_dummy_if_null(ops, unregister_security);
10991087
set_to_dummy_if_null(ops, d_instantiate);
11001088
set_to_dummy_if_null(ops, getprocattr);
11011089
set_to_dummy_if_null(ops, setprocattr);

‎security/inode.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,6 @@ static int __init securityfs_init(void)
332332
return retval;
333333
}
334334

335-
static void __exit securityfs_exit(void)
336-
{
337-
simple_release_fs(&mount, &mount_count);
338-
unregister_filesystem(&fs_type);
339-
subsystem_unregister(&security_subsys);
340-
}
341-
342335
core_initcall(securityfs_init);
343-
module_exit(securityfs_exit);
344336
MODULE_LICENSE("GPL");
345337

‎security/security.c‎

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ int __init security_init(void)
7171
*
7272
* This function is to allow a security module to register itself with the
7373
* kernel security subsystem. Some rudimentary checking is done on the @ops
74-
* value passed to this function. A call to unregister_security() should be
75-
* done to remove this security_options structure from the kernel.
74+
* value passed to this function.
7675
*
7776
* If there is already a security module registered with the kernel,
7877
* an error will be returned. Otherwise 0 is returned on success.
@@ -93,31 +92,6 @@ int register_security(struct security_operations *ops)
9392
return 0;
9493
}
9594

96-
/**
97-
* unregister_security - unregisters a security framework with the kernel
98-
* @ops: a pointer to the struct security_options that is to be registered
99-
*
100-
* This function removes a struct security_operations variable that had
101-
* previously been registered with a successful call to register_security().
102-
*
103-
* If @ops does not match the valued previously passed to register_security()
104-
* an error is returned. Otherwise the default security options is set to the
105-
* the dummy_security_ops structure, and 0 is returned.
106-
*/
107-
int unregister_security(struct security_operations *ops)
108-
{
109-
if (ops != security_ops) {
110-
printk(KERN_INFO "%s: trying to unregister "
111-
"a security_opts structure that is not "
112-
"registered, failing.\n", __FUNCTION__);
113-
return -EINVAL;
114-
}
115-
116-
security_ops = &dummy_security_ops;
117-
118-
return 0;
119-
}
120-
12195
/**
12296
* mod_reg_security - allows security modules to be "stacked"
12397
* @name: a pointer to a string with the name of the security_options to be registered
@@ -147,30 +121,6 @@ int mod_reg_security(const char *name, struct security_operations *ops)
147121
return security_ops->register_security(name, ops);
148122
}
149123

150-
/**
151-
* mod_unreg_security - allows a security module registered with mod_reg_security() to be unloaded
152-
* @name: a pointer to a string with the name of the security_options to be removed
153-
* @ops: a pointer to the struct security_options that is to be removed
154-
*
155-
* This function allows security modules that have been successfully registered
156-
* with a call to mod_reg_security() to be unloaded from the system.
157-
* This calls the currently loaded security module's unregister_security() call
158-
* with the @name and @ops variables.
159-
*
160-
* The return value depends on the currently loaded security module, with 0 as
161-
* success.
162-
*/
163-
int mod_unreg_security(const char *name, struct security_operations *ops)
164-
{
165-
if (ops == security_ops) {
166-
printk(KERN_INFO "%s invalid attempt to unregister "
167-
" primary security ops.\n", __FUNCTION__);
168-
return -EINVAL;
169-
}
170-
171-
return security_ops->unregister_security(name, ops);
172-
}
173-
174124
/* Security operations */
175125

176126
int security_ptrace(struct task_struct *parent, struct task_struct *child)
@@ -528,11 +478,6 @@ int security_inode_killpriv(struct dentry *dentry)
528478
return security_ops->inode_killpriv(dentry);
529479
}
530480

531-
const char *security_inode_xattr_getsuffix(void)
532-
{
533-
return security_ops->inode_xattr_getsuffix();
534-
}
535-
536481
int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
537482
{
538483
if (unlikely(IS_PRIVATE(inode)))
@@ -858,7 +803,6 @@ int security_netlink_send(struct sock *sk, struct sk_buff *skb)
858803
{
859804
return security_ops->netlink_send(sk, skb);
860805
}
861-
EXPORT_SYMBOL(security_netlink_send);
862806

863807
int security_netlink_recv(struct sk_buff *skb, int cap)
864808
{

0 commit comments

Comments
 (0)