734 |
return retval; |
return retval; |
735 |
} |
} |
736 |
|
|
737 |
static int CheckEnviron(struct linux_binprm *bprm, const u8 profile, const unsigned int mode) |
static int CheckEnviron(struct linux_binprm *bprm) |
738 |
{ |
{ |
739 |
char *arg_ptr = ccs_alloc(CCS_MAX_PATHNAME_LEN); |
const u8 profile = current->domain_info->profile; |
740 |
|
const unsigned int mode = CheckCCSFlags(CCS_TOMOYO_MAC_FOR_ENV); |
741 |
|
char *arg_ptr; |
742 |
int arg_len = 0; |
int arg_len = 0; |
743 |
unsigned long pos = bprm->p; |
unsigned long pos = bprm->p; |
744 |
int i = pos / PAGE_SIZE, offset = pos % PAGE_SIZE; |
int i = pos / PAGE_SIZE, offset = pos % PAGE_SIZE; |
746 |
int envp_count = bprm->envc; |
int envp_count = bprm->envc; |
747 |
//printk("start %d %d\n", argv_count, envp_count); |
//printk("start %d %d\n", argv_count, envp_count); |
748 |
int error = -ENOMEM; |
int error = -ENOMEM; |
749 |
|
if (!mode || !envp_count) return 0; |
750 |
|
arg_ptr = ccs_alloc(CCS_MAX_PATHNAME_LEN); |
751 |
if (!arg_ptr) goto out; |
if (!arg_ptr) goto out; |
|
if (!envp_count) { |
|
|
error = 0; |
|
|
goto out; |
|
|
} |
|
752 |
while (error == -ENOMEM) { |
while (error == -ENOMEM) { |
753 |
struct page *page; |
struct page *page; |
754 |
const char *kaddr; |
const char *kaddr; |
904 |
current->tomoyo_flags &= ~CCS_DONT_SLEEP_ON_ENFORCE_ERROR; |
current->tomoyo_flags &= ~CCS_DONT_SLEEP_ON_ENFORCE_ERROR; |
905 |
} |
} |
906 |
if (retval == 0) { |
if (retval == 0) { |
|
const u8 profile = next_domain->profile; |
|
|
unsigned int mode; |
|
907 |
current->domain_info = next_domain; |
current->domain_info = next_domain; |
908 |
mode = CheckCCSFlags(CCS_TOMOYO_MAC_FOR_ENV); |
retval = CheckEnviron(bprm); |
|
if (mode) retval = CheckEnviron(bprm, profile, mode); |
|
909 |
current->tomoyo_flags |= TOMOYO_CHECK_READ_FOR_OPEN_EXEC; |
current->tomoyo_flags |= TOMOYO_CHECK_READ_FOR_OPEN_EXEC; |
910 |
if (!retval) retval = search_binary_handler(bprm, regs); |
if (!retval) retval = search_binary_handler(bprm, regs); |
911 |
current->tomoyo_flags &= ~TOMOYO_CHECK_READ_FOR_OPEN_EXEC; |
current->tomoyo_flags &= ~TOMOYO_CHECK_READ_FOR_OPEN_EXEC; |