sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-02 22:46:26 +00:00
parent 297ba4a59a
commit a339fc8c86
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
29 changed files with 192 additions and 352 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vmx.c,v 1.82 2024/02/29 22:09:33 jan Exp $ */
/* $OpenBSD: if_vmx.c,v 1.83 2024/04/02 20:59:48 jan Exp $ */
/*
* Copyright (c) 2013 Tsubai Masanari
@ -34,11 +34,14 @@
#include <net/if.h>
#include <net/toeplitz.h>
#include <net/if_media.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/udp.h>
#include <machine/bus.h>
@ -407,6 +410,8 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux)
ifp->if_capabilities |= IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6;
}
ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
#if NVLAN > 0
if (sc->sc_ds->upt_features & UPT1_F_VLAN)
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
@ -579,8 +584,8 @@ vmxnet3_alloc_txring(struct vmxnet3_softc *sc, int queue, int intr)
comp_ring->txcd = VMX_DMA_KVA(&comp_ring->dmamem);
for (idx = 0; idx < NTXDESC; idx++) {
if (bus_dmamap_create(sc->sc_dmat, JUMBO_LEN, NTXSEGS,
VMXNET3_TX_LEN_M + 1, 0, BUS_DMA_NOWAIT, &ring->dmap[idx]))
if (bus_dmamap_create(sc->sc_dmat, MAXMCLBYTES, NTXSEGS,
VMXNET3_TX_LEN_M, 0, BUS_DMA_NOWAIT, &ring->dmap[idx]))
return -1;
}
@ -1440,13 +1445,41 @@ vmxnet3_tx_offload(struct vmxnet3_txdesc *sop, struct mbuf *m)
offset = hdrlen + offsetof(struct tcphdr, th_sum);
else if (ext.udp)
offset = hdrlen + offsetof(struct udphdr, uh_sum);
else
return;
if (!ISSET(m->m_pkthdr.csum_flags, M_TCP_TSO)) {
hdrlen &= VMXNET3_TX_HLEN_M;
offset &= VMXNET3_TX_OP_M;
sop->tx_word3 |= htole32(VMXNET3_OM_CSUM << VMXNET3_TX_OM_S);
sop->tx_word3 |= htole32(hdrlen << VMXNET3_TX_HLEN_S);
sop->tx_word2 |= htole32(offset << VMXNET3_TX_OP_S);
return;
}
/*
* TCP Segmentation Offload
*/
if (ext.tcp == NULL) {
tcpstat_inc(tcps_outbadtso);
return;
}
if (ext.ip4)
ext.ip4->ip_sum = 0;
hdrlen += ext.tcphlen;
hdrlen &= VMXNET3_TX_HLEN_M;
offset &= VMXNET3_TX_OP_M;
sop->tx_word3 |= htole32(VMXNET3_OM_CSUM << VMXNET3_TX_OM_S);
sop->tx_word3 |= htole32(VMXNET3_OM_TSO << VMXNET3_TX_OM_S);
sop->tx_word3 |= htole32(hdrlen << VMXNET3_TX_HLEN_S);
sop->tx_word2 |= htole32(offset << VMXNET3_TX_OP_S);
sop->tx_word2 |= htole32(m->m_pkthdr.ph_mss << VMXNET3_TX_OP_S);
tcpstat_add(tcps_outpkttso, (m->m_pkthdr.len - hdrlen +
m->m_pkthdr.ph_mss - 1) / m->m_pkthdr.ph_mss);
}
void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_elf.c,v 1.185 2024/01/17 22:22:25 kurt Exp $ */
/* $OpenBSD: exec_elf.c,v 1.186 2024/04/02 08:39:16 deraadt Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@ -494,10 +494,15 @@ elf_load_file(struct proc *p, char *path, struct exec_package *epp,
addr = ph[i].p_vaddr - base_ph->p_vaddr;
}
elf_load_psection(&epp->ep_vmcmds, nd.ni_vp,
&ph[i], &addr, &size, &prot, flags | VMCMD_SYSCALL);
&ph[i], &addr, &size, &prot, flags);
/* If entry is within this section it must be text */
if (eh.e_entry >= ph[i].p_vaddr &&
eh.e_entry < (ph[i].p_vaddr + size)) {
/* LOAD containing e_entry may not be writable */
if (prot & PROT_WRITE) {
error = ENOEXEC;
goto bad1;
}
epp->ep_entry = addr + eh.e_entry -
ELF_TRUNC(ph[i].p_vaddr,ph[i].p_align);
if (flags == VMCMD_RELATIVE)
@ -715,7 +720,7 @@ exec_elf_makecmds(struct proc *p, struct exec_package *epp)
*/
for (i = 0, pp = ph; i < eh->e_phnum; i++, pp++) {
Elf_Addr addr, size = 0;
int prot = 0, syscall = 0;
int prot = 0;
int flags = 0;
switch (pp->p_type) {
@ -731,16 +736,9 @@ exec_elf_makecmds(struct proc *p, struct exec_package *epp)
} else
addr = ELF_NO_ADDR;
/*
* Permit system calls in main-text static binaries.
* static binaries may not call msyscall() or
* pinsyscalls()
*/
if (interp == NULL) {
syscall = VMCMD_SYSCALL;
p->p_vmspace->vm_map.flags |= VM_MAP_SYSCALL_ONCE;
/* Static binaries may not call pinsyscalls() */
if (interp == NULL)
p->p_vmspace->vm_map.flags |= VM_MAP_PINSYSCALL_ONCE;
}
/*
* Calculates size of text and data segments
@ -750,7 +748,7 @@ exec_elf_makecmds(struct proc *p, struct exec_package *epp)
* for DATA_PLT, is fine for TEXT_PLT.
*/
elf_load_psection(&epp->ep_vmcmds, epp->ep_vp,
pp, &addr, &size, &prot, flags | textrel | syscall);
pp, &addr, &size, &prot, flags | textrel);
/*
* Update exe_base in case alignment was off.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_subr.c,v 1.66 2023/03/19 20:32:13 kettenis Exp $ */
/* $OpenBSD: exec_subr.c,v 1.67 2024/04/02 08:39:16 deraadt Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@ -194,9 +194,6 @@ vmcmd_map_pagedvn(struct proc *p, struct exec_vmcmd *cmd)
/*
* do the map
*/
if ((cmd->ev_flags & VMCMD_SYSCALL) && (cmd->ev_prot & PROT_EXEC))
flags |= UVM_FLAG_SYSCALL;
error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
uobj, cmd->ev_offset, 0,
UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, MAP_INHERIT_COPY,
@ -217,8 +214,7 @@ vmcmd_map_pagedvn(struct proc *p, struct exec_vmcmd *cmd)
round_page(cmd->ev_addr + cmd->ev_len), 1);
#ifdef PMAP_CHECK_COPYIN
if (PMAP_CHECK_COPYIN &&
((flags & UVM_FLAG_SYSCALL) ||
((cmd->ev_flags & VMCMD_IMMUTABLE) && (cmd->ev_prot & PROT_EXEC))))
((cmd->ev_flags & VMCMD_IMMUTABLE) && (cmd->ev_prot & PROT_EXEC)))
uvm_map_check_copyin_add(&p->p_vmspace->vm_map,
cmd->ev_addr, round_page(cmd->ev_addr + cmd->ev_len));
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: init_main.c,v 1.325 2024/02/14 06:17:51 miod Exp $ */
/* $OpenBSD: init_main.c,v 1.326 2024/04/02 08:39:16 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@ -627,7 +627,7 @@ start_init(void *arg)
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY,
MADV_NORMAL,
UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW|UVM_FLAG_STACK|UVM_FLAG_SYSCALL)))
UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW|UVM_FLAG_STACK)))
panic("init: couldn't allocate argument space");
for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_exec.c,v 1.254 2024/01/17 18:56:13 deraadt Exp $ */
/* $OpenBSD: kern_exec.c,v 1.255 2024/04/02 08:39:16 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@ -905,7 +905,7 @@ exec_sigcode_map(struct process *pr)
if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_sigcode, round_page(sz),
sigobject, 0, 0, UVM_MAPFLAG(PROT_EXEC,
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY,
MADV_RANDOM, UVM_FLAG_COPYONW | UVM_FLAG_SYSCALL))) {
MADV_RANDOM, UVM_FLAG_COPYONW))) {
uao_detach(sigobject);
return (ENOMEM);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sys_process.c,v 1.96 2024/03/30 13:33:20 mpi Exp $ */
/* $OpenBSD: sys_process.c,v 1.97 2024/04/02 08:27:22 deraadt Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.325 2024/03/31 14:01:28 mvs Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.327 2024/04/02 14:23:15 claudio Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -2050,6 +2050,7 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf *m)
case SO_REUSEPORT:
case SO_BROADCAST:
case SO_OOBINLINE:
case SO_ACCEPTCONN:
case SO_TIMESTAMP:
case SO_ZEROIZE:
*mtod(m, int *) = so->so_options & optname;
@ -2290,7 +2291,7 @@ filt_soread(struct knote *kn, long hint)
}
kn->kn_fflags = so->so_error;
rv = 1;
} else if (so->so_error) { /* temporary udp error */
} else if (so->so_error) {
rv = 1;
} else if (kn->kn_sfflags & NOTE_LOWAT) {
rv = (kn->kn_data >= kn->kn_sdata);
@ -2327,7 +2328,7 @@ filt_sowrite(struct knote *kn, long hint)
}
kn->kn_fflags = so->so_error;
rv = 1;
} else if (so->so_error) { /* temporary udp error */
} else if (so->so_error) {
rv = 1;
} else if (((so->so_state & SS_ISCONNECTED) == 0) &&
(so->so_proto->pr_flags & PR_CONNREQUIRED)) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec.h,v 1.53 2024/01/16 19:05:00 deraadt Exp $ */
/* $OpenBSD: exec.h,v 1.54 2024/04/02 08:39:16 deraadt Exp $ */
/* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */
/*-
@ -92,7 +92,6 @@ struct exec_vmcmd {
#define VMCMD_RELATIVE 0x0001 /* ev_addr is relative to base entry */
#define VMCMD_BASE 0x0002 /* marks a base entry */
#define VMCMD_STACK 0x0004 /* create with UVM_FLAG_STACK */
#define VMCMD_SYSCALL 0x0008 /* create with UVM_FLAG_SYSCALL */
#define VMCMD_IMMUTABLE 0x0010 /* create with UVM_ET_IMMUTABLE */
#define VMCMD_TEXTREL 0x0020 /* terrible binary contains terrible textrel */
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: proc.h,v 1.357 2024/03/30 13:33:21 mpi Exp $ */
/* $OpenBSD: proc.h,v 1.358 2024/04/02 08:39:16 deraadt Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@ -337,7 +337,6 @@ struct proc {
struct filedesc *p_fd; /* copy of p_p->ps_fd */
struct vmspace *p_vmspace; /* [I] copy of p_p->ps_vmspace */
struct p_inentry p_spinentry; /* [o] cache for SP check */
struct p_inentry p_pcinentry; /* [o] cache for PC check */
int p_flag; /* P_* flags. */
u_char p_spare; /* unused */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm.h,v 1.72 2024/03/30 12:47:47 mpi Exp $ */
/* $OpenBSD: uvm.h,v 1.73 2024/04/02 08:39:17 deraadt Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
@ -92,7 +92,6 @@ struct uvm {
#define UVM_ET_STACK 0x0040 /* this is a stack */
#define UVM_ET_WC 0x0080 /* write combining */
#define UVM_ET_CONCEAL 0x0100 /* omit from dumps */
#define UVM_ET_SYSCALL 0x0200 /* syscall text segment */
#define UVM_ET_IMMUTABLE 0x0400 /* entry may not be changed */
#define UVM_ET_FREEMAPPED 0x8000 /* map entry is on free list (DEBUG) */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_extern.h,v 1.173 2024/01/19 21:20:35 deraadt Exp $ */
/* $OpenBSD: uvm_extern.h,v 1.174 2024/04/02 08:39:17 deraadt Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@ -111,7 +111,6 @@ typedef int vm_prot_t;
#define UVM_FLAG_STACK 0x2000000 /* page may contain a stack */
#define UVM_FLAG_WC 0x4000000 /* write combining */
#define UVM_FLAG_CONCEAL 0x8000000 /* omit from dumps */
#define UVM_FLAG_SYSCALL 0x10000000 /* system calls allowed */
#define UVM_FLAG_SIGALTSTACK 0x20000000 /* sigaltstack validation required */
/* macros to extract info */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_map.c,v 1.327 2024/02/21 03:28:29 deraadt Exp $ */
/* $OpenBSD: uvm_map.c,v 1.328 2024/04/02 08:39:17 deraadt Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@ -871,12 +871,6 @@ uvm_mapanon(struct vm_map *map, vaddr_t *addr, vsize_t sz,
entry->inheritance = inherit;
entry->wired_count = 0;
entry->advice = advice;
if (prot & PROT_WRITE)
map->wserial++;
if (flags & UVM_FLAG_SYSCALL) {
entry->etype |= UVM_ET_SYSCALL;
map->wserial++;
}
if (flags & UVM_FLAG_STACK) {
entry->etype |= UVM_ET_STACK;
if (flags & (UVM_FLAG_FIXED | UVM_FLAG_UNMAP))
@ -1146,12 +1140,6 @@ uvm_map(struct vm_map *map, vaddr_t *addr, vsize_t sz,
entry->inheritance = inherit;
entry->wired_count = 0;
entry->advice = advice;
if (prot & PROT_WRITE)
map->wserial++;
if (flags & UVM_FLAG_SYSCALL) {
entry->etype |= UVM_ET_SYSCALL;
map->wserial++;
}
if (flags & UVM_FLAG_STACK) {
entry->etype |= UVM_ET_STACK;
if (flags & UVM_FLAG_UNMAP)
@ -1613,23 +1601,6 @@ uvm_map_inentry_sp(vm_map_entry_t entry)
return (1);
}
/*
* The system call must not come from a writeable entry, W^X is violated.
* (Would be nice if we can spot aliasing, which is also kind of bad)
*
* The system call must come from an syscall-labeled entry (which are
* the text regions of the main program, sigtramp, ld.so, or libc).
*/
int
uvm_map_inentry_pc(vm_map_entry_t entry)
{
if (entry->protection & PROT_WRITE)
return (0); /* not permitted */
if ((entry->etype & UVM_ET_SYSCALL) == 0)
return (0); /* not permitted */
return (1);
}
int
uvm_map_inentry_recheck(u_long serial, vaddr_t addr, struct p_inentry *ie)
{
@ -1747,8 +1718,6 @@ uvm_map_is_stack_remappable(struct vm_map *map, vaddr_t addr, vaddr_t sz,
return FALSE;
}
if (sigaltstack_check) {
if ((iter->etype & UVM_ET_SYSCALL))
return FALSE;
if (iter->protection != (PROT_READ | PROT_WRITE))
return FALSE;
}
@ -2937,13 +2906,12 @@ uvm_map_printit(struct vm_map *map, boolean_t full,
(long long)entry->offset, entry->aref.ar_amap,
entry->aref.ar_pageoff);
(*pr)("\tsubmap=%c, cow=%c, nc=%c, stack=%c, "
"syscall=%c, prot(max)=%d/%d, inh=%d, "
"prot(max)=%d/%d, inh=%d, "
"wc=%d, adv=%d\n",
(entry->etype & UVM_ET_SUBMAP) ? 'T' : 'F',
(entry->etype & UVM_ET_COPYONWRITE) ? 'T' : 'F',
(entry->etype & UVM_ET_NEEDSCOPY) ? 'T' : 'F',
(entry->etype & UVM_ET_STACK) ? 'T' : 'F',
(entry->etype & UVM_ET_SYSCALL) ? 'T' : 'F',
entry->protection, entry->max_protection,
entry->inheritance, entry->wired_count, entry->advice);
@ -3222,10 +3190,6 @@ uvm_map_protect(struct vm_map *map, vaddr_t start, vaddr_t end,
mask = UVM_ET_ISCOPYONWRITE(iter) ?
~PROT_WRITE : PROT_MASK;
/* XXX should only wserial++ if no split occurs */
if (iter->protection & PROT_WRITE)
map->wserial++;
if (map->flags & VM_MAP_ISVMSPACE) {
if (old_prot == PROT_NONE) {
((struct vmspace *)map)->vm_dused +=
@ -3401,7 +3365,7 @@ uvmspace_exec(struct proc *p, vaddr_t start, vaddr_t end)
*/
vm_map_lock(map);
vm_map_modflags(map, 0, VM_MAP_WIREFUTURE |
VM_MAP_SYSCALL_ONCE | VM_MAP_PINSYSCALL_ONCE);
VM_MAP_PINSYSCALL_ONCE);
/*
* now unmap the old program
@ -3938,8 +3902,7 @@ uvmspace_fork(struct process *pr)
new_map, new_entry->start, new_entry->end);
}
}
new_map->flags |= old_map->flags &
(VM_MAP_SYSCALL_ONCE | VM_MAP_PINSYSCALL_ONCE);
new_map->flags |= old_map->flags & VM_MAP_PINSYSCALL_ONCE;
#ifdef PMAP_CHECK_COPYIN
if (PMAP_CHECK_COPYIN) {
memcpy(&new_map->check_copyin, &old_map->check_copyin,
@ -4244,48 +4207,6 @@ uvm_map_check_copyin_add(struct vm_map *map, vaddr_t start, vaddr_t end)
}
#endif /* PMAP_CHECK_COPYIN */
/*
* uvm_map_syscall: permit system calls for range of addrs in map.
*
* => map must be unlocked
*/
int
uvm_map_syscall(struct vm_map *map, vaddr_t start, vaddr_t end)
{
struct vm_map_entry *entry;
if (start > end)
return EINVAL;
start = MAX(start, map->min_offset);
end = MIN(end, map->max_offset);
if (start >= end)
return 0;
if (map->flags & VM_MAP_SYSCALL_ONCE) /* only allowed once */
return (EPERM);
vm_map_lock(map);
entry = uvm_map_entrybyaddr(&map->addr, start);
if (entry->end > start)
UVM_MAP_CLIP_START(map, entry, start);
else
entry = RBT_NEXT(uvm_map_addr, entry);
while (entry != NULL && entry->start < end) {
UVM_MAP_CLIP_END(map, entry, end);
entry->etype |= UVM_ET_SYSCALL;
entry = RBT_NEXT(uvm_map_addr, entry);
}
#ifdef PMAP_CHECK_COPYIN
check_copyin_add(map, start, end); /* Add libc's text segment */
#endif
map->wserial++;
map->flags |= VM_MAP_SYSCALL_ONCE;
vm_map_unlock(map);
return (0);
}
/*
* uvm_map_immutable: block mapping/mprotect for range of addrs in map.
*
@ -4328,8 +4249,6 @@ uvm_map_immutable(struct vm_map *map, vaddr_t start, vaddr_t end, int imut)
entry->etype &= ~UVM_ET_IMMUTABLE;
entry = RBT_NEXT(uvm_map_addr, entry);
}
map->wserial++;
error = 0;
out:
vm_map_unlock(map);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_map.h,v 1.88 2024/01/16 19:05:01 deraadt Exp $ */
/* $OpenBSD: uvm_map.h,v 1.89 2024/04/02 08:39:17 deraadt Exp $ */
/* $NetBSD: uvm_map.h,v 1.24 2001/02/18 21:19:08 chs Exp $ */
/*
@ -261,7 +261,6 @@ RBT_PROTOTYPE(uvm_map_addr, vm_map_entry, daddrs.addr_entry,
struct vm_map {
struct pmap *pmap; /* [I] Physical map */
u_long sserial; /* [v] # stack changes */
u_long wserial; /* [v] # PROT_WRITE increases */
struct uvm_map_addr addr; /* [v] Entry tree, by addr */
@ -328,7 +327,6 @@ struct vm_map {
#define VM_MAP_WANTLOCK 0x10 /* rw: want to write-lock */
#define VM_MAP_GUARDPAGES 0x20 /* rw: add guard pgs to map */
#define VM_MAP_ISVMSPACE 0x40 /* ro: map is a vmspace */
#define VM_MAP_SYSCALL_ONCE 0x80 /* rw: libc syscall registered */
#define VM_MAP_PINSYSCALL_ONCE 0x100 /* rw: pinsyscall done */
/* Number of kernel maps and entries to statically allocate */
@ -358,7 +356,6 @@ struct vm_map * uvm_map_create(pmap_t, vaddr_t, vaddr_t, int);
vaddr_t uvm_map_pie(vaddr_t);
vaddr_t uvm_map_hint(struct vmspace *, vm_prot_t, vaddr_t, vaddr_t);
int uvm_map_check_copyin_add(struct vm_map *, vaddr_t, vaddr_t);
int uvm_map_syscall(struct vm_map *, vaddr_t, vaddr_t);
int uvm_map_immutable(struct vm_map *, vaddr_t, vaddr_t, int);
int uvm_map_inherit(struct vm_map *, vaddr_t, vaddr_t, vm_inherit_t);
int uvm_map_advice(struct vm_map *, vaddr_t, vaddr_t, int);
@ -385,7 +382,6 @@ int uvm_map_mquery(struct vm_map*, vaddr_t*, vsize_t, voff_t, int);
struct p_inentry;
int uvm_map_inentry_sp(vm_map_entry_t);
int uvm_map_inentry_pc(vm_map_entry_t);
boolean_t uvm_map_inentry(struct proc *, struct p_inentry *, vaddr_t addr,
const char *fmt, int (*fn)(vm_map_entry_t), u_long serial);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_mmap.c,v 1.186 2024/03/28 02:19:57 deraadt Exp $ */
/* $OpenBSD: uvm_mmap.c,v 1.187 2024/04/02 08:39:17 deraadt Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@ -592,24 +592,7 @@ sys_mprotect(struct proc *p, void *v, register_t *retval)
int
sys_msyscall(struct proc *p, void *v, register_t *retval)
{
struct sys_msyscall_args /* {
syscallarg(void *) addr;
syscallarg(size_t) len;
} */ *uap = v;
vaddr_t addr;
vsize_t size, pageoff;
addr = (vaddr_t)SCARG(uap, addr);
size = (vsize_t)SCARG(uap, len);
/*
* align the address to a page boundary, and adjust the size accordingly
*/
ALIGN_ADDR(addr, size, pageoff);
if (addr > SIZE_MAX - size)
return EINVAL; /* disallow wrap-around. */
return uvm_map_syscall(&p->p_vmspace->vm_map, addr, addr+size);
return 0;
}
/*