mcctrl: fix a bunch of -Wframe-larger-than warnings
This commit is contained in:
@@ -75,7 +75,7 @@ static int load_elf(struct linux_binprm *bprm
|
||||
char buf[32];
|
||||
int l;
|
||||
int pass;
|
||||
char pbuf[1024];
|
||||
char *pbuf;
|
||||
const char *path;
|
||||
|
||||
if(bprm->envc == 0)
|
||||
@@ -88,6 +88,11 @@ static int load_elf(struct linux_binprm *bprm
|
||||
if(elf_ex->e_ident[EI_CLASS] != ELFCLASS64)
|
||||
return -ENOEXEC;
|
||||
|
||||
pbuf = kmalloc(1024, GFP_ATOMIC);
|
||||
if (!pbuf) {
|
||||
printk("%s: error: allocating pbuf\n", __FUNCTION__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
path = d_path(&bprm->file->f_path, pbuf, 1024);
|
||||
if(!path || IS_ERR(path))
|
||||
path = bprm->interp;
|
||||
@@ -96,8 +101,10 @@ static int load_elf(struct linux_binprm *bprm
|
||||
if(!cp ||
|
||||
!strcmp(cp, "/mcexec") ||
|
||||
!strcmp(cp, "/ihkosctl") ||
|
||||
!strcmp(cp, "/ihkconfig"))
|
||||
!strcmp(cp, "/ihkconfig")) {
|
||||
kfree(pbuf);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
cnt[0] = bprm->argc;
|
||||
cnt[1] = bprm->envc;
|
||||
@@ -124,8 +131,10 @@ static int load_elf(struct linux_binprm *bprm
|
||||
bprm->p, 1, 0, 1,
|
||||
&page, NULL);
|
||||
#endif
|
||||
if(rc <= 0)
|
||||
if(rc <= 0) {
|
||||
kfree(pbuf);
|
||||
return -EFAULT;
|
||||
}
|
||||
addr = kmap_atomic(page
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
|
||||
, KM_USER0
|
||||
@@ -199,21 +208,27 @@ static int load_elf(struct linux_binprm *bprm
|
||||
for(ep = env; ep->name; ep++)
|
||||
if(ep->val)
|
||||
kfree(ep->val);
|
||||
if(rc)
|
||||
if(rc) {
|
||||
kfree(pbuf);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
file = open_exec(MCEXEC_PATH);
|
||||
if (IS_ERR(file))
|
||||
if (IS_ERR(file)) {
|
||||
kfree(pbuf);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
rc = remove_arg_zero(bprm);
|
||||
if (rc){
|
||||
fput(file);
|
||||
kfree(pbuf);
|
||||
return rc;
|
||||
}
|
||||
rc = copy_strings_kernel(1, &bprm->interp, bprm);
|
||||
if (rc < 0){
|
||||
fput(file);
|
||||
kfree(pbuf);
|
||||
return rc;
|
||||
}
|
||||
bprm->argc++;
|
||||
@@ -221,12 +236,14 @@ static int load_elf(struct linux_binprm *bprm
|
||||
rc = copy_strings_kernel(1, &wp, bprm);
|
||||
if (rc){
|
||||
fput(file);
|
||||
kfree(pbuf);
|
||||
return rc;
|
||||
}
|
||||
bprm->argc++;
|
||||
rc = bprm_change_interp(MCEXEC_PATH, bprm);
|
||||
if (rc < 0){
|
||||
fput(file);
|
||||
kfree(pbuf);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -236,8 +253,12 @@ static int load_elf(struct linux_binprm *bprm
|
||||
|
||||
rc = prepare_binprm(bprm);
|
||||
if (rc < 0){
|
||||
kfree(pbuf);
|
||||
return rc;
|
||||
}
|
||||
|
||||
kfree(pbuf);
|
||||
|
||||
return search_binary_handler(bprm
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
|
||||
, regs
|
||||
|
||||
@@ -77,32 +77,49 @@ int mcctrl_ikc_set_recv_cpu(ihk_os_t os, int cpu);
|
||||
static long mcexec_prepare_image(ihk_os_t os,
|
||||
struct program_load_desc * __user udesc)
|
||||
{
|
||||
struct program_load_desc desc, *pdesc;
|
||||
struct program_load_desc *desc, *pdesc;
|
||||
struct ikc_scd_packet isp;
|
||||
void *args, *envs;
|
||||
long ret = 0;
|
||||
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
||||
struct mcctrl_per_proc_data *ppd = NULL;
|
||||
int num_sections;
|
||||
|
||||
if (copy_from_user(&desc, udesc,
|
||||
desc = kmalloc(sizeof(*desc), GFP_KERNEL);
|
||||
if (!desc) {
|
||||
printk("%s: error: allocating program_load_desc\n",
|
||||
__FUNCTION__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (copy_from_user(desc, udesc,
|
||||
sizeof(struct program_load_desc))) {
|
||||
printk("%s: error: copying program_load_desc\n",
|
||||
__FUNCTION__);
|
||||
kfree(desc);
|
||||
return -EFAULT;
|
||||
}
|
||||
if (desc.num_sections <= 0 || desc.num_sections > 16) {
|
||||
printk("# of sections: %d\n", desc.num_sections);
|
||||
|
||||
num_sections = desc->num_sections;
|
||||
|
||||
if (num_sections <= 0 || num_sections > 16) {
|
||||
printk("# of sections: %d\n", num_sections);
|
||||
return -EINVAL;
|
||||
}
|
||||
pdesc = kmalloc(sizeof(struct program_load_desc) +
|
||||
sizeof(struct program_image_section)
|
||||
* desc.num_sections, GFP_KERNEL);
|
||||
memcpy(pdesc, &desc, sizeof(struct program_load_desc));
|
||||
* num_sections, GFP_KERNEL);
|
||||
memcpy(pdesc, desc, sizeof(struct program_load_desc));
|
||||
if (copy_from_user(pdesc->sections, udesc->sections,
|
||||
sizeof(struct program_image_section)
|
||||
* desc.num_sections)) {
|
||||
* num_sections)) {
|
||||
kfree(desc);
|
||||
kfree(pdesc);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
kfree(desc);
|
||||
|
||||
pdesc->pid = task_tgid_vnr(current);
|
||||
|
||||
if (reserve_user_space(usrdata, &pdesc->user_start, &pdesc->user_end)) {
|
||||
@@ -158,7 +175,7 @@ static long mcexec_prepare_image(ihk_os_t os,
|
||||
ppd->rpgtable = pdesc->rpgtable;
|
||||
|
||||
if (copy_to_user(udesc, pdesc, sizeof(struct program_load_desc) +
|
||||
sizeof(struct program_image_section) * desc.num_sections)) {
|
||||
sizeof(struct program_image_section) * num_sections)) {
|
||||
ret = -EFAULT;
|
||||
goto free_out;
|
||||
}
|
||||
@@ -315,33 +332,42 @@ static long mcexec_start_image(ihk_os_t os,
|
||||
struct program_load_desc * __user udesc,
|
||||
struct file *file)
|
||||
{
|
||||
struct program_load_desc desc;
|
||||
struct program_load_desc *desc;
|
||||
struct ikc_scd_packet isp;
|
||||
struct mcctrl_channel *c;
|
||||
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
||||
struct handlerinfo *info;
|
||||
|
||||
if (copy_from_user(&desc, udesc,
|
||||
desc = kmalloc(sizeof(*desc), GFP_KERNEL);
|
||||
if (!desc) {
|
||||
printk("%s: error: allocating program_load_desc\n",
|
||||
__FUNCTION__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (copy_from_user(desc, udesc,
|
||||
sizeof(struct program_load_desc))) {
|
||||
kfree(desc);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
info = kmalloc(sizeof(struct handlerinfo), GFP_KERNEL);
|
||||
info->pid = desc.pid;
|
||||
info->pid = desc->pid;
|
||||
ihk_os_register_release_handler(file, release_handler, info);
|
||||
|
||||
c = usrdata->channels + desc.cpu;
|
||||
c = usrdata->channels + desc->cpu;
|
||||
|
||||
mcctrl_ikc_set_recv_cpu(os, desc.cpu);
|
||||
mcctrl_ikc_set_recv_cpu(os, desc->cpu);
|
||||
|
||||
usrdata->last_thread_exec = desc.cpu;
|
||||
usrdata->last_thread_exec = desc->cpu;
|
||||
|
||||
isp.msg = SCD_MSG_SCHEDULE_PROCESS;
|
||||
isp.ref = desc.cpu;
|
||||
isp.arg = desc.rprocess;
|
||||
isp.ref = desc->cpu;
|
||||
isp.arg = desc->rprocess;
|
||||
|
||||
mcctrl_ikc_send(os, desc.cpu, &isp);
|
||||
mcctrl_ikc_send(os, desc->cpu, &isp);
|
||||
|
||||
kfree(desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -502,7 +528,7 @@ int mcexec_syscall(struct mcctrl_usrdata *ud, struct ikc_scd_packet *packet)
|
||||
|
||||
if (unlikely(!ppd)) {
|
||||
kprintf("%s: ERROR: no per-process structure for PID %d, "
|
||||
"syscall nr: %d\n",
|
||||
"syscall nr: %lu\n",
|
||||
__FUNCTION__, pid, packet->req.number);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ inline struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(
|
||||
void __return_syscall(ihk_os_t os, struct ikc_scd_packet *packet,
|
||||
long ret, int stid);
|
||||
|
||||
#define PROCFS_NAME_MAX 1000
|
||||
#define PROCFS_NAME_MAX 768
|
||||
|
||||
struct procfs_read {
|
||||
unsigned long pbuf; /* physical address of the host buffer (request) */
|
||||
|
||||
Reference in New Issue
Block a user