Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125488
b: refs/heads/master
c: 3bfacef
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jan 3, 2009
1 parent 425bf4f commit af3c4e1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 17580d7f2f632ff8c9786d609508c35c9f56e1f3
refs/heads/master: 3bfacef412b4bc993a8992217e50f1245f2fd3a6
2 changes: 1 addition & 1 deletion trunk/arch/alpha/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror -Wno-sign-compare

obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
irq_alpha.o signal.o setup.o ptrace.o time.o \
alpha_ksyms.o systbls.o err_common.o io.o
alpha_ksyms.o systbls.o err_common.o io.o binfmt_loader.o

obj-$(CONFIG_VGA_HOSE) += console.o
obj-$(CONFIG_SMP) += smp.o
Expand Down
51 changes: 51 additions & 0 deletions trunk/arch/alpha/kernel/binfmt_loader.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/mm_types.h>
#include <linux/binfmts.h>
#include <linux/a.out.h>

static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
{
struct exec *eh = (struct exec *)bprm->buf;
unsigned long loader;
struct file *file;
int retval;

if (eh->fh.f_magic != 0x183 || (eh->fh.f_flags & 0x3000) != 0x3000)
return -ENOEXEC;

if (bprm->loader)
return -ENOEXEC;

allow_write_access(bprm->file);
fput(bprm->file);
bprm->file = NULL;

loader = bprm->vma->vm_end - sizeof(void *);

file = open_exec("/sbin/loader");
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;

/* Remember if the application is TASO. */
bprm->taso = eh->ah.entry < 0x100000000UL;

bprm->file = file;
bprm->loader = loader;
retval = prepare_binprm(bprm);
if (retval < 0)
return retval;
return search_binary_handler(bprm,regs);
}

static struct linux_binfmt loader_format = {
.load_binary = load_binary,
};

static int __init init_loader_binfmt(void)
{
return register_binfmt(&loader_format);
}
arch_initcall(init_loader_binfmt);
39 changes: 0 additions & 39 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
#include <asm/tlb.h>
#include "internal.h"

#ifdef __alpha__
/* for /sbin/loader handling in search_binary_handler() */
#include <linux/a.out.h>
#endif

int core_uses_pid;
char core_pattern[CORENAME_MAX_SIZE] = "core";
int suid_dumpable = 0;
Expand Down Expand Up @@ -1172,41 +1167,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
unsigned int depth = bprm->recursion_depth;
int try,retval;
struct linux_binfmt *fmt;
#ifdef __alpha__
/* handle /sbin/loader.. */
{
struct exec * eh = (struct exec *) bprm->buf;

if (!bprm->loader && eh->fh.f_magic == 0x183 &&
(eh->fh.f_flags & 0x3000) == 0x3000)
{
struct file * file;
unsigned long loader;

allow_write_access(bprm->file);
fput(bprm->file);
bprm->file = NULL;

loader = bprm->vma->vm_end - sizeof(void *);

file = open_exec("/sbin/loader");
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;

/* Remember if the application is TASO. */
bprm->taso = eh->ah.entry < 0x100000000UL;

bprm->file = file;
bprm->loader = loader;
retval = prepare_binprm(bprm);
if (retval<0)
return retval;
/* should call search_binary_handler recursively here,
but it does not matter */
}
}
#endif
retval = security_bprm_check(bprm);
if (retval)
return retval;
Expand Down

0 comments on commit af3c4e1

Please sign in to comment.