Skip to content

Commit afbec52

Browse files
toddkjosgregkh
authored andcommitted
binder: use cred instead of task for getsecid
commit 4d5b553 upstream. Use the 'struct cred' saved at binder_open() to lookup the security ID via security_cred_getsecid(). This ensures that the security context that opened binder is the one used to generate the secctx. Cc: stable@vger.kernel.org # 5.4+ Fixes: ec74136 ("binder: create node flag to request sender's security context") Signed-off-by: Todd Kjos <tkjos@google.com> Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com> Reported-by: kernel test robot <lkp@intel.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0d9f4ae commit afbec52

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/android/binder.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3102,7 +3102,7 @@ static void binder_transaction(struct binder_proc *proc,
31023102
u32 secid;
31033103
size_t added_size;
31043104

3105-
security_task_getsecid(proc->tsk, &secid);
3105+
security_cred_getsecid(proc->cred, &secid);
31063106
ret = security_secid_to_secctx(secid, &secctx, &secctx_sz);
31073107
if (ret) {
31083108
return_error = BR_FAILED_REPLY;

‎include/linux/security.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,11 @@ static inline void security_transfer_creds(struct cred *new,
10031003
{
10041004
}
10051005

1006+
static inline void security_cred_getsecid(const struct cred *c, u32 *secid)
1007+
{
1008+
*secid = 0;
1009+
}
1010+
10061011
static inline int security_kernel_act_as(struct cred *cred, u32 secid)
10071012
{
10081013
return 0;

0 commit comments

Comments
 (0)