| Function report | 
| Source Code: security\apparmor\domain.c | Create Date:2022-07-28 19:51:37 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:apparmor_bprm_set_creds - set the new creds on the bprm struct*@bprm: binprm for the exec (NOT NULL)* Returns: %0 or error on failure* TODO: once the other paths are done see if we can't refactor into a fn
Proto:int apparmor_bprm_set_creds(struct linux_binprm *bprm)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct linux_binprm * | bprm | 
| 869 | char * buffer = NULL | 
| 870 | const char * info = NULL | 
| 871 | error = 0 | 
| 872 | bool unsafe = false | 
| 878 | If called_set_creds Then Return 0 | 
| 881 | ctx = task_ctx(current process) | 
| 882 | AA_BUG(!cred_label(w credentials )) | 
| 894 | If how unsafe this exec is (mask of LSM_UNSAFE_*) & LSM_UNSAFE_NO_NEW_PRIVS && Not unconfined(label) && Not nnp Then nnp = aa_get_label(label) | 
| 899 | buffer = aa_get_buffer(false) | 
| 900 | If Not buffer Then | 
| 918 | Else if Not new Then | 
| 931 | If how unsafe this exec is (mask of LSM_UNSAFE_*) & LSM_UNSAFE_NO_NEW_PRIVS && Not unconfined(label) && Not aa_label_is_subset(new, nnp) Then | 
| 938 | If how unsafe this exec is (mask of LSM_UNSAFE_*) & prm->unsafe reasons Then If how unsafe this exec is (mask of LSM_UNSAFE_*) & LSM_UNSAFE_PTRACE Then | 
| 950 | If unsafe Then | 
| 952 | dbg_printk("scrubbing environment variables for %s label=", Name of binary as seen by procps ) | 
| 954 | aa_label_printk(new, GFP_KERNEL) | 
| 955 | dbg_printk("\n") | 
| 957 | secureexec = 1 | 
| 963 | dbg_printk("apparmor: clearing unsafe personality bits. %s label=", Name of binary as seen by procps ) | 
| 965 | aa_label_printk(new, GFP_KERNEL) | 
| 966 | dbg_printk("\n") | 
| 970 | aa_put_label(cred_label(w credentials )) | 
| 972 | set_cred_label(w credentials , new) | 
| 974 | done : | 
| 975 | aa_put_label(label) | 
| 976 | aa_put_buffer(buffer) | 
| 978 | Return error | 
| 980 | audit : | 
| 986 | aa_put_label(new) | 
| 987 | Go to done | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |