Commit 64fc9526 authored by Khadija Kamran's avatar Khadija Kamran Committed by Paul Moore

lsm: constify 'bprm' parameter in security_bprm_committing_creds()

The 'bprm_committing_creds' hook has implementations registered in
SELinux and Apparmor. Looking at the function implementations we observe
that the 'bprm' parameter is not changing.

Mark the 'bprm' parameter of LSM hook security_bprm_committing_creds()
as 'const' since it will not be changing in the LSM hook.
Signed-off-by: default avatarKhadija Kamran <kamrankhadijadj@gmail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 4a00c673
...@@ -52,7 +52,7 @@ LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages) ...@@ -52,7 +52,7 @@ LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm) LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm)
LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, const struct file *file) LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, const struct file *file)
LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm) LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, const struct linux_binprm *bprm)
LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm) LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
LSM_HOOK(int, 0, fs_context_submount, struct fs_context *fc, struct super_block *reference) LSM_HOOK(int, 0, fs_context_submount, struct fs_context *fc, struct super_block *reference)
LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
......
...@@ -292,7 +292,7 @@ int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); ...@@ -292,7 +292,7 @@ int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
int security_bprm_creds_for_exec(struct linux_binprm *bprm); int security_bprm_creds_for_exec(struct linux_binprm *bprm);
int security_bprm_creds_from_file(struct linux_binprm *bprm, const struct file *file); int security_bprm_creds_from_file(struct linux_binprm *bprm, const struct file *file);
int security_bprm_check(struct linux_binprm *bprm); int security_bprm_check(struct linux_binprm *bprm);
void security_bprm_committing_creds(struct linux_binprm *bprm); void security_bprm_committing_creds(const struct linux_binprm *bprm);
void security_bprm_committed_creds(struct linux_binprm *bprm); void security_bprm_committed_creds(struct linux_binprm *bprm);
int security_fs_context_submount(struct fs_context *fc, struct super_block *reference); int security_fs_context_submount(struct fs_context *fc, struct super_block *reference);
int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc); int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);
...@@ -623,7 +623,7 @@ static inline int security_bprm_check(struct linux_binprm *bprm) ...@@ -623,7 +623,7 @@ static inline int security_bprm_check(struct linux_binprm *bprm)
return 0; return 0;
} }
static inline void security_bprm_committing_creds(struct linux_binprm *bprm) static inline void security_bprm_committing_creds(const struct linux_binprm *bprm)
{ {
} }
......
...@@ -734,7 +734,7 @@ static int apparmor_setprocattr(const char *name, void *value, ...@@ -734,7 +734,7 @@ static int apparmor_setprocattr(const char *name, void *value,
* apparmor_bprm_committing_creds - do task cleanup on committing new creds * apparmor_bprm_committing_creds - do task cleanup on committing new creds
* @bprm: binprm for the exec (NOT NULL) * @bprm: binprm for the exec (NOT NULL)
*/ */
static void apparmor_bprm_committing_creds(struct linux_binprm *bprm) static void apparmor_bprm_committing_creds(const struct linux_binprm *bprm)
{ {
struct aa_label *label = aa_current_raw_label(); struct aa_label *label = aa_current_raw_label();
struct aa_label *new_label = cred_label(bprm->cred); struct aa_label *new_label = cred_label(bprm->cred);
......
...@@ -1118,7 +1118,7 @@ int security_bprm_check(struct linux_binprm *bprm) ...@@ -1118,7 +1118,7 @@ int security_bprm_check(struct linux_binprm *bprm)
* open file descriptors to which access will no longer be granted when the * open file descriptors to which access will no longer be granted when the
* attributes are changed. This is called immediately before commit_creds(). * attributes are changed. This is called immediately before commit_creds().
*/ */
void security_bprm_committing_creds(struct linux_binprm *bprm) void security_bprm_committing_creds(const struct linux_binprm *bprm)
{ {
call_void_hook(bprm_committing_creds, bprm); call_void_hook(bprm_committing_creds, bprm);
} }
......
...@@ -2455,7 +2455,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, ...@@ -2455,7 +2455,7 @@ static inline void flush_unauthorized_files(const struct cred *cred,
/* /*
* Prepare a process for imminent new credential changes due to exec * Prepare a process for imminent new credential changes due to exec
*/ */
static void selinux_bprm_committing_creds(struct linux_binprm *bprm) static void selinux_bprm_committing_creds(const struct linux_binprm *bprm)
{ {
struct task_security_struct *new_tsec; struct task_security_struct *new_tsec;
struct rlimit *rlim, *initrlim; struct rlimit *rlim, *initrlim;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment