git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
fs
/
binfmt_elf_fdpic.c
diff --git
a/fs/binfmt_elf_fdpic.c
b/fs/binfmt_elf_fdpic.c
index
4472877
..
c21cbb2
100644
(file)
--- a/
fs/binfmt_elf_fdpic.c
+++ b/
fs/binfmt_elf_fdpic.c
@@
-34,16
+34,12
@@
#include <linux/elf.h>
#include <linux/elf-fdpic.h>
#include <linux/elfcore.h>
#include <linux/elf.h>
#include <linux/elf-fdpic.h>
#include <linux/elfcore.h>
-#include <linux/vs_cvirt.h>
#include <asm/uaccess.h>
#include <asm/param.h>
#include <asm/pgalloc.h>
typedef char *elf_caddr_t;
#include <asm/uaccess.h>
#include <asm/param.h>
#include <asm/pgalloc.h>
typedef char *elf_caddr_t;
-#ifndef elf_addr_t
-#define elf_addr_t unsigned long
-#endif
#if 0
#define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
#if 0
#define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
@@
-238,6
+234,14
@@
static int load_elf_fdpic_binary(struct linux_binprm *bprm,
goto error;
}
goto error;
}
+ /*
+ * If the binary is not readable then enforce
+ * mm->dumpable = 0 regardless of the interpreter's
+ * permissions.
+ */
+ if (file_permission(interpreter, MAY_READ) < 0)
+ bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
+
retval = kernel_read(interpreter, 0, bprm->buf,
BINPRM_BUF_SIZE);
if (retval < 0)
retval = kernel_read(interpreter, 0, bprm->buf,
BINPRM_BUF_SIZE);
if (retval < 0)
@@
-422,13
+426,6
@@
static int load_elf_fdpic_binary(struct linux_binprm *bprm,
entryaddr = interp_params.entry_addr ?: exec_params.entry_addr;
start_thread(regs, entryaddr, current->mm->start_stack);
entryaddr = interp_params.entry_addr ?: exec_params.entry_addr;
start_thread(regs, entryaddr, current->mm->start_stack);
- if (unlikely(current->ptrace & PT_PTRACED)) {
- if (current->ptrace & PT_TRACE_EXEC)
- ptrace_notify((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
- else
- send_sig(SIGTRAP, current, 0);
- }
-
retval = 0;
error:
retval = 0;
error:
@@
-710,12
+707,11
@@
static int elf_fdpic_map_file(struct elf_fdpic_params *params,
return -ELIBBAD;
size = sizeof(*loadmap) + nloads * sizeof(*seg);
return -ELIBBAD;
size = sizeof(*loadmap) + nloads * sizeof(*seg);
- loadmap = k
m
alloc(size, GFP_KERNEL);
+ loadmap = k
z
alloc(size, GFP_KERNEL);
if (!loadmap)
return -ENOMEM;
params->loadmap = loadmap;
if (!loadmap)
return -ENOMEM;
params->loadmap = loadmap;
- memset(loadmap, 0, size);
loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
loadmap->nsegs = nloads;
loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
loadmap->nsegs = nloads;
@@
-859,7
+855,7
@@
static int elf_fdpic_map_file(struct elf_fdpic_params *params,
dynamic_error:
printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
dynamic_error:
printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
- what, file->f_dentry->d_inode->i_ino);
+ what, file->f_
path.
dentry->d_inode->i_ino);
return -ELIBBAD;
}
return -ELIBBAD;
}
@@
-1190,7
+1186,7
@@
static int maydump(struct vm_area_struct *vma)
/* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) {
/* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) {
- if (vma->vm_file->f_dentry->d_inode->i_nlink == 0) {
+ if (vma->vm_file->f_
path.
dentry->d_inode->i_nlink == 0) {
kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags);
return 1;
}
kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags);
return 1;
}
@@
-1326,7
+1322,7
@@
static void fill_prstatus(struct elf_prstatus *prstatus,
prstatus->pr_pid = p->pid;
prstatus->pr_ppid = p->parent->pid;
prstatus->pr_pgrp = process_group(p);
prstatus->pr_pid = p->pid;
prstatus->pr_ppid = p->parent->pid;
prstatus->pr_pgrp = process_group(p);
- prstatus->pr_sid = p
->signal->session
;
+ prstatus->pr_sid = p
rocess_session(p)
;
if (thread_group_leader(p)) {
/*
* This is the record for the group leader. Add in the
if (thread_group_leader(p)) {
/*
* This is the record for the group leader. Add in the
@@
-1375,7
+1371,7
@@
static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
psinfo->pr_pid = p->pid;
psinfo->pr_ppid = p->parent->pid;
psinfo->pr_pgrp = process_group(p);
psinfo->pr_pid = p->pid;
psinfo->pr_ppid = p->parent->pid;
psinfo->pr_pgrp = process_group(p);
- psinfo->pr_sid = p
->signal->session
;
+ psinfo->pr_sid = p
rocess_session(p)
;
i = p->state ? ffz(~p->state) + 1 : 0;
psinfo->pr_state = i;
i = p->state ? ffz(~p->state) + 1 : 0;
psinfo->pr_state = i;
@@
-1470,8
+1466,8
@@
static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
DUMP_SEEK(file->f_pos + PAGE_SIZE);
}
else if (page == ZERO_PAGE(addr)) {
DUMP_SEEK(file->f_pos + PAGE_SIZE);
}
else if (page == ZERO_PAGE(addr)) {
- DUMP_SEEK(file->f_pos + PAGE_SIZE);
page_cache_release(page);
page_cache_release(page);
+ DUMP_SEEK(file->f_pos + PAGE_SIZE);
}
else {
void *kaddr;
}
else {
void *kaddr;
@@
-1598,20
+1594,19
@@
static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
if (signr) {
struct elf_thread_status *tmp;
if (signr) {
struct elf_thread_status *tmp;
- r
ead_lock(&tasklist_lock
);
+ r
cu_read_lock(
);
do_each_thread(g,p)
if (current->mm == p->mm && current != p) {
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
if (!tmp) {
do_each_thread(g,p)
if (current->mm == p->mm && current != p) {
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
if (!tmp) {
- r
ead_unlock(&tasklist_lock
);
+ r
cu_read_unlock(
);
goto cleanup;
}
goto cleanup;
}
- INIT_LIST_HEAD(&tmp->list);
tmp->thread = p;
list_add(&tmp->list, &thread_list);
}
while_each_thread(g,p);
tmp->thread = p;
list_add(&tmp->list, &thread_list);
}
while_each_thread(g,p);
- r
ead_unlock(&tasklist_lock
);
+ r
cu_read_unlock(
);
list_for_each(t, &thread_list) {
struct elf_thread_status *tmp;
int sz;
list_for_each(t, &thread_list) {
struct elf_thread_status *tmp;
int sz;