mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
lsm: constify the 'file' parameter in security_binder_transfer_file()
SELinux registers the implementation for the "binder_transfer_file" hook. Looking at the function implementation we observe that the parameter "file" is not changing. Mark the "file" parameter of LSM hook security_binder_transfer_file() as "const" since it will not be changing in the LSM hook. Signed-off-by: Khadija Kamran <kamrankhadijadj@gmail.com> [PM: subject line whitespace fix] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
committed by
Paul Moore
parent
6672efbb68
commit
8e4672d6f9
@@ -32,7 +32,7 @@ LSM_HOOK(int, 0, binder_transaction, const struct cred *from,
|
|||||||
LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from,
|
LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from,
|
||||||
const struct cred *to)
|
const struct cred *to)
|
||||||
LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from,
|
LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from,
|
||||||
const struct cred *to, struct file *file)
|
const struct cred *to, const struct file *file)
|
||||||
LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
|
LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
|
||||||
unsigned int mode)
|
unsigned int mode)
|
||||||
LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
|
LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ int security_binder_transaction(const struct cred *from,
|
|||||||
int security_binder_transfer_binder(const struct cred *from,
|
int security_binder_transfer_binder(const struct cred *from,
|
||||||
const struct cred *to);
|
const struct cred *to);
|
||||||
int security_binder_transfer_file(const struct cred *from,
|
int security_binder_transfer_file(const struct cred *from,
|
||||||
const struct cred *to, struct file *file);
|
const struct cred *to, const struct file *file);
|
||||||
int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
|
int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
|
||||||
int security_ptrace_traceme(struct task_struct *parent);
|
int security_ptrace_traceme(struct task_struct *parent);
|
||||||
int security_capget(const struct task_struct *target,
|
int security_capget(const struct task_struct *target,
|
||||||
@@ -538,7 +538,7 @@ static inline int security_binder_transfer_binder(const struct cred *from,
|
|||||||
|
|
||||||
static inline int security_binder_transfer_file(const struct cred *from,
|
static inline int security_binder_transfer_file(const struct cred *from,
|
||||||
const struct cred *to,
|
const struct cred *to,
|
||||||
struct file *file)
|
const struct file *file)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ int security_binder_transfer_binder(const struct cred *from,
|
|||||||
* Return: Returns 0 if permission is granted.
|
* Return: Returns 0 if permission is granted.
|
||||||
*/
|
*/
|
||||||
int security_binder_transfer_file(const struct cred *from,
|
int security_binder_transfer_file(const struct cred *from,
|
||||||
const struct cred *to, struct file *file)
|
const struct cred *to, const struct file *file)
|
||||||
{
|
{
|
||||||
return call_int_hook(binder_transfer_file, 0, from, to, file);
|
return call_int_hook(binder_transfer_file, 0, from, to, file);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1691,7 +1691,7 @@ static inline int file_path_has_perm(const struct cred *cred,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BPF_SYSCALL
|
#ifdef CONFIG_BPF_SYSCALL
|
||||||
static int bpf_fd_pass(struct file *file, u32 sid);
|
static int bpf_fd_pass(const struct file *file, u32 sid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check whether a task can use an open file descriptor to
|
/* Check whether a task can use an open file descriptor to
|
||||||
@@ -1952,7 +1952,7 @@ static inline u32 file_mask_to_av(int mode, int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Convert a Linux file to an access vector. */
|
/* Convert a Linux file to an access vector. */
|
||||||
static inline u32 file_to_av(struct file *file)
|
static inline u32 file_to_av(const struct file *file)
|
||||||
{
|
{
|
||||||
u32 av = 0;
|
u32 av = 0;
|
||||||
|
|
||||||
@@ -2027,7 +2027,7 @@ static int selinux_binder_transfer_binder(const struct cred *from,
|
|||||||
|
|
||||||
static int selinux_binder_transfer_file(const struct cred *from,
|
static int selinux_binder_transfer_file(const struct cred *from,
|
||||||
const struct cred *to,
|
const struct cred *to,
|
||||||
struct file *file)
|
const struct file *file)
|
||||||
{
|
{
|
||||||
u32 sid = cred_sid(to);
|
u32 sid = cred_sid(to);
|
||||||
struct file_security_struct *fsec = selinux_file(file);
|
struct file_security_struct *fsec = selinux_file(file);
|
||||||
@@ -6718,7 +6718,7 @@ static u32 bpf_map_fmode_to_av(fmode_t fmode)
|
|||||||
* access the bpf object and that's why we have to add this additional check in
|
* access the bpf object and that's why we have to add this additional check in
|
||||||
* selinux_file_receive and selinux_binder_transfer_files.
|
* selinux_file_receive and selinux_binder_transfer_files.
|
||||||
*/
|
*/
|
||||||
static int bpf_fd_pass(struct file *file, u32 sid)
|
static int bpf_fd_pass(const struct file *file, u32 sid)
|
||||||
{
|
{
|
||||||
struct bpf_security_struct *bpfsec;
|
struct bpf_security_struct *bpfsec;
|
||||||
struct bpf_prog *prog;
|
struct bpf_prog *prog;
|
||||||
|
|||||||
Reference in New Issue
Block a user