diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2018-11-09 19:12:56 -0500 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2019-01-08 16:18:44 -0500 |
commit | b17103a8b8ae9c9ecc5e1e6501b1478ee2dc6fe4 (patch) | |
tree | e080e34cf17f616e24f44bc1c1f25e285bf9857a | |
parent | 6d9c939dbe4d0bcea09cd4b410f624cde1acb678 (diff) |
Smack: Abstract use of cred security blob
Don't use the cred->security pointer directly.
Provide a helper function that provides the security blob pointer.
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
[kees: adjusted for ordered init series]
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | security/smack/smack.h | 17 | ||||
-rw-r--r-- | security/smack/smack_access.c | 4 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 57 | ||||
-rw-r--r-- | security/smack/smackfs.c | 18 |
4 files changed, 53 insertions, 43 deletions
diff --git a/security/smack/smack.h b/security/smack/smack.h index f7db791fb566..01a922856eba 100644 --- a/security/smack/smack.h +++ b/security/smack/smack.h | |||
@@ -356,6 +356,11 @@ extern struct list_head smack_onlycap_list; | |||
356 | #define SMACK_HASH_SLOTS 16 | 356 | #define SMACK_HASH_SLOTS 16 |
357 | extern struct hlist_head smack_known_hash[SMACK_HASH_SLOTS]; | 357 | extern struct hlist_head smack_known_hash[SMACK_HASH_SLOTS]; |
358 | 358 | ||
359 | static inline struct task_smack *smack_cred(const struct cred *cred) | ||
360 | { | ||
361 | return cred->security; | ||
362 | } | ||
363 | |||
359 | /* | 364 | /* |
360 | * Is the directory transmuting? | 365 | * Is the directory transmuting? |
361 | */ | 366 | */ |
@@ -382,13 +387,19 @@ static inline struct smack_known *smk_of_task(const struct task_smack *tsp) | |||
382 | return tsp->smk_task; | 387 | return tsp->smk_task; |
383 | } | 388 | } |
384 | 389 | ||
385 | static inline struct smack_known *smk_of_task_struct(const struct task_struct *t) | 390 | static inline struct smack_known *smk_of_task_struct( |
391 | const struct task_struct *t) | ||
386 | { | 392 | { |
387 | struct smack_known *skp; | 393 | struct smack_known *skp; |
394 | const struct cred *cred; | ||
388 | 395 | ||
389 | rcu_read_lock(); | 396 | rcu_read_lock(); |
390 | skp = smk_of_task(__task_cred(t)->security); | 397 | |
398 | cred = __task_cred(t); | ||
399 | skp = smk_of_task(smack_cred(cred)); | ||
400 | |||
391 | rcu_read_unlock(); | 401 | rcu_read_unlock(); |
402 | |||
392 | return skp; | 403 | return skp; |
393 | } | 404 | } |
394 | 405 | ||
@@ -405,7 +416,7 @@ static inline struct smack_known *smk_of_forked(const struct task_smack *tsp) | |||
405 | */ | 416 | */ |
406 | static inline struct smack_known *smk_of_current(void) | 417 | static inline struct smack_known *smk_of_current(void) |
407 | { | 418 | { |
408 | return smk_of_task(current_security()); | 419 | return smk_of_task(smack_cred(current_cred())); |
409 | } | 420 | } |
410 | 421 | ||
411 | /* | 422 | /* |
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index 9a4c0ad46518..489d49a20b47 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c | |||
@@ -275,7 +275,7 @@ out_audit: | |||
275 | int smk_curacc(struct smack_known *obj_known, | 275 | int smk_curacc(struct smack_known *obj_known, |
276 | u32 mode, struct smk_audit_info *a) | 276 | u32 mode, struct smk_audit_info *a) |
277 | { | 277 | { |
278 | struct task_smack *tsp = current_security(); | 278 | struct task_smack *tsp = smack_cred(current_cred()); |
279 | 279 | ||
280 | return smk_tskacc(tsp, obj_known, mode, a); | 280 | return smk_tskacc(tsp, obj_known, mode, a); |
281 | } | 281 | } |
@@ -635,7 +635,7 @@ DEFINE_MUTEX(smack_onlycap_lock); | |||
635 | */ | 635 | */ |
636 | bool smack_privileged_cred(int cap, const struct cred *cred) | 636 | bool smack_privileged_cred(int cap, const struct cred *cred) |
637 | { | 637 | { |
638 | struct task_smack *tsp = cred->security; | 638 | struct task_smack *tsp = smack_cred(cred); |
639 | struct smack_known *skp = tsp->smk_task; | 639 | struct smack_known *skp = tsp->smk_task; |
640 | struct smack_known_list_elem *sklep; | 640 | struct smack_known_list_elem *sklep; |
641 | int rc; | 641 | int rc; |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 780733341d02..9a050ca17296 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -139,7 +139,7 @@ static int smk_bu_note(char *note, struct smack_known *sskp, | |||
139 | static int smk_bu_current(char *note, struct smack_known *oskp, | 139 | static int smk_bu_current(char *note, struct smack_known *oskp, |
140 | int mode, int rc) | 140 | int mode, int rc) |
141 | { | 141 | { |
142 | struct task_smack *tsp = current_security(); | 142 | struct task_smack *tsp = smack_cred(current_cred()); |
143 | char acc[SMK_NUM_ACCESS_TYPE + 1]; | 143 | char acc[SMK_NUM_ACCESS_TYPE + 1]; |
144 | 144 | ||
145 | if (rc <= 0) | 145 | if (rc <= 0) |
@@ -160,7 +160,7 @@ static int smk_bu_current(char *note, struct smack_known *oskp, | |||
160 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP | 160 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP |
161 | static int smk_bu_task(struct task_struct *otp, int mode, int rc) | 161 | static int smk_bu_task(struct task_struct *otp, int mode, int rc) |
162 | { | 162 | { |
163 | struct task_smack *tsp = current_security(); | 163 | struct task_smack *tsp = smack_cred(current_cred()); |
164 | struct smack_known *smk_task = smk_of_task_struct(otp); | 164 | struct smack_known *smk_task = smk_of_task_struct(otp); |
165 | char acc[SMK_NUM_ACCESS_TYPE + 1]; | 165 | char acc[SMK_NUM_ACCESS_TYPE + 1]; |
166 | 166 | ||
@@ -182,7 +182,7 @@ static int smk_bu_task(struct task_struct *otp, int mode, int rc) | |||
182 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP | 182 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP |
183 | static int smk_bu_inode(struct inode *inode, int mode, int rc) | 183 | static int smk_bu_inode(struct inode *inode, int mode, int rc) |
184 | { | 184 | { |
185 | struct task_smack *tsp = current_security(); | 185 | struct task_smack *tsp = smack_cred(current_cred()); |
186 | struct inode_smack *isp = inode->i_security; | 186 | struct inode_smack *isp = inode->i_security; |
187 | char acc[SMK_NUM_ACCESS_TYPE + 1]; | 187 | char acc[SMK_NUM_ACCESS_TYPE + 1]; |
188 | 188 | ||
@@ -212,7 +212,7 @@ static int smk_bu_inode(struct inode *inode, int mode, int rc) | |||
212 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP | 212 | #ifdef CONFIG_SECURITY_SMACK_BRINGUP |
213 | static int smk_bu_file(struct file *file, int mode, int rc) | 213 | static int smk_bu_file(struct file *file, int mode, int rc) |
214 | { | 214 | { |
215 | struct task_smack *tsp = current_security(); | 215 | struct task_smack *tsp = smack_cred(current_cred()); |
216 | struct smack_known *sskp = tsp->smk_task; | 216 | struct smack_known *sskp = tsp->smk_task; |
217 | struct inode *inode = file_inode(file); | 217 | struct inode *inode = file_inode(file); |
218 | struct inode_smack *isp = inode->i_security; | 218 | struct inode_smack *isp = inode->i_security; |
@@ -242,7 +242,7 @@ static int smk_bu_file(struct file *file, int mode, int rc) | |||
242 | static int smk_bu_credfile(const struct cred *cred, struct file *file, | 242 | static int smk_bu_credfile(const struct cred *cred, struct file *file, |
243 | int mode, int rc) | 243 | int mode, int rc) |
244 | { | 244 | { |
245 | struct task_smack *tsp = cred->security; | 245 | struct task_smack *tsp = smack_cred(cred); |
246 | struct smack_known *sskp = tsp->smk_task; | 246 | struct smack_known *sskp = tsp->smk_task; |
247 | struct inode *inode = file_inode(file); | 247 | struct inode *inode = file_inode(file); |
248 | struct inode_smack *isp = inode->i_security; | 248 | struct inode_smack *isp = inode->i_security; |
@@ -448,7 +448,7 @@ static int smk_ptrace_rule_check(struct task_struct *tracer, | |||
448 | 448 | ||
449 | rcu_read_lock(); | 449 | rcu_read_lock(); |
450 | tracercred = __task_cred(tracer); | 450 | tracercred = __task_cred(tracer); |
451 | tsp = tracercred->security; | 451 | tsp = smack_cred(tracercred); |
452 | tracer_known = smk_of_task(tsp); | 452 | tracer_known = smk_of_task(tsp); |
453 | 453 | ||
454 | if ((mode & PTRACE_MODE_ATTACH) && | 454 | if ((mode & PTRACE_MODE_ATTACH) && |
@@ -515,7 +515,7 @@ static int smack_ptrace_traceme(struct task_struct *ptp) | |||
515 | int rc; | 515 | int rc; |
516 | struct smack_known *skp; | 516 | struct smack_known *skp; |
517 | 517 | ||
518 | skp = smk_of_task(current_security()); | 518 | skp = smk_of_task(smack_cred(current_cred())); |
519 | 519 | ||
520 | rc = smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__); | 520 | rc = smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__); |
521 | return rc; | 521 | return rc; |
@@ -831,7 +831,7 @@ static int smack_sb_statfs(struct dentry *dentry) | |||
831 | static int smack_bprm_set_creds(struct linux_binprm *bprm) | 831 | static int smack_bprm_set_creds(struct linux_binprm *bprm) |
832 | { | 832 | { |
833 | struct inode *inode = file_inode(bprm->file); | 833 | struct inode *inode = file_inode(bprm->file); |
834 | struct task_smack *bsp = bprm->cred->security; | 834 | struct task_smack *bsp = smack_cred(bprm->cred); |
835 | struct inode_smack *isp; | 835 | struct inode_smack *isp; |
836 | struct superblock_smack *sbsp; | 836 | struct superblock_smack *sbsp; |
837 | int rc; | 837 | int rc; |
@@ -1662,7 +1662,7 @@ static int smack_mmap_file(struct file *file, | |||
1662 | return -EACCES; | 1662 | return -EACCES; |
1663 | mkp = isp->smk_mmap; | 1663 | mkp = isp->smk_mmap; |
1664 | 1664 | ||
1665 | tsp = current_security(); | 1665 | tsp = smack_cred(current_cred()); |
1666 | skp = smk_of_current(); | 1666 | skp = smk_of_current(); |
1667 | rc = 0; | 1667 | rc = 0; |
1668 | 1668 | ||
@@ -1758,7 +1758,7 @@ static int smack_file_send_sigiotask(struct task_struct *tsk, | |||
1758 | struct fown_struct *fown, int signum) | 1758 | struct fown_struct *fown, int signum) |
1759 | { | 1759 | { |
1760 | struct smack_known *skp; | 1760 | struct smack_known *skp; |
1761 | struct smack_known *tkp = smk_of_task(tsk->cred->security); | 1761 | struct smack_known *tkp = smk_of_task(smack_cred(tsk->cred)); |
1762 | const struct cred *tcred; | 1762 | const struct cred *tcred; |
1763 | struct file *file; | 1763 | struct file *file; |
1764 | int rc; | 1764 | int rc; |
@@ -1811,7 +1811,7 @@ static int smack_file_receive(struct file *file) | |||
1811 | if (inode->i_sb->s_magic == SOCKFS_MAGIC) { | 1811 | if (inode->i_sb->s_magic == SOCKFS_MAGIC) { |
1812 | sock = SOCKET_I(inode); | 1812 | sock = SOCKET_I(inode); |
1813 | ssp = sock->sk->sk_security; | 1813 | ssp = sock->sk->sk_security; |
1814 | tsp = current_security(); | 1814 | tsp = smack_cred(current_cred()); |
1815 | /* | 1815 | /* |
1816 | * If the receiving process can't write to the | 1816 | * If the receiving process can't write to the |
1817 | * passed socket or if the passed socket can't | 1817 | * passed socket or if the passed socket can't |
@@ -1853,7 +1853,7 @@ static int smack_file_receive(struct file *file) | |||
1853 | */ | 1853 | */ |
1854 | static int smack_file_open(struct file *file) | 1854 | static int smack_file_open(struct file *file) |
1855 | { | 1855 | { |
1856 | struct task_smack *tsp = file->f_cred->security; | 1856 | struct task_smack *tsp = smack_cred(file->f_cred); |
1857 | struct inode *inode = file_inode(file); | 1857 | struct inode *inode = file_inode(file); |
1858 | struct smk_audit_info ad; | 1858 | struct smk_audit_info ad; |
1859 | int rc; | 1859 | int rc; |
@@ -1900,7 +1900,7 @@ static int smack_cred_alloc_blank(struct cred *cred, gfp_t gfp) | |||
1900 | */ | 1900 | */ |
1901 | static void smack_cred_free(struct cred *cred) | 1901 | static void smack_cred_free(struct cred *cred) |
1902 | { | 1902 | { |
1903 | struct task_smack *tsp = cred->security; | 1903 | struct task_smack *tsp = smack_cred(cred); |
1904 | struct smack_rule *rp; | 1904 | struct smack_rule *rp; |
1905 | struct list_head *l; | 1905 | struct list_head *l; |
1906 | struct list_head *n; | 1906 | struct list_head *n; |
@@ -1930,7 +1930,7 @@ static void smack_cred_free(struct cred *cred) | |||
1930 | static int smack_cred_prepare(struct cred *new, const struct cred *old, | 1930 | static int smack_cred_prepare(struct cred *new, const struct cred *old, |
1931 | gfp_t gfp) | 1931 | gfp_t gfp) |
1932 | { | 1932 | { |
1933 | struct task_smack *old_tsp = old->security; | 1933 | struct task_smack *old_tsp = smack_cred(old); |
1934 | struct task_smack *new_tsp; | 1934 | struct task_smack *new_tsp; |
1935 | int rc; | 1935 | int rc; |
1936 | 1936 | ||
@@ -1961,15 +1961,14 @@ static int smack_cred_prepare(struct cred *new, const struct cred *old, | |||
1961 | */ | 1961 | */ |
1962 | static void smack_cred_transfer(struct cred *new, const struct cred *old) | 1962 | static void smack_cred_transfer(struct cred *new, const struct cred *old) |
1963 | { | 1963 | { |
1964 | struct task_smack *old_tsp = old->security; | 1964 | struct task_smack *old_tsp = smack_cred(old); |
1965 | struct task_smack *new_tsp = new->security; | 1965 | struct task_smack *new_tsp = smack_cred(new); |
1966 | 1966 | ||
1967 | new_tsp->smk_task = old_tsp->smk_task; | 1967 | new_tsp->smk_task = old_tsp->smk_task; |
1968 | new_tsp->smk_forked = old_tsp->smk_task; | 1968 | new_tsp->smk_forked = old_tsp->smk_task; |
1969 | mutex_init(&new_tsp->smk_rules_lock); | 1969 | mutex_init(&new_tsp->smk_rules_lock); |
1970 | INIT_LIST_HEAD(&new_tsp->smk_rules); | 1970 | INIT_LIST_HEAD(&new_tsp->smk_rules); |
1971 | 1971 | ||
1972 | |||
1973 | /* cbs copy rule list */ | 1972 | /* cbs copy rule list */ |
1974 | } | 1973 | } |
1975 | 1974 | ||
@@ -1980,12 +1979,12 @@ static void smack_cred_transfer(struct cred *new, const struct cred *old) | |||
1980 | * | 1979 | * |
1981 | * Sets the secid to contain a u32 version of the smack label. | 1980 | * Sets the secid to contain a u32 version of the smack label. |
1982 | */ | 1981 | */ |
1983 | static void smack_cred_getsecid(const struct cred *c, u32 *secid) | 1982 | static void smack_cred_getsecid(const struct cred *cred, u32 *secid) |
1984 | { | 1983 | { |
1985 | struct smack_known *skp; | 1984 | struct smack_known *skp; |
1986 | 1985 | ||
1987 | rcu_read_lock(); | 1986 | rcu_read_lock(); |
1988 | skp = smk_of_task(c->security); | 1987 | skp = smk_of_task(smack_cred(cred)); |
1989 | *secid = skp->smk_secid; | 1988 | *secid = skp->smk_secid; |
1990 | rcu_read_unlock(); | 1989 | rcu_read_unlock(); |
1991 | } | 1990 | } |
@@ -1999,7 +1998,7 @@ static void smack_cred_getsecid(const struct cred *c, u32 *secid) | |||
1999 | */ | 1998 | */ |
2000 | static int smack_kernel_act_as(struct cred *new, u32 secid) | 1999 | static int smack_kernel_act_as(struct cred *new, u32 secid) |
2001 | { | 2000 | { |
2002 | struct task_smack *new_tsp = new->security; | 2001 | struct task_smack *new_tsp = smack_cred(new); |
2003 | 2002 | ||
2004 | new_tsp->smk_task = smack_from_secid(secid); | 2003 | new_tsp->smk_task = smack_from_secid(secid); |
2005 | return 0; | 2004 | return 0; |
@@ -2017,7 +2016,7 @@ static int smack_kernel_create_files_as(struct cred *new, | |||
2017 | struct inode *inode) | 2016 | struct inode *inode) |
2018 | { | 2017 | { |
2019 | struct inode_smack *isp = inode->i_security; | 2018 | struct inode_smack *isp = inode->i_security; |
2020 | struct task_smack *tsp = new->security; | 2019 | struct task_smack *tsp = smack_cred(new); |
2021 | 2020 | ||
2022 | tsp->smk_forked = isp->smk_inode; | 2021 | tsp->smk_forked = isp->smk_inode; |
2023 | tsp->smk_task = tsp->smk_forked; | 2022 | tsp->smk_task = tsp->smk_forked; |
@@ -2201,7 +2200,7 @@ static int smack_task_kill(struct task_struct *p, struct kernel_siginfo *info, | |||
2201 | * specific behavior. This is not clean. For one thing | 2200 | * specific behavior. This is not clean. For one thing |
2202 | * we can't take privilege into account. | 2201 | * we can't take privilege into account. |
2203 | */ | 2202 | */ |
2204 | skp = smk_of_task(cred->security); | 2203 | skp = smk_of_task(smack_cred(cred)); |
2205 | rc = smk_access(skp, tkp, MAY_DELIVER, &ad); | 2204 | rc = smk_access(skp, tkp, MAY_DELIVER, &ad); |
2206 | rc = smk_bu_note("USB signal", skp, tkp, MAY_DELIVER, rc); | 2205 | rc = smk_bu_note("USB signal", skp, tkp, MAY_DELIVER, rc); |
2207 | return rc; | 2206 | return rc; |
@@ -3528,7 +3527,7 @@ static int smack_getprocattr(struct task_struct *p, char *name, char **value) | |||
3528 | */ | 3527 | */ |
3529 | static int smack_setprocattr(const char *name, void *value, size_t size) | 3528 | static int smack_setprocattr(const char *name, void *value, size_t size) |
3530 | { | 3529 | { |
3531 | struct task_smack *tsp = current_security(); | 3530 | struct task_smack *tsp = smack_cred(current_cred()); |
3532 | struct cred *new; | 3531 | struct cred *new; |
3533 | struct smack_known *skp; | 3532 | struct smack_known *skp; |
3534 | struct smack_known_list_elem *sklep; | 3533 | struct smack_known_list_elem *sklep; |
@@ -3569,7 +3568,7 @@ static int smack_setprocattr(const char *name, void *value, size_t size) | |||
3569 | if (new == NULL) | 3568 | if (new == NULL) |
3570 | return -ENOMEM; | 3569 | return -ENOMEM; |
3571 | 3570 | ||
3572 | tsp = new->security; | 3571 | tsp = smack_cred(new); |
3573 | tsp->smk_task = skp; | 3572 | tsp->smk_task = skp; |
3574 | /* | 3573 | /* |
3575 | * process can change its label only once | 3574 | * process can change its label only once |
@@ -4214,7 +4213,7 @@ static void smack_inet_csk_clone(struct sock *sk, | |||
4214 | static int smack_key_alloc(struct key *key, const struct cred *cred, | 4213 | static int smack_key_alloc(struct key *key, const struct cred *cred, |
4215 | unsigned long flags) | 4214 | unsigned long flags) |
4216 | { | 4215 | { |
4217 | struct smack_known *skp = smk_of_task(cred->security); | 4216 | struct smack_known *skp = smk_of_task(smack_cred(cred)); |
4218 | 4217 | ||
4219 | key->security = skp; | 4218 | key->security = skp; |
4220 | return 0; | 4219 | return 0; |
@@ -4245,7 +4244,7 @@ static int smack_key_permission(key_ref_t key_ref, | |||
4245 | { | 4244 | { |
4246 | struct key *keyp; | 4245 | struct key *keyp; |
4247 | struct smk_audit_info ad; | 4246 | struct smk_audit_info ad; |
4248 | struct smack_known *tkp = smk_of_task(cred->security); | 4247 | struct smack_known *tkp = smk_of_task(smack_cred(cred)); |
4249 | int request = 0; | 4248 | int request = 0; |
4250 | int rc; | 4249 | int rc; |
4251 | 4250 | ||
@@ -4520,7 +4519,7 @@ static int smack_inode_copy_up(struct dentry *dentry, struct cred **new) | |||
4520 | return -ENOMEM; | 4519 | return -ENOMEM; |
4521 | } | 4520 | } |
4522 | 4521 | ||
4523 | tsp = new_creds->security; | 4522 | tsp = smack_cred(new_creds); |
4524 | 4523 | ||
4525 | /* | 4524 | /* |
4526 | * Get label from overlay inode and set it in create_sid | 4525 | * Get label from overlay inode and set it in create_sid |
@@ -4548,8 +4547,8 @@ static int smack_dentry_create_files_as(struct dentry *dentry, int mode, | |||
4548 | const struct cred *old, | 4547 | const struct cred *old, |
4549 | struct cred *new) | 4548 | struct cred *new) |
4550 | { | 4549 | { |
4551 | struct task_smack *otsp = old->security; | 4550 | struct task_smack *otsp = smack_cred(old); |
4552 | struct task_smack *ntsp = new->security; | 4551 | struct task_smack *ntsp = smack_cred(new); |
4553 | struct inode_smack *isp; | 4552 | struct inode_smack *isp; |
4554 | int may; | 4553 | int may; |
4555 | 4554 | ||
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 06b517075ec0..faf2ea3968b3 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -2208,14 +2208,14 @@ static const struct file_operations smk_logging_ops = { | |||
2208 | 2208 | ||
2209 | static void *load_self_seq_start(struct seq_file *s, loff_t *pos) | 2209 | static void *load_self_seq_start(struct seq_file *s, loff_t *pos) |
2210 | { | 2210 | { |
2211 | struct task_smack *tsp = current_security(); | 2211 | struct task_smack *tsp = smack_cred(current_cred()); |
2212 | 2212 | ||
2213 | return smk_seq_start(s, pos, &tsp->smk_rules); | 2213 | return smk_seq_start(s, pos, &tsp->smk_rules); |
2214 | } | 2214 | } |
2215 | 2215 | ||
2216 | static void *load_self_seq_next(struct seq_file *s, void *v, loff_t *pos) | 2216 | static void *load_self_seq_next(struct seq_file *s, void *v, loff_t *pos) |
2217 | { | 2217 | { |
2218 | struct task_smack *tsp = current_security(); | 2218 | struct task_smack *tsp = smack_cred(current_cred()); |
2219 | 2219 | ||
2220 | return smk_seq_next(s, v, pos, &tsp->smk_rules); | 2220 | return smk_seq_next(s, v, pos, &tsp->smk_rules); |
2221 | } | 2221 | } |
@@ -2262,7 +2262,7 @@ static int smk_open_load_self(struct inode *inode, struct file *file) | |||
2262 | static ssize_t smk_write_load_self(struct file *file, const char __user *buf, | 2262 | static ssize_t smk_write_load_self(struct file *file, const char __user *buf, |
2263 | size_t count, loff_t *ppos) | 2263 | size_t count, loff_t *ppos) |
2264 | { | 2264 | { |
2265 | struct task_smack *tsp = current_security(); | 2265 | struct task_smack *tsp = smack_cred(current_cred()); |
2266 | 2266 | ||
2267 | return smk_write_rules_list(file, buf, count, ppos, &tsp->smk_rules, | 2267 | return smk_write_rules_list(file, buf, count, ppos, &tsp->smk_rules, |
2268 | &tsp->smk_rules_lock, SMK_FIXED24_FMT); | 2268 | &tsp->smk_rules_lock, SMK_FIXED24_FMT); |
@@ -2414,14 +2414,14 @@ static const struct file_operations smk_load2_ops = { | |||
2414 | 2414 | ||
2415 | static void *load_self2_seq_start(struct seq_file *s, loff_t *pos) | 2415 | static void *load_self2_seq_start(struct seq_file *s, loff_t *pos) |
2416 | { | 2416 | { |
2417 | struct task_smack *tsp = current_security(); | 2417 | struct task_smack *tsp = smack_cred(current_cred()); |
2418 | 2418 | ||
2419 | return smk_seq_start(s, pos, &tsp->smk_rules); | 2419 | return smk_seq_start(s, pos, &tsp->smk_rules); |
2420 | } | 2420 | } |
2421 | 2421 | ||
2422 | static void *load_self2_seq_next(struct seq_file *s, void *v, loff_t *pos) | 2422 | static void *load_self2_seq_next(struct seq_file *s, void *v, loff_t *pos) |
2423 | { | 2423 | { |
2424 | struct task_smack *tsp = current_security(); | 2424 | struct task_smack *tsp = smack_cred(current_cred()); |
2425 | 2425 | ||
2426 | return smk_seq_next(s, v, pos, &tsp->smk_rules); | 2426 | return smk_seq_next(s, v, pos, &tsp->smk_rules); |
2427 | } | 2427 | } |
@@ -2467,7 +2467,7 @@ static int smk_open_load_self2(struct inode *inode, struct file *file) | |||
2467 | static ssize_t smk_write_load_self2(struct file *file, const char __user *buf, | 2467 | static ssize_t smk_write_load_self2(struct file *file, const char __user *buf, |
2468 | size_t count, loff_t *ppos) | 2468 | size_t count, loff_t *ppos) |
2469 | { | 2469 | { |
2470 | struct task_smack *tsp = current_security(); | 2470 | struct task_smack *tsp = smack_cred(current_cred()); |
2471 | 2471 | ||
2472 | return smk_write_rules_list(file, buf, count, ppos, &tsp->smk_rules, | 2472 | return smk_write_rules_list(file, buf, count, ppos, &tsp->smk_rules, |
2473 | &tsp->smk_rules_lock, SMK_LONG_FMT); | 2473 | &tsp->smk_rules_lock, SMK_LONG_FMT); |
@@ -2681,14 +2681,14 @@ static const struct file_operations smk_syslog_ops = { | |||
2681 | 2681 | ||
2682 | static void *relabel_self_seq_start(struct seq_file *s, loff_t *pos) | 2682 | static void *relabel_self_seq_start(struct seq_file *s, loff_t *pos) |
2683 | { | 2683 | { |
2684 | struct task_smack *tsp = current_security(); | 2684 | struct task_smack *tsp = smack_cred(current_cred()); |
2685 | 2685 | ||
2686 | return smk_seq_start(s, pos, &tsp->smk_relabel); | 2686 | return smk_seq_start(s, pos, &tsp->smk_relabel); |
2687 | } | 2687 | } |
2688 | 2688 | ||
2689 | static void *relabel_self_seq_next(struct seq_file *s, void *v, loff_t *pos) | 2689 | static void *relabel_self_seq_next(struct seq_file *s, void *v, loff_t *pos) |
2690 | { | 2690 | { |
2691 | struct task_smack *tsp = current_security(); | 2691 | struct task_smack *tsp = smack_cred(current_cred()); |
2692 | 2692 | ||
2693 | return smk_seq_next(s, v, pos, &tsp->smk_relabel); | 2693 | return smk_seq_next(s, v, pos, &tsp->smk_relabel); |
2694 | } | 2694 | } |
@@ -2736,7 +2736,7 @@ static int smk_open_relabel_self(struct inode *inode, struct file *file) | |||
2736 | static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf, | 2736 | static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf, |
2737 | size_t count, loff_t *ppos) | 2737 | size_t count, loff_t *ppos) |
2738 | { | 2738 | { |
2739 | struct task_smack *tsp = current_security(); | 2739 | struct task_smack *tsp = smack_cred(current_cred()); |
2740 | char *data; | 2740 | char *data; |
2741 | int rc; | 2741 | int rc; |
2742 | LIST_HEAD(list_tmp); | 2742 | LIST_HEAD(list_tmp); |