Remove sv_pagesize, originally introduced with r100384.
In all of the architectures we have today, we always use PAGE_SIZE. While in theory one could define different things, none of the current architectures do, even the ones that have transitioned from 32-bit to 64-bit like i386 and arm. Some ancient mips binaries on other systems used 8k instead of 4k, but we don't support running those and likely never will due to their age and obscurity. Reviewed by: imp (who also contributed the commit message) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19280
This commit is contained in:
parent
3aee58ca76
commit
1699546def
@ -63,7 +63,6 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -210,7 +210,6 @@ static struct sysentvec cloudabi32_elf_sysvec = {
|
||||
.sv_fixup = cloudabi32_fixup_tcb,
|
||||
.sv_name = "CloudABI ELF32",
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_pagesize = IA32_PAGE_SIZE,
|
||||
.sv_minuser = FREEBSD32_MINUSER,
|
||||
.sv_maxuser = FREEBSD32_MAXUSER,
|
||||
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
|
||||
|
@ -197,7 +197,6 @@ static struct sysentvec cloudabi64_elf_sysvec = {
|
||||
.sv_fixup = cloudabi64_fixup_tcb,
|
||||
.sv_name = "CloudABI ELF64",
|
||||
.sv_coredump = elf64_coredump,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
/* Keep top page reserved to work around AMD Ryzen stability issues. */
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE,
|
||||
|
@ -722,7 +722,6 @@ struct sysentvec elf_linux_sysvec = {
|
||||
.sv_coredump = elf64_coredump,
|
||||
.sv_imgact_try = linux_exec_imgact_try,
|
||||
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -920,7 +920,6 @@ struct sysentvec elf_linux_sysvec = {
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_imgact_try = linux_exec_imgact_try,
|
||||
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = LINUX32_MAXUSER,
|
||||
.sv_usrstack = LINUX32_USRSTACK,
|
||||
|
@ -70,7 +70,6 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -174,7 +174,6 @@ static struct sysentvec cloudabi32_elf_sysvec = {
|
||||
.sv_fixup = cloudabi32_fixup,
|
||||
.sv_name = "CloudABI ELF32",
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
|
||||
|
@ -87,7 +87,6 @@ static struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = FREEBSD32_MINUSER,
|
||||
.sv_maxuser = FREEBSD32_MAXUSER,
|
||||
.sv_usrstack = FREEBSD32_USRSTACK,
|
||||
|
@ -69,7 +69,6 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -182,7 +182,6 @@ static struct sysentvec cloudabi32_elf_sysvec = {
|
||||
.sv_fixup = cloudabi32_fixup,
|
||||
.sv_name = "CloudABI ELF32",
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = (uintmax_t)1 << 32,
|
||||
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
|
||||
|
@ -166,7 +166,6 @@ static struct sysentvec cloudabi64_elf_sysvec = {
|
||||
.sv_fixup = cloudabi64_fixup,
|
||||
.sv_name = "CloudABI ELF64",
|
||||
.sv_coredump = elf64_coredump,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
|
||||
|
@ -373,7 +373,6 @@ struct sysentvec elf_linux_sysvec = {
|
||||
.sv_coredump = elf64_coredump,
|
||||
.sv_imgact_try = linux_exec_imgact_try,
|
||||
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -109,7 +109,6 @@ struct sysentvec ia32_freebsd_sysvec = {
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = IA32_PAGE_SIZE,
|
||||
.sv_minuser = FREEBSD32_MINUSER,
|
||||
.sv_maxuser = FREEBSD32_MAXUSER,
|
||||
.sv_usrstack = FREEBSD32_USRSTACK,
|
||||
|
@ -185,7 +185,6 @@ static struct sysentvec cloudabi32_elf_sysvec = {
|
||||
.sv_fixup = cloudabi32_fixup_tcb,
|
||||
.sv_name = "CloudABI ELF32",
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
|
||||
|
@ -65,7 +65,6 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -861,7 +861,6 @@ struct sysentvec linux_sysvec = {
|
||||
.sv_coredump = NULL,
|
||||
.sv_imgact_try = linux_exec_imgact_try,
|
||||
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = LINUX_USRSTACK,
|
||||
@ -897,7 +896,6 @@ struct sysentvec elf_linux_sysvec = {
|
||||
.sv_coredump = elf32_coredump,
|
||||
.sv_imgact_try = linux_exec_imgact_try,
|
||||
.sv_minsigstksz = LINUX_MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = LINUX_USRSTACK,
|
||||
|
@ -87,7 +87,6 @@ struct sysentvec aout_sysvec = {
|
||||
.sv_coredump = NULL,
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = AOUT32_USRSTACK,
|
||||
.sv_usrstack = AOUT32_USRSTACK,
|
||||
@ -129,7 +128,6 @@ struct sysentvec aout_sysvec = {
|
||||
.sv_coredump = NULL,
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = IA32_PAGE_SIZE,
|
||||
.sv_minuser = AOUT32_MINUSER,
|
||||
.sv_maxuser = AOUT32_USRSTACK,
|
||||
.sv_usrstack = AOUT32_USRSTACK,
|
||||
|
@ -90,10 +90,9 @@ static int __elfN(check_header)(const Elf_Ehdr *hdr);
|
||||
static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
|
||||
const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0);
|
||||
static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
|
||||
u_long *entry, size_t pagesize);
|
||||
u_long *entry);
|
||||
static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot,
|
||||
size_t pagesize);
|
||||
caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot);
|
||||
static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
|
||||
static bool __elfN(freebsd_trans_osrel)(const Elf_Note *note,
|
||||
int32_t *osrel);
|
||||
@ -541,8 +540,7 @@ __elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
|
||||
|
||||
static int
|
||||
__elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot,
|
||||
size_t pagesize)
|
||||
caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
|
||||
{
|
||||
struct sf_buf *sf;
|
||||
size_t map_len;
|
||||
@ -570,8 +568,8 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
|
||||
object = imgp->object;
|
||||
map = &imgp->proc->p_vmspace->vm_map;
|
||||
map_addr = trunc_page_ps((vm_offset_t)vmaddr, pagesize);
|
||||
file_addr = trunc_page_ps(offset, pagesize);
|
||||
map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE);
|
||||
file_addr = trunc_page_ps(offset, PAGE_SIZE);
|
||||
|
||||
/*
|
||||
* We have two choices. We can either clear the data in the last page
|
||||
@ -582,9 +580,9 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
if (filsz == 0)
|
||||
map_len = 0;
|
||||
else if (memsz > filsz)
|
||||
map_len = trunc_page_ps(offset + filsz, pagesize) - file_addr;
|
||||
map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr;
|
||||
else
|
||||
map_len = round_page_ps(offset + filsz, pagesize) - file_addr;
|
||||
map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr;
|
||||
|
||||
if (map_len != 0) {
|
||||
/* cow flags: don't dump readonly sections in core */
|
||||
@ -614,9 +612,9 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
* to try and save a page, but it's a pain in the behind to implement.
|
||||
*/
|
||||
copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset +
|
||||
filsz, pagesize);
|
||||
map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, pagesize);
|
||||
map_len = round_page_ps((vm_offset_t)vmaddr + memsz, pagesize) -
|
||||
filsz, PAGE_SIZE);
|
||||
map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE);
|
||||
map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) -
|
||||
map_addr;
|
||||
|
||||
/* This had damn well better be true! */
|
||||
@ -633,7 +631,7 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
return (EIO);
|
||||
|
||||
/* send the page fragment to user space */
|
||||
off = trunc_page_ps(offset + filsz, pagesize) -
|
||||
off = trunc_page_ps(offset + filsz, PAGE_SIZE) -
|
||||
trunc_page(offset + filsz);
|
||||
error = copyout((caddr_t)sf_buf_kva(sf) + off,
|
||||
(caddr_t)map_addr, copy_len);
|
||||
@ -667,7 +665,7 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
|
||||
*/
|
||||
static int
|
||||
__elfN(load_file)(struct proc *p, const char *file, u_long *addr,
|
||||
u_long *entry, size_t pagesize)
|
||||
u_long *entry)
|
||||
{
|
||||
struct {
|
||||
struct nameidata nd;
|
||||
@ -766,7 +764,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
|
||||
prot = __elfN(trans_prot)(phdr[i].p_flags);
|
||||
error = __elfN(load_section)(imgp, phdr[i].p_offset,
|
||||
(caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase,
|
||||
phdr[i].p_memsz, phdr[i].p_filesz, prot, pagesize);
|
||||
phdr[i].p_memsz, phdr[i].p_filesz, prot);
|
||||
if (error != 0)
|
||||
goto fail;
|
||||
/*
|
||||
@ -1055,8 +1053,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
prot = __elfN(trans_prot)(phdr[i].p_flags);
|
||||
error = __elfN(load_section)(imgp, phdr[i].p_offset,
|
||||
(caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr,
|
||||
phdr[i].p_memsz, phdr[i].p_filesz, prot,
|
||||
sv->sv_pagesize);
|
||||
phdr[i].p_memsz, phdr[i].p_filesz, prot);
|
||||
if (error != 0)
|
||||
goto ret;
|
||||
|
||||
@ -1175,7 +1172,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
snprintf(path, MAXPATHLEN, "%s%s",
|
||||
brand_info->emul_path, interp);
|
||||
error = __elfN(load_file)(imgp->proc, path, &addr,
|
||||
&imgp->entry_addr, sv->sv_pagesize);
|
||||
&imgp->entry_addr);
|
||||
free(path, M_TEMP);
|
||||
if (error == 0)
|
||||
have_interp = TRUE;
|
||||
@ -1184,13 +1181,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
(brand_info->interp_path == NULL ||
|
||||
strcmp(interp, brand_info->interp_path) == 0)) {
|
||||
error = __elfN(load_file)(imgp->proc, newinterp, &addr,
|
||||
&imgp->entry_addr, sv->sv_pagesize);
|
||||
&imgp->entry_addr);
|
||||
if (error == 0)
|
||||
have_interp = TRUE;
|
||||
}
|
||||
if (!have_interp) {
|
||||
error = __elfN(load_file)(imgp->proc, interp, &addr,
|
||||
&imgp->entry_addr, sv->sv_pagesize);
|
||||
&imgp->entry_addr);
|
||||
}
|
||||
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (error != 0) {
|
||||
|
@ -420,7 +420,6 @@ struct sysentvec null_sysvec = {
|
||||
.sv_coredump = NULL,
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = 0,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -66,7 +66,6 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
@ -121,7 +120,6 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -88,7 +88,6 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = ((vm_offset_t)0x80000000),
|
||||
.sv_usrstack = FREEBSD32_USRSTACK,
|
||||
|
@ -94,7 +94,6 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_stackprot = VM_PROT_ALL,
|
||||
#ifdef __powerpc64__
|
||||
|
@ -69,7 +69,6 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
@ -107,7 +106,6 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -72,7 +72,6 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -70,7 +70,6 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_coredump = __elfN(coredump),
|
||||
.sv_imgact_try = NULL,
|
||||
.sv_minsigstksz = MINSIGSTKSZ,
|
||||
.sv_pagesize = PAGE_SIZE,
|
||||
.sv_minuser = VM_MIN_ADDRESS,
|
||||
.sv_maxuser = VM_MAXUSER_ADDRESS,
|
||||
.sv_usrstack = USRSTACK,
|
||||
|
@ -110,7 +110,6 @@ struct sysentvec {
|
||||
/* function to dump core, or NULL */
|
||||
int (*sv_imgact_try)(struct image_params *);
|
||||
int sv_minsigstksz; /* minimum signal stack size */
|
||||
int sv_pagesize; /* pagesize */
|
||||
vm_offset_t sv_minuser; /* VM_MIN_ADDRESS */
|
||||
vm_offset_t sv_maxuser; /* VM_MAXUSER_ADDRESS */
|
||||
vm_offset_t sv_usrstack; /* USRSTACK */
|
||||
|
Loading…
Reference in New Issue
Block a user