tag | line | file | source code |
bprm | 204 | fs/binfmt_aout.c | static unsigned long * create_aout_tables(char * p, struct linux_binprm * bprm, int ibcs) |
bprm | 208 | fs/binfmt_aout.c | int argc = bprm->argc; |
bprm | 209 | fs/binfmt_aout.c | int envc = bprm->envc; |
bprm | 216 | fs/binfmt_aout.c | if (bprm->loader) { |
bprm | 219 | fs/binfmt_aout.c | put_user(bprm->loader, --sp); |
bprm | 222 | fs/binfmt_aout.c | put_user(bprm->exec, --sp); |
bprm | 258 | fs/binfmt_aout.c | do_load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) |
bprm | 264 | fs/binfmt_aout.c | unsigned long p = bprm->p; |
bprm | 268 | fs/binfmt_aout.c | ex = *((struct exec *) bprm->buf); /* exec-header */ |
bprm | 272 | fs/binfmt_aout.c | bprm->inode->i_size < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
bprm | 286 | fs/binfmt_aout.c | (fd_offset < bprm->inode->i_sb->s_blocksize)) { |
bprm | 303 | fs/binfmt_aout.c | flush_old_exec(bprm); |
bprm | 314 | fs/binfmt_aout.c | current->suid = current->euid = current->fsuid = bprm->e_uid; |
bprm | 315 | fs/binfmt_aout.c | current->sgid = current->egid = current->fsgid = bprm->e_gid; |
bprm | 322 | fs/binfmt_aout.c | read_exec(bprm->inode, fd_offset, (char *) N_TXTADDR(ex), |
bprm | 328 | fs/binfmt_aout.c | read_exec(bprm->inode, 32, (char *) 0, ex.a_text+ex.a_data, 0); |
bprm | 334 | fs/binfmt_aout.c | fd = open_inode(bprm->inode, O_RDONLY); |
bprm | 344 | fs/binfmt_aout.c | read_exec(bprm->inode, fd_offset, |
bprm | 384 | fs/binfmt_aout.c | p = setup_arg_pages(p, bprm); |
bprm | 386 | fs/binfmt_aout.c | p = (unsigned long) create_aout_tables((char *)p, bprm, |
bprm | 399 | fs/binfmt_aout.c | load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) |
bprm | 404 | fs/binfmt_aout.c | retval = do_load_aout_binary(bprm, regs); |
bprm | 40 | fs/binfmt_elf.c | static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs); |
bprm | 332 | fs/binfmt_elf.c | do_load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) |
bprm | 359 | fs/binfmt_elf.c | elf_ex = *((struct elfhdr *) bprm->buf); /* exec-header */ |
bprm | 371 | fs/binfmt_elf.c | (!bprm->inode->i_op || !bprm->inode->i_op->default_file_ops || |
bprm | 372 | fs/binfmt_elf.c | !bprm->inode->i_op->default_file_ops->mmap)){ |
bprm | 384 | fs/binfmt_elf.c | retval = read_exec(bprm->inode, elf_ex.e_phoff, (char *) elf_phdata, |
bprm | 396 | fs/binfmt_elf.c | elf_exec_fileno = open_inode(bprm->inode, O_RDONLY); |
bprm | 432 | fs/binfmt_elf.c | retval = read_exec(bprm->inode,elf_ppnt->p_offset,elf_interpreter, |
bprm | 451 | fs/binfmt_elf.c | retval = read_exec(interpreter_inode,0,bprm->buf,128, 1); |
bprm | 454 | fs/binfmt_elf.c | interp_ex = *((struct exec *) bprm->buf); /* exec-header */ |
bprm | 455 | fs/binfmt_elf.c | interp_elf_ex = *((struct elfhdr *) bprm->buf); /* exec-header */ |
bprm | 492 | fs/binfmt_elf.c | if (!bprm->sh_bang) { |
bprm | 500 | fs/binfmt_elf.c | bprm->p = copy_strings(1,&passed_p,bprm->page,bprm->p,2); |
bprm | 501 | fs/binfmt_elf.c | bprm->argc++; |
bprm | 504 | fs/binfmt_elf.c | if (!bprm->p) { |
bprm | 514 | fs/binfmt_elf.c | flush_old_exec(bprm); |
bprm | 525 | fs/binfmt_elf.c | bprm->p = setup_arg_pages(bprm->p, bprm); |
bprm | 526 | fs/binfmt_elf.c | current->mm->start_stack = bprm->p; |
bprm | 619 | fs/binfmt_elf.c | current->executable = bprm->inode; |
bprm | 620 | fs/binfmt_elf.c | bprm->inode->i_count++; |
bprm | 625 | fs/binfmt_elf.c | current->suid = current->euid = current->fsuid = bprm->e_uid; |
bprm | 626 | fs/binfmt_elf.c | current->sgid = current->egid = current->fsgid = bprm->e_gid; |
bprm | 627 | fs/binfmt_elf.c | bprm->p = (unsigned long) |
bprm | 628 | fs/binfmt_elf.c | create_elf_tables((char *)bprm->p, |
bprm | 629 | fs/binfmt_elf.c | bprm->argc, |
bprm | 630 | fs/binfmt_elf.c | bprm->envc, |
bprm | 641 | fs/binfmt_elf.c | current->mm->start_stack = bprm->p; |
bprm | 677 | fs/binfmt_elf.c | start_thread(regs, elf_entry, bprm->p); |
bprm | 684 | fs/binfmt_elf.c | load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) |
bprm | 689 | fs/binfmt_elf.c | retval = do_load_elf_binary(bprm, regs); |
bprm | 14 | fs/binfmt_script.c | static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs) |
bprm | 18 | fs/binfmt_script.c | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang)) |
bprm | 25 | fs/binfmt_script.c | bprm->sh_bang++; |
bprm | 26 | fs/binfmt_script.c | iput(bprm->inode); |
bprm | 27 | fs/binfmt_script.c | bprm->dont_iput=1; |
bprm | 29 | fs/binfmt_script.c | bprm->buf[127] = '\0'; |
bprm | 30 | fs/binfmt_script.c | if ((cp = strchr(bprm->buf, '\n')) == NULL) |
bprm | 31 | fs/binfmt_script.c | cp = bprm->buf+127; |
bprm | 33 | fs/binfmt_script.c | while (cp > bprm->buf) { |
bprm | 40 | fs/binfmt_script.c | for (cp = bprm->buf+2; (*cp == ' ') || (*cp == '\t'); cp++); |
bprm | 63 | fs/binfmt_script.c | if (bprm->argc) { |
bprm | 64 | fs/binfmt_script.c | offset = bprm->p % PAGE_SIZE; |
bprm | 65 | fs/binfmt_script.c | page = (char*)bprm->page[bprm->p/PAGE_SIZE]; |
bprm | 66 | fs/binfmt_script.c | while(bprm->p++,*(page+offset++)) |
bprm | 69 | fs/binfmt_script.c | page = (char*)bprm->page[bprm->p/PAGE_SIZE]; |
bprm | 71 | fs/binfmt_script.c | bprm->argc--; |
bprm | 73 | fs/binfmt_script.c | bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2); |
bprm | 74 | fs/binfmt_script.c | bprm->argc++; |
bprm | 76 | fs/binfmt_script.c | bprm->p = copy_strings(1, &i_arg, bprm->page, bprm->p, 2); |
bprm | 77 | fs/binfmt_script.c | bprm->argc++; |
bprm | 79 | fs/binfmt_script.c | bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2); |
bprm | 80 | fs/binfmt_script.c | bprm->argc++; |
bprm | 81 | fs/binfmt_script.c | if (!bprm->p) |
bprm | 88 | fs/binfmt_script.c | retval = open_namei(interp, 0, 0, &bprm->inode, NULL); |
bprm | 91 | fs/binfmt_script.c | bprm->dont_iput=0; |
bprm | 92 | fs/binfmt_script.c | retval=prepare_binprm(bprm); |
bprm | 95 | fs/binfmt_script.c | return search_binary_handler(bprm,regs); |
bprm | 98 | fs/binfmt_script.c | static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) |
bprm | 102 | fs/binfmt_script.c | retval = do_load_script(bprm,regs); |
bprm | 281 | fs/exec.c | unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm) |
bprm | 290 | fs/exec.c | if (bprm->loader) |
bprm | 291 | fs/exec.c | bprm->loader += stack_base; |
bprm | 292 | fs/exec.c | bprm->exec += stack_base; |
bprm | 310 | fs/exec.c | if (bprm->page[i]) { |
bprm | 312 | fs/exec.c | put_dirty_page(current,bprm->page[i],stack_base); |
bprm | 402 | fs/exec.c | void flush_old_exec(struct linux_binprm * bprm) |
bprm | 410 | fs/exec.c | name = bprm->filename; |
bprm | 425 | fs/exec.c | if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || |
bprm | 426 | fs/exec.c | permission(bprm->inode,MAY_READ)) |
bprm | 448 | fs/exec.c | int prepare_binprm(struct linux_binprm *bprm) |
bprm | 451 | fs/exec.c | if (!S_ISREG(bprm->inode->i_mode)) /* must be regular file */ |
bprm | 453 | fs/exec.c | if (IS_NOEXEC(bprm->inode)) /* FS mustn't be mounted noexec */ |
bprm | 455 | fs/exec.c | if (!bprm->inode->i_sb) |
bprm | 457 | fs/exec.c | i = bprm->inode->i_mode; |
bprm | 458 | fs/exec.c | if (IS_NOSUID(bprm->inode) && |
bprm | 459 | fs/exec.c | (((i & S_ISUID) && bprm->inode->i_uid != current->euid) |
bprm | 460 | fs/exec.c | || ((i & S_ISGID) && !in_group_p(bprm->inode->i_gid))) && !suser()) |
bprm | 464 | fs/exec.c | bprm->e_uid = current->euid; |
bprm | 465 | fs/exec.c | bprm->e_gid = current->egid; |
bprm | 467 | fs/exec.c | bprm->e_uid = (i & S_ISUID) ? bprm->inode->i_uid : current->euid; |
bprm | 468 | fs/exec.c | bprm->e_gid = (i & S_ISGID) ? bprm->inode->i_gid : current->egid; |
bprm | 470 | fs/exec.c | if ((retval = permission(bprm->inode, MAY_EXEC)) != 0) |
bprm | 472 | fs/exec.c | if (!(bprm->inode->i_mode & 0111) && fsuser()) |
bprm | 475 | fs/exec.c | if (bprm->inode->i_writecount > 0) |
bprm | 478 | fs/exec.c | memset(bprm->buf,0,sizeof(bprm->buf)); |
bprm | 479 | fs/exec.c | return read_exec(bprm->inode,0,bprm->buf,128,1); |
bprm | 482 | fs/exec.c | void remove_arg_zero(struct linux_binprm *bprm) |
bprm | 484 | fs/exec.c | if (bprm->argc) { |
bprm | 487 | fs/exec.c | offset = bprm->p % PAGE_SIZE; |
bprm | 488 | fs/exec.c | page = (char*)bprm->page[bprm->p/PAGE_SIZE]; |
bprm | 489 | fs/exec.c | while(bprm->p++,*(page+offset++)) |
bprm | 492 | fs/exec.c | page = (char*)bprm->page[bprm->p/PAGE_SIZE]; |
bprm | 494 | fs/exec.c | bprm->argc--; |
bprm | 501 | fs/exec.c | int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
bprm | 508 | fs/exec.c | struct exec * eh = (struct exec *) bprm->buf; |
bprm | 510 | fs/exec.c | if (!bprm->loader && eh->fh.f_magic == 0x183 && |
bprm | 514 | fs/exec.c | iput(bprm->inode); |
bprm | 515 | fs/exec.c | bprm->dont_iput = 1; |
bprm | 516 | fs/exec.c | remove_arg_zero(bprm); |
bprm | 517 | fs/exec.c | bprm->p = copy_strings(1, dynloader, bprm->page, bprm->p, 2); |
bprm | 518 | fs/exec.c | bprm->argc++; |
bprm | 519 | fs/exec.c | bprm->loader = bprm->p; |
bprm | 520 | fs/exec.c | retval = open_namei(dynloader[0], 0, 0, &bprm->inode, NULL); |
bprm | 523 | fs/exec.c | bprm->dont_iput = 0; |
bprm | 524 | fs/exec.c | retval = prepare_binprm(bprm); |
bprm | 537 | fs/exec.c | retval = fn(bprm, regs); |
bprm | 539 | fs/exec.c | if(!bprm->dont_iput) |
bprm | 540 | fs/exec.c | iput(bprm->inode); |
bprm | 541 | fs/exec.c | bprm->dont_iput=1; |
bprm | 547 | fs/exec.c | if (bprm->dont_iput) /* We don't have the inode anymore*/ |
bprm | 556 | fs/exec.c | if (printable(bprm->buf[0]) && |
bprm | 557 | fs/exec.c | printable(bprm->buf[1]) && |
bprm | 558 | fs/exec.c | printable(bprm->buf[2]) && |
bprm | 559 | fs/exec.c | printable(bprm->buf[3])) |
bprm | 561 | fs/exec.c | sprintf(modname, "binfmt-%hd", *(short*)(&bprm->buf)); |
bprm | 575 | fs/exec.c | struct linux_binprm bprm; |
bprm | 579 | fs/exec.c | bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); |
bprm | 581 | fs/exec.c | bprm.page[i] = 0; |
bprm | 582 | fs/exec.c | retval = open_namei(filename, 0, 0, &bprm.inode, NULL); |
bprm | 585 | fs/exec.c | bprm.filename = filename; |
bprm | 586 | fs/exec.c | bprm.sh_bang = 0; |
bprm | 587 | fs/exec.c | bprm.loader = 0; |
bprm | 588 | fs/exec.c | bprm.exec = 0; |
bprm | 589 | fs/exec.c | bprm.dont_iput = 0; |
bprm | 590 | fs/exec.c | if ((bprm.argc = count(argv)) < 0) |
bprm | 591 | fs/exec.c | return bprm.argc; |
bprm | 592 | fs/exec.c | if ((bprm.envc = count(envp)) < 0) |
bprm | 593 | fs/exec.c | return bprm.envc; |
bprm | 595 | fs/exec.c | retval = prepare_binprm(&bprm); |
bprm | 598 | fs/exec.c | bprm.p = copy_strings(1, &bprm.filename, bprm.page, bprm.p, 2); |
bprm | 599 | fs/exec.c | bprm.exec = bprm.p; |
bprm | 600 | fs/exec.c | bprm.p = copy_strings(bprm.envc,envp,bprm.page,bprm.p,0); |
bprm | 601 | fs/exec.c | bprm.p = copy_strings(bprm.argc,argv,bprm.page,bprm.p,0); |
bprm | 602 | fs/exec.c | if (!bprm.p) |
bprm | 607 | fs/exec.c | retval = search_binary_handler(&bprm,regs); |
bprm | 613 | fs/exec.c | if(!bprm.dont_iput) |
bprm | 614 | fs/exec.c | iput(bprm.inode); |
bprm | 616 | fs/exec.c | free_page(bprm.page[i]); |
bprm | 55 | include/linux/binfmts.h | extern void flush_old_exec(struct linux_binprm * bprm); |
bprm | 56 | include/linux/binfmts.h | extern unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm); |