mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
Axe the semblance of support for PECOFF and Linux a.out core dumps.
This commit is contained in:
parent
4a29e1698c
commit
d3adf76902
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138126
@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#include <sys/user.h>
|
||||
#include <sys/exec.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
@ -79,13 +78,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_pecoff.h"
|
||||
|
||||
#define uarea_pages 1
|
||||
|
||||
#define PECOFF_PE_SIGNATURE "PE\0\0"
|
||||
static int pecoff_fixup(register_t **, struct image_params *);
|
||||
static int
|
||||
pecoff_coredump(register struct thread *, register struct vnode *,
|
||||
off_t);
|
||||
#ifndef PECOFF_DEBUG
|
||||
#define DPRINTF(a)
|
||||
#else
|
||||
@ -106,7 +100,7 @@ static struct sysentvec pecoff_sysvec = {
|
||||
&szsigcode,
|
||||
0,
|
||||
"FreeBSD PECoff",
|
||||
pecoff_coredump,
|
||||
NULL,
|
||||
NULL,
|
||||
MINSIGSTKSZ,
|
||||
PAGE_SIZE,
|
||||
@ -167,66 +161,6 @@ pecoff_fixup(register_t ** stack_base, struct image_params * imgp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pecoff_coredump(register struct thread * td, register struct vnode * vp,
|
||||
off_t limit)
|
||||
{
|
||||
register struct ucred *cred = td->td_ucred;
|
||||
struct proc *p = td->td_proc;
|
||||
register struct vmspace *vm = p->p_vmspace;
|
||||
char *tempuser;
|
||||
int error;
|
||||
#ifdef PECOFF_DEBUG
|
||||
struct vm_map *map;
|
||||
struct vm_map_entry *ent;
|
||||
struct reg regs;
|
||||
|
||||
#endif
|
||||
if (ctob((uarea_pages + kstack_pages) + vm->vm_dsize + vm->vm_ssize) >=
|
||||
limit)
|
||||
return (EFAULT);
|
||||
tempuser = malloc(ctob(uarea_pages + kstack_pages), M_TEMP,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (tempuser == NULL)
|
||||
return (ENOMEM);
|
||||
PROC_LOCK(p);
|
||||
fill_user(p, (struct user *)tempuser);
|
||||
PROC_UNLOCK(p);
|
||||
bcopy(td->td_frame,
|
||||
tempuser + ctob(uarea_pages) +
|
||||
((caddr_t)td->td_frame - (caddr_t)td->td_kstack),
|
||||
sizeof(struct trapframe));
|
||||
#if PECOFF_DEBUG
|
||||
fill_regs(td, ®s);
|
||||
printf("EIP%x\n", regs.r_eip);
|
||||
printf("EAX%x EBX%x ECX%x EDI%x\n",
|
||||
regs.r_eax, regs.r_ebx, regs.r_ecx, regs.r_edi);
|
||||
map = &vm->vm_map;
|
||||
ent = &map->header;
|
||||
printf("%p %p %p\n", ent, ent->prev, ent->next);
|
||||
#endif
|
||||
error = vn_rdwr(UIO_WRITE, vp, (caddr_t)tempuser,
|
||||
ctob(uarea_pages + kstack_pages),
|
||||
(off_t)0, UIO_SYSSPACE, IO_UNIT, cred, NOCRED,
|
||||
(int *)NULL, td);
|
||||
free(tempuser, M_TEMP);
|
||||
if (error == 0)
|
||||
error = vn_rdwr_inchunks(UIO_WRITE, vp, vm->vm_daddr,
|
||||
(int)ctob(vm->vm_dsize),
|
||||
(off_t)ctob((uarea_pages + kstack_pages)),
|
||||
UIO_USERSPACE, IO_UNIT, cred, NOCRED, NULL, td);
|
||||
if (error == 0)
|
||||
error = vn_rdwr_inchunks(UIO_WRITE, vp,
|
||||
(caddr_t)trunc_page(USRSTACK - ctob(vm->vm_ssize)),
|
||||
round_page(ctob(vm->vm_ssize)),
|
||||
(off_t)ctob((uarea_pages + kstack_pages)) +
|
||||
ctob(vm->vm_dsize),
|
||||
UIO_USERSPACE, IO_UNIT, cred, NOCRED, NULL, td);
|
||||
return (error);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
pecoff_load_section(struct thread * td, struct vmspace * vmspace, struct vnode * vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
|
||||
{
|
||||
|
@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/syscallsubr.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/sysproto.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
@ -65,6 +64,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/pcb.h>
|
||||
|
||||
#include <i386/linux/linux.h>
|
||||
#include <i386/linux/linux_proto.h>
|
||||
@ -94,8 +94,6 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures");
|
||||
#define LINUX_SYS_linux_rt_sendsig 0
|
||||
#define LINUX_SYS_linux_sendsig 0
|
||||
|
||||
#define uarea_pages 1
|
||||
|
||||
extern char linux_sigcode[];
|
||||
extern int linux_szsigcode;
|
||||
|
||||
@ -725,54 +723,6 @@ linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params)
|
||||
*params = NULL; /* no copyin */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Dump core, into a file named as described in the comments for
|
||||
* expand_name(), unless the process was setuid/setgid.
|
||||
*/
|
||||
static int
|
||||
linux_aout_coredump(struct thread *td, struct vnode *vp, off_t limit)
|
||||
{
|
||||
struct proc *p = td->td_proc;
|
||||
struct ucred *cred = td->td_ucred;
|
||||
struct vmspace *vm = p->p_vmspace;
|
||||
char *tempuser;
|
||||
int error;
|
||||
|
||||
if (ctob((uarea_pages + kstack_pages) +
|
||||
vm->vm_dsize + vm->vm_ssize) >= limit)
|
||||
return (EFAULT);
|
||||
tempuser = malloc(ctob(uarea_pages + kstack_pages), M_TEMP,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (tempuser == NULL)
|
||||
return (ENOMEM);
|
||||
PROC_LOCK(p);
|
||||
fill_user(p, (struct user *)tempuser);
|
||||
PROC_UNLOCK(p);
|
||||
bcopy(td->td_frame,
|
||||
tempuser + ctob(uarea_pages) +
|
||||
((caddr_t)td->td_frame - (caddr_t)td->td_kstack),
|
||||
sizeof(struct trapframe));
|
||||
error = vn_rdwr(UIO_WRITE, vp, (caddr_t)tempuser,
|
||||
ctob(uarea_pages + kstack_pages),
|
||||
(off_t)0, UIO_SYSSPACE, IO_UNIT, cred, NOCRED,
|
||||
(int *)NULL, td);
|
||||
free(tempuser, M_TEMP);
|
||||
if (error == 0)
|
||||
error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr,
|
||||
(int)ctob(vm->vm_dsize),
|
||||
(off_t)ctob(uarea_pages + kstack_pages), UIO_USERSPACE,
|
||||
IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td);
|
||||
if (error == 0)
|
||||
error = vn_rdwr_inchunks(UIO_WRITE, vp,
|
||||
(caddr_t)trunc_page(USRSTACK - ctob(vm->vm_ssize)),
|
||||
round_page(ctob(vm->vm_ssize)),
|
||||
(off_t)ctob(uarea_pages + kstack_pages) +
|
||||
ctob(vm->vm_dsize), UIO_USERSPACE,
|
||||
IO_UNIT | IO_DIRECT, cred, NOCRED, NULL, td);
|
||||
return (error);
|
||||
}
|
||||
/*
|
||||
* If a linux binary is exec'ing something, try this image activator
|
||||
* first. We override standard shell script execution in order to
|
||||
@ -848,7 +798,7 @@ struct sysentvec linux_sysvec = {
|
||||
&linux_szsigcode,
|
||||
linux_prepsyscall,
|
||||
"Linux a.out",
|
||||
linux_aout_coredump,
|
||||
NULL,
|
||||
exec_linux_imgact_try,
|
||||
LINUX_MINSIGSTKSZ,
|
||||
PAGE_SIZE,
|
||||
|
Loading…
Reference in New Issue
Block a user