sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-06 01:12:35 +00:00
parent d875ef6d7b
commit 467ab94ea3
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
25 changed files with 213 additions and 388 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bpf_image.c,v 1.11 2020/08/03 03:29:58 dlg Exp $ */ /* $OpenBSD: bpf_image.c,v 1.12 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996 * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996
@ -34,9 +34,7 @@
#endif #endif
char * char *
bpf_image(p, n) bpf_image(const struct bpf_insn *p, int n)
const struct bpf_insn *p;
int n;
{ {
int v; int v;
char *fmt, *op; char *fmt, *op;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: etherent.c,v 1.9 2015/11/17 21:39:23 mmcc Exp $ */ /* $OpenBSD: etherent.c,v 1.10 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1990, 1993, 1994, 1995, 1996 * Copyright (c) 1990, 1993, 1994, 1995, 1996
@ -40,8 +40,7 @@ static __inline int skip_line(FILE *);
/* Hex digit to integer. */ /* Hex digit to integer. */
static __inline int static __inline int
xdtoi(c) xdtoi(int c)
int c;
{ {
if (isdigit(c)) if (isdigit(c))
return c - '0'; return c - '0';
@ -52,8 +51,7 @@ xdtoi(c)
} }
static __inline int static __inline int
skip_space(f) skip_space(FILE *f)
FILE *f;
{ {
int c; int c;
@ -65,8 +63,7 @@ skip_space(f)
} }
static __inline int static __inline int
skip_line(f) skip_line(FILE *f)
FILE *f;
{ {
int c; int c;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gencode.c,v 1.64 2022/12/27 17:10:07 jmc Exp $ */ /* $OpenBSD: gencode.c,v 1.65 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
@ -220,8 +220,7 @@ freechunks(void)
* A strdup whose allocations are freed after code generation is over. * A strdup whose allocations are freed after code generation is over.
*/ */
char * char *
sdup(s) sdup(const char *s)
const char *s;
{ {
int n = strlen(s) + 1; int n = strlen(s) + 1;
char *cp = newchunk(n); char *cp = newchunk(n);
@ -231,8 +230,7 @@ sdup(s)
} }
static __inline struct block * static __inline struct block *
new_block(code) new_block(int code)
int code;
{ {
struct block *p; struct block *p;
@ -244,8 +242,7 @@ new_block(code)
} }
static __inline struct slist * static __inline struct slist *
new_stmt(code) new_stmt(int code)
int code;
{ {
struct slist *p; struct slist *p;
@ -256,8 +253,7 @@ new_stmt(code)
} }
static struct block * static struct block *
gen_retblk(v) gen_retblk(int v)
int v;
{ {
struct block *b = new_block(BPF_RET|BPF_K); struct block *b = new_block(BPF_RET|BPF_K);
@ -386,8 +382,7 @@ pcap_freecode(struct bpf_program *program)
* in each block is already resolved. * in each block is already resolved.
*/ */
static void static void
backpatch(list, target) backpatch(struct block *list, struct block *target)
struct block *list, *target;
{ {
struct block *next; struct block *next;
@ -408,8 +403,7 @@ backpatch(list, target)
* which of jt and jf is the link. * which of jt and jf is the link.
*/ */
static void static void
merge(b0, b1) merge(struct block *b0, struct block *b1)
struct block *b0, *b1;
{ {
struct block **p = &b0; struct block **p = &b0;
@ -422,8 +416,7 @@ merge(b0, b1)
} }
void void
finish_parse(p) finish_parse(struct block *p)
struct block *p;
{ {
backpatch(p, gen_retblk(snaplen)); backpatch(p, gen_retblk(snaplen));
p->sense = !p->sense; p->sense = !p->sense;
@ -448,8 +441,7 @@ finish_parse(p)
} }
void void
gen_and(b0, b1) gen_and(struct block *b0, struct block *b1)
struct block *b0, *b1;
{ {
backpatch(b0, b1->head); backpatch(b0, b1->head);
b0->sense = !b0->sense; b0->sense = !b0->sense;
@ -460,8 +452,7 @@ gen_and(b0, b1)
} }
void void
gen_or(b0, b1) gen_or(struct block *b0, struct block *b1)
struct block *b0, *b1;
{ {
b0->sense = !b0->sense; b0->sense = !b0->sense;
backpatch(b0, b1->head); backpatch(b0, b1->head);
@ -471,16 +462,13 @@ gen_or(b0, b1)
} }
void void
gen_not(b) gen_not(struct block *b)
struct block *b;
{ {
b->sense = !b->sense; b->sense = !b->sense;
} }
static struct block * static struct block *
gen_cmp(offset, size, v) gen_cmp(u_int offset, u_int size, bpf_int32 v)
u_int offset, size;
bpf_int32 v;
{ {
struct slist *s; struct slist *s;
struct block *b; struct block *b;
@ -496,9 +484,7 @@ gen_cmp(offset, size, v)
} }
static struct block * static struct block *
gen_cmp_gt(offset, size, v) gen_cmp_gt(u_int offset, u_int size, bpf_int32 v)
u_int offset, size;
bpf_int32 v;
{ {
struct slist *s; struct slist *s;
struct block *b; struct block *b;
@ -514,10 +500,7 @@ gen_cmp_gt(offset, size, v)
} }
static struct block * static struct block *
gen_mcmp(offset, size, v, mask) gen_mcmp(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask)
u_int offset, size;
bpf_int32 v;
bpf_u_int32 mask;
{ {
struct block *b = gen_cmp(offset, size, v); struct block *b = gen_cmp(offset, size, v);
struct slist *s; struct slist *s;
@ -532,10 +515,7 @@ gen_mcmp(offset, size, v, mask)
/* Like gen_mcmp with 'dynamic off_nl' added to the offset */ /* Like gen_mcmp with 'dynamic off_nl' added to the offset */
static struct block * static struct block *
gen_mcmp_nl(offset, size, v, mask) gen_mcmp_nl(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask)
u_int offset, size;
bpf_int32 v;
bpf_u_int32 mask;
{ {
struct block *b = gen_cmp_nl(offset, size, v); struct block *b = gen_cmp_nl(offset, size, v);
struct slist *s; struct slist *s;
@ -549,9 +529,7 @@ gen_mcmp_nl(offset, size, v, mask)
} }
static struct block * static struct block *
gen_bcmp(offset, size, v) gen_bcmp(u_int offset, u_int size, const u_char *v)
u_int offset, size;
const u_char *v;
{ {
struct block *b, *tmp; struct block *b, *tmp;
@ -645,9 +623,7 @@ nl2X_stmt(void)
/* Like gen_cmp but adds the dynamic 'off_nl' to the offset */ /* Like gen_cmp but adds the dynamic 'off_nl' to the offset */
static struct block * static struct block *
gen_cmp_nl(offset, size, v) gen_cmp_nl(u_int offset, u_int size, bpf_int32 v)
u_int offset, size;
bpf_int32 v;
{ {
struct slist *s, *tmp; struct slist *s, *tmp;
struct block *b; struct block *b;
@ -669,8 +645,7 @@ gen_cmp_nl(offset, size, v)
} }
static void static void
init_linktype(type) init_linktype(int type)
int type;
{ {
linktype = type; linktype = type;
init_code = NULL; init_code = NULL;
@ -806,8 +781,7 @@ init_linktype(type)
} }
static struct block * static struct block *
gen_uncond(rsense) gen_uncond(int rsense)
int rsense;
{ {
struct block *b; struct block *b;
struct slist *s; struct slist *s;
@ -833,8 +807,7 @@ gen_false()
} }
static struct block * static struct block *
gen_linktype(proto) gen_linktype(int proto)
int proto;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -956,11 +929,8 @@ gen_linktype(proto)
} }
static struct block * static struct block *
gen_hostop(addr, mask, dir, proto, src_off, dst_off) gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir, int proto,
bpf_u_int32 addr; u_int src_off, u_int dst_off)
bpf_u_int32 mask;
int dir, proto;
u_int src_off, dst_off;
{ {
struct block *b0, *b1; struct block *b0, *b1;
u_int offset; u_int offset;
@ -1000,11 +970,8 @@ gen_hostop(addr, mask, dir, proto, src_off, dst_off)
#ifdef INET6 #ifdef INET6
static struct block * static struct block *
gen_hostop6(addr, mask, dir, proto, src_off, dst_off) gen_hostop6(struct in6_addr *addr, struct in6_addr *mask, int dir, int proto,
struct in6_addr *addr; u_int src_off, u_int dst_off)
struct in6_addr *mask;
int dir, proto;
u_int src_off, dst_off;
{ {
struct block *b0, *b1; struct block *b0, *b1;
u_int offset; u_int offset;
@ -1054,9 +1021,7 @@ gen_hostop6(addr, mask, dir, proto, src_off, dst_off)
#endif /*INET6*/ #endif /*INET6*/
static struct block * static struct block *
gen_ehostop(eaddr, dir) gen_ehostop(const u_char *eaddr, int dir)
const u_char *eaddr;
int dir;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -1090,9 +1055,7 @@ gen_ehostop(eaddr, dir)
* Like gen_ehostop, but for DLT_FDDI * Like gen_ehostop, but for DLT_FDDI
*/ */
static struct block * static struct block *
gen_fhostop(eaddr, dir) gen_fhostop(const u_char *eaddr, int dir)
const u_char *eaddr;
int dir;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -1149,10 +1112,7 @@ gen_fhostop(eaddr, dir)
* and not generate masking instructions if the mask is 0xFFFF. * and not generate masking instructions if the mask is 0xFFFF.
*/ */
static struct block * static struct block *
gen_dnhostop(addr, dir, base_off) gen_dnhostop(bpf_u_int32 addr, int dir, u_int base_off)
bpf_u_int32 addr;
int dir;
u_int base_off;
{ {
struct block *b0, *b1, *b2, *tmp; struct block *b0, *b1, *b2, *tmp;
u_int offset_lh; /* offset if long header is received */ u_int offset_lh; /* offset if long header is received */
@ -1220,11 +1180,7 @@ gen_dnhostop(addr, dir, base_off)
} }
static struct block * static struct block *
gen_host(addr, mask, proto, dir) gen_host(bpf_u_int32 addr, bpf_u_int32 mask, int proto, int dir)
bpf_u_int32 addr;
bpf_u_int32 mask;
int proto;
int dir;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -1312,11 +1268,7 @@ gen_host(addr, mask, proto, dir)
#ifdef INET6 #ifdef INET6
static struct block * static struct block *
gen_host6(addr, mask, proto, dir) gen_host6(struct in6_addr *addr, struct in6_addr *mask, int proto, int dir)
struct in6_addr *addr;
struct in6_addr *mask;
int proto;
int dir;
{ {
switch (proto) { switch (proto) {
@ -1433,8 +1385,7 @@ gen_gateway(eaddr, alist, proto, dir)
#endif /*INET6*/ #endif /*INET6*/
struct block * struct block *
gen_proto_abbrev(proto) gen_proto_abbrev(int proto)
int proto;
{ {
struct block *b0 = NULL, *b1; struct block *b0 = NULL, *b1;
@ -1648,9 +1599,7 @@ iphl_to_x(void)
} }
static struct block * static struct block *
gen_portatom(off, v) gen_portatom(int off, bpf_int32 v)
int off;
bpf_int32 v;
{ {
struct slist *s, *tmp; struct slist *s, *tmp;
struct block *b; struct block *b;
@ -1670,17 +1619,14 @@ gen_portatom(off, v)
#ifdef INET6 #ifdef INET6
static struct block * static struct block *
gen_portatom6(off, v) gen_portatom6(int off, bpf_int32 v)
int off;
bpf_int32 v;
{ {
return gen_cmp_nl(40 + off, BPF_H, v); return gen_cmp_nl(40 + off, BPF_H, v);
} }
#endif/*INET6*/ #endif/*INET6*/
struct block * struct block *
gen_portop(port, proto, dir) gen_portop(int port, int proto, int dir)
int port, proto, dir;
{ {
struct block *b0, *b1, *tmp; struct block *b0, *b1, *tmp;
@ -1720,10 +1666,7 @@ gen_portop(port, proto, dir)
} }
static struct block * static struct block *
gen_port(port, ip_proto, dir) gen_port(int port, int ip_proto, int dir)
int port;
int ip_proto;
int dir;
{ {
struct block *b0, *b1, *tmp; struct block *b0, *b1, *tmp;
@ -1751,8 +1694,7 @@ gen_port(port, ip_proto, dir)
#ifdef INET6 #ifdef INET6
struct block * struct block *
gen_portop6(port, proto, dir) gen_portop6(int port, int proto, int dir)
int port, proto, dir;
{ {
struct block *b0, *b1, *tmp; struct block *b0, *b1, *tmp;
@ -1790,10 +1732,7 @@ gen_portop6(port, proto, dir)
} }
static struct block * static struct block *
gen_port6(port, ip_proto, dir) gen_port6(int port, int ip_proto, int dir)
int port;
int ip_proto;
int dir;
{ {
struct block *b0, *b1, *tmp; struct block *b0, *b1, *tmp;
@ -1821,9 +1760,7 @@ gen_port6(port, ip_proto, dir)
#endif /* INET6 */ #endif /* INET6 */
static int static int
lookup_proto(name, proto) lookup_proto(const char *name, int proto)
const char *name;
int proto;
{ {
int v; int v;
@ -1854,10 +1791,7 @@ lookup_proto(name, proto)
} }
static struct block * static struct block *
gen_protochain(v, proto, dir) gen_protochain(int v, int proto, int dir)
int v;
int proto;
int dir;
{ {
struct block *b0, *b; struct block *b0, *b;
struct slist *s[100]; struct slist *s[100];
@ -2151,10 +2085,7 @@ gen_protochain(v, proto, dir)
} }
static struct block * static struct block *
gen_proto(v, proto, dir) gen_proto(int v, int proto, int dir)
int v;
int proto;
int dir;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -2273,9 +2204,7 @@ gen_proto(v, proto, dir)
} }
struct block * struct block *
gen_scode(name, q) gen_scode(const char *name, struct qual q)
const char *name;
struct qual q;
{ {
int proto = q.proto; int proto = q.proto;
int dir = q.dir; int dir = q.dir;
@ -2479,10 +2408,7 @@ gen_scode(name, q)
} }
struct block * struct block *
gen_mcode(s1, s2, masklen, q) gen_mcode(const char *s1, const char *s2, int masklen, struct qual q)
const char *s1, *s2;
int masklen;
struct qual q;
{ {
int nlen, mlen; int nlen, mlen;
bpf_u_int32 n, m; bpf_u_int32 n, m;
@ -2520,10 +2446,7 @@ gen_mcode(s1, s2, masklen, q)
} }
struct block * struct block *
gen_ncode(s, v, q) gen_ncode(const char *s, bpf_u_int32 v, struct qual q)
const char *s;
bpf_u_int32 v;
struct qual q;
{ {
bpf_u_int32 mask; bpf_u_int32 mask;
int proto = q.proto; int proto = q.proto;
@ -2606,10 +2529,7 @@ gen_ncode(s, v, q)
#ifdef INET6 #ifdef INET6
struct block * struct block *
gen_mcode6(s1, s2, masklen, q) gen_mcode6(const char *s1, const char *s2, int masklen, struct qual q)
const char *s1, *s2;
int masklen;
struct qual q;
{ {
struct addrinfo *res; struct addrinfo *res;
struct in6_addr *addr; struct in6_addr *addr;
@ -2664,9 +2584,7 @@ gen_mcode6(s1, s2, masklen, q)
#endif /*INET6*/ #endif /*INET6*/
struct block * struct block *
gen_ecode(eaddr, q) gen_ecode(const u_char *eaddr, struct qual q)
const u_char *eaddr;
struct qual q;
{ {
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) { if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
if (linktype == DLT_EN10MB) if (linktype == DLT_EN10MB)
@ -2682,8 +2600,7 @@ gen_ecode(eaddr, q)
} }
void void
sappend(s0, s1) sappend(struct slist *s0, struct slist *s1)
struct slist *s0, *s1;
{ {
/* /*
* This is definitely not the best way to do this, but the * This is definitely not the best way to do this, but the
@ -2695,8 +2612,7 @@ sappend(s0, s1)
} }
static struct slist * static struct slist *
xfer_to_x(a) xfer_to_x(struct arth *a)
struct arth *a;
{ {
struct slist *s; struct slist *s;
@ -2706,8 +2622,7 @@ xfer_to_x(a)
} }
static struct slist * static struct slist *
xfer_to_a(a) xfer_to_a(struct arth *a)
struct arth *a;
{ {
struct slist *s; struct slist *s;
@ -2717,10 +2632,7 @@ xfer_to_a(a)
} }
struct arth * struct arth *
gen_load(proto, index, size) gen_load(int proto, struct arth *index, int size)
int proto;
struct arth *index;
int size;
{ {
struct slist *s, *tmp; struct slist *s, *tmp;
struct block *b; struct block *b;
@ -2824,10 +2736,7 @@ gen_load(proto, index, size)
} }
struct block * struct block *
gen_relation(code, a0, a1, reversed) gen_relation(int code, struct arth *a0, struct arth *a1, int reversed)
int code;
struct arth *a0, *a1;
int reversed;
{ {
struct slist *s0, *s1, *s2; struct slist *s0, *s1, *s2;
struct block *b, *tmp; struct block *b, *tmp;
@ -2902,8 +2811,7 @@ gen_loadrnd()
} }
struct arth * struct arth *
gen_loadi(val) gen_loadi(int val)
int val;
{ {
struct arth *a; struct arth *a;
struct slist *s; struct slist *s;
@ -2924,8 +2832,7 @@ gen_loadi(val)
} }
struct arth * struct arth *
gen_neg(a) gen_neg(struct arth *a)
struct arth *a;
{ {
struct slist *s; struct slist *s;
@ -2942,9 +2849,7 @@ gen_neg(a)
} }
struct arth * struct arth *
gen_arth(code, a0, a1) gen_arth(int code, struct arth *a0, struct arth *a1)
int code;
struct arth *a0, *a1;
{ {
struct slist *s0, *s1, *s2; struct slist *s0, *s1, *s2;
@ -2998,15 +2903,13 @@ alloc_reg()
* be used later. * be used later.
*/ */
static void static void
free_reg(n) free_reg(int n)
int n;
{ {
regused[n] = 0; regused[n] = 0;
} }
static struct block * static struct block *
gen_len(jmp, n) gen_len(int jmp, int n)
int jmp, n;
{ {
struct slist *s; struct slist *s;
struct block *b; struct block *b;
@ -3020,15 +2923,13 @@ gen_len(jmp, n)
} }
struct block * struct block *
gen_greater(n) gen_greater(int n)
int n;
{ {
return gen_len(BPF_JGE, n); return gen_len(BPF_JGE, n);
} }
struct block * struct block *
gen_less(n) gen_less(int n)
int n;
{ {
struct block *b; struct block *b;
@ -3039,8 +2940,7 @@ gen_less(n)
} }
struct block * struct block *
gen_byteop(op, idx, val) gen_byteop(int op, int idx, int val)
int op, idx, val;
{ {
struct block *b; struct block *b;
struct slist *s; struct slist *s;
@ -3080,8 +2980,7 @@ gen_byteop(op, idx, val)
} }
struct block * struct block *
gen_broadcast(proto) gen_broadcast(int proto)
int proto;
{ {
bpf_u_int32 hostmask; bpf_u_int32 hostmask;
struct block *b0, *b1, *b2; struct block *b0, *b1, *b2;
@ -3122,8 +3021,7 @@ gen_broadcast(proto)
} }
struct block * struct block *
gen_multicast(proto) gen_multicast(int proto)
int proto;
{ {
struct block *b0, *b1; struct block *b0, *b1;
struct slist *s; struct slist *s;
@ -3179,8 +3077,7 @@ gen_multicast(proto)
* = 1 implies "outbound". * = 1 implies "outbound".
*/ */
struct block * struct block *
gen_inbound(dir) gen_inbound(int dir)
int dir;
{ {
struct block *b0; struct block *b0;
@ -3348,9 +3245,7 @@ gen_p80211_type(int type, int mask)
} }
static struct block * static struct block *
gen_ahostop(eaddr, dir) gen_ahostop(const u_char *eaddr, int dir)
const u_char *eaddr;
int dir;
{ {
struct block *b0, *b1; struct block *b0, *b1;
@ -3380,9 +3275,7 @@ gen_ahostop(eaddr, dir)
} }
struct block * struct block *
gen_acode(eaddr, q) gen_acode(const u_char *eaddr, struct qual q)
const u_char *eaddr;
struct qual q;
{ {
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) { if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
if (linktype == DLT_ARCNET) if (linktype == DLT_ARCNET)
@ -3393,8 +3286,7 @@ gen_acode(eaddr, q)
} }
struct block * struct block *
gen_mpls(label) gen_mpls(int label)
int label;
{ {
struct block *b0; struct block *b0;
@ -3424,8 +3316,7 @@ gen_mpls(label)
* support IEEE 802.1Q VLAN trunk over ethernet * support IEEE 802.1Q VLAN trunk over ethernet
*/ */
struct block * struct block *
gen_vlan(vlan_num) gen_vlan(int vlan_num)
int vlan_num;
{ {
struct block *b0; struct block *b0;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: inet.c,v 1.26 2021/12/01 18:28:45 deraadt Exp $ */ /* $OpenBSD: inet.c,v 1.27 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996, 1997, 1998 * Copyright (c) 1994, 1995, 1996, 1997, 1998
@ -109,8 +109,7 @@ pcap_freealldevs(pcap_if_t *alldevs)
* lowest unit number is preferred; loopback is ignored. * lowest unit number is preferred; loopback is ignored.
*/ */
char * char *
pcap_lookupdev(errbuf) pcap_lookupdev(char *errbuf)
char *errbuf;
{ {
#ifdef HAVE_IFADDRS_H #ifdef HAVE_IFADDRS_H
struct ifaddrs *ifap, *ifa, *mp; struct ifaddrs *ifap, *ifa, *mp;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: nametoaddr.c,v 1.24 2021/12/01 18:28:45 deraadt Exp $ */ /* $OpenBSD: nametoaddr.c,v 1.25 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996 * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
@ -255,8 +255,7 @@ pcap_nametollc(const char *s)
/* Hex digit to integer. */ /* Hex digit to integer. */
static __inline int static __inline int
xdtoi(c) xdtoi(int c)
int c;
{ {
if (isdigit(c)) if (isdigit(c))
return c - '0'; return c - '0';

View File

@ -1,4 +1,4 @@
/* $OpenBSD: optimize.c,v 1.21 2020/08/03 03:29:58 dlg Exp $ */ /* $OpenBSD: optimize.c,v 1.22 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996 * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
@ -199,8 +199,7 @@ static uset all_edge_sets;
#endif #endif
static void static void
find_levels_r(b) find_levels_r(struct block *b)
struct block *b;
{ {
int level; int level;
@ -228,8 +227,7 @@ find_levels_r(b)
* with the 'link' field of the struct block. * with the 'link' field of the struct block.
*/ */
static void static void
find_levels(root) find_levels(struct block *root)
struct block *root;
{ {
memset((char *)levels, 0, n_blocks * sizeof(*levels)); memset((char *)levels, 0, n_blocks * sizeof(*levels));
unMarkAll(); unMarkAll();
@ -241,8 +239,7 @@ find_levels(root)
* Assumes graph has been leveled. * Assumes graph has been leveled.
*/ */
static void static void
find_dom(root) find_dom(struct block *root)
struct block *root;
{ {
int i; int i;
struct block *b; struct block *b;
@ -272,8 +269,7 @@ find_dom(root)
} }
static void static void
propedom(ep) propedom(struct edge *ep)
struct edge *ep;
{ {
SET_INSERT(ep->edom, ep->id); SET_INSERT(ep->edom, ep->id);
if (ep->succ) { if (ep->succ) {
@ -287,8 +283,7 @@ propedom(ep)
* Assumes graph has been leveled and predecessors established. * Assumes graph has been leveled and predecessors established.
*/ */
static void static void
find_edom(root) find_edom(struct block *root)
struct block *root;
{ {
int i; int i;
uset x; uset x;
@ -317,8 +312,7 @@ find_edom(root)
* Assumes graph has been leveled. * Assumes graph has been leveled.
*/ */
static void static void
find_closure(root) find_closure(struct block *root)
struct block *root;
{ {
int i; int i;
struct block *b; struct block *b;
@ -348,8 +342,7 @@ find_closure(root)
* The implementation should probably change to an array access. * The implementation should probably change to an array access.
*/ */
static int static int
atomuse(s) atomuse(struct stmt *s)
struct stmt *s;
{ {
int c = s->code; int c = s->code;
@ -394,8 +387,7 @@ atomuse(s)
* The implementation should probably change to an array access. * The implementation should probably change to an array access.
*/ */
static int static int
atomdef(s) atomdef(struct stmt *s)
struct stmt *s;
{ {
if (s->code == NOP) if (s->code == NOP)
return -1; return -1;
@ -420,8 +412,7 @@ atomdef(s)
} }
static void static void
compute_local_ud(b) compute_local_ud(struct block *b)
struct block *b;
{ {
struct slist *s; struct slist *s;
atomset def = 0, use = 0, kill = 0; atomset def = 0, use = 0, kill = 0;
@ -464,8 +455,7 @@ compute_local_ud(b)
* Assume graph is already leveled. * Assume graph is already leveled.
*/ */
static void static void
find_ud(root) find_ud(struct block *root)
struct block *root;
{ {
int i, maxlevel; int i, maxlevel;
struct block *p; struct block *p;
@ -530,9 +520,7 @@ init_val()
/* Because we really don't have an IR, this stuff is a little messy. */ /* Because we really don't have an IR, this stuff is a little messy. */
static int static int
F(code, v0, v1) F(int code, int v0, int v1)
int code;
int v0, v1;
{ {
u_int hash; u_int hash;
int val; int val;
@ -563,11 +551,7 @@ F(code, v0, v1)
} }
static __inline void static __inline void
vstore(s, valp, newval, alter) vstore(struct stmt *s, int *valp, int newval, int alter)
struct stmt *s;
int *valp;
int newval;
int alter;
{ {
if (alter && *valp == newval) if (alter && *valp == newval)
s->code = NOP; s->code = NOP;
@ -576,9 +560,7 @@ vstore(s, valp, newval, alter)
} }
static void static void
fold_op(s, v0, v1) fold_op(struct stmt *s, int v0, int v1)
struct stmt *s;
int v0, v1;
{ {
bpf_int32 a, b; bpf_int32 a, b;
@ -633,8 +615,7 @@ fold_op(s, v0, v1)
} }
static __inline struct slist * static __inline struct slist *
this_op(s) this_op(struct slist *s)
struct slist *s;
{ {
while (s != 0 && s->s.code == NOP) while (s != 0 && s->s.code == NOP)
s = s->next; s = s->next;
@ -642,8 +623,7 @@ this_op(s)
} }
static void static void
opt_not(b) opt_not(struct block *b)
struct block *b;
{ {
struct block *tmp = JT(b); struct block *tmp = JT(b);
@ -652,8 +632,7 @@ opt_not(b)
} }
static void static void
opt_peep(b) opt_peep(struct block *b)
struct block *b;
{ {
struct slist *s; struct slist *s;
struct slist *next, *last; struct slist *next, *last;
@ -861,10 +840,7 @@ opt_peep(b)
* evaluation and code transformations weren't folded together. * evaluation and code transformations weren't folded together.
*/ */
static void static void
opt_stmt(s, val, alter) opt_stmt(struct stmt *s, int val[], int alter)
struct stmt *s;
int val[];
int alter;
{ {
int op; int op;
int v; int v;
@ -1048,9 +1024,7 @@ opt_stmt(s, val, alter)
} }
static void static void
deadstmt(s, last) deadstmt(struct stmt *s, struct stmt *last[])
struct stmt *s;
struct stmt *last[];
{ {
int atom; int atom;
@ -1074,8 +1048,7 @@ deadstmt(s, last)
} }
static void static void
opt_deadstores(b) opt_deadstores(struct block *b)
struct block *b;
{ {
struct slist *s; struct slist *s;
int atom; int atom;
@ -1095,9 +1068,7 @@ opt_deadstores(b)
} }
static void static void
opt_blk(b, do_stmts) opt_blk(struct block *b, int do_stmts)
struct block *b;
int do_stmts;
{ {
struct slist *s; struct slist *s;
struct edge *p; struct edge *p;
@ -1168,8 +1139,7 @@ opt_blk(b, do_stmts)
* from 'b'. * from 'b'.
*/ */
static int static int
use_conflict(b, succ) use_conflict(struct block *b, struct block *succ)
struct block *b, *succ;
{ {
int atom; int atom;
atomset use = succ->out_use; atomset use = succ->out_use;
@ -1185,9 +1155,7 @@ use_conflict(b, succ)
} }
static struct block * static struct block *
fold_edge(child, ep) fold_edge(struct block *child, struct edge *ep)
struct block *child;
struct edge *ep;
{ {
int sense; int sense;
int aval0, aval1, oval0, oval1; int aval0, aval1, oval0, oval1;
@ -1231,8 +1199,7 @@ fold_edge(child, ep)
} }
static void static void
opt_j(ep) opt_j(struct edge *ep)
struct edge *ep;
{ {
int i, k; int i, k;
struct block *target; struct block *target;
@ -1287,8 +1254,7 @@ opt_j(ep)
static void static void
or_pullup(b) or_pullup(struct block *b)
struct block *b;
{ {
int val, at_top; int val, at_top;
struct block *pull; struct block *pull;
@ -1380,8 +1346,7 @@ or_pullup(b)
} }
static void static void
and_pullup(b) and_pullup(struct block *b)
struct block *b;
{ {
int val, at_top; int val, at_top;
struct block *pull; struct block *pull;
@ -1472,9 +1437,7 @@ and_pullup(b)
} }
static void static void
opt_blks(root, do_stmts) opt_blks(struct block *root, int do_stmts)
struct block *root;
int do_stmts;
{ {
int i, maxlevel; int i, maxlevel;
struct block *p; struct block *p;
@ -1507,17 +1470,14 @@ opt_blks(root, do_stmts)
} }
static __inline void static __inline void
link_inedge(parent, child) link_inedge(struct edge *parent, struct block *child)
struct edge *parent;
struct block *child;
{ {
parent->next = child->in_edges; parent->next = child->in_edges;
child->in_edges = parent; child->in_edges = parent;
} }
static void static void
find_inedges(root) find_inedges(struct block *root)
struct block *root;
{ {
int i; int i;
struct block *b; struct block *b;
@ -1538,8 +1498,7 @@ find_inedges(root)
} }
static void static void
opt_root(b) opt_root(struct block **b)
struct block **b;
{ {
struct slist *tmp, *s; struct slist *tmp, *s;
@ -1563,9 +1522,7 @@ opt_root(b)
} }
static void static void
opt_loop(root, do_stmts) opt_loop(struct block *root, int do_stmts)
struct block *root;
int do_stmts;
{ {
#ifdef BDEBUG #ifdef BDEBUG
@ -1592,8 +1549,7 @@ opt_loop(root, do_stmts)
* Optimize the filter code in its dag representation. * Optimize the filter code in its dag representation.
*/ */
void void
bpf_optimize(rootp) bpf_optimize(struct block **rootp)
struct block **rootp;
{ {
struct block *root; struct block *root;
@ -1608,8 +1564,7 @@ bpf_optimize(rootp)
} }
static void static void
make_marks(p) make_marks(struct block *p)
struct block *p;
{ {
if (!isMarked(p)) { if (!isMarked(p)) {
Mark(p); Mark(p);
@ -1625,8 +1580,7 @@ make_marks(p)
* only for nodes that are alive. * only for nodes that are alive.
*/ */
static void static void
mark_code(p) mark_code(struct block *p)
struct block *p;
{ {
cur_mark += 1; cur_mark += 1;
make_marks(p); make_marks(p);
@ -1637,8 +1591,7 @@ mark_code(p)
* the accumulator. * the accumulator.
*/ */
static int static int
eq_slist(x, y) eq_slist(struct slist *x, struct slist *y)
struct slist *x, *y;
{ {
while (1) { while (1) {
while (x && x->s.code == NOP) while (x && x->s.code == NOP)
@ -1657,8 +1610,7 @@ eq_slist(x, y)
} }
static __inline int static __inline int
eq_blk(b0, b1) eq_blk(struct block *b0, struct block *b1)
struct block *b0, *b1;
{ {
if (b0->s.code == b1->s.code && if (b0->s.code == b1->s.code &&
b0->s.k == b1->s.k && b0->s.k == b1->s.k &&
@ -1669,8 +1621,7 @@ eq_blk(b0, b1)
} }
static void static void
intern_blocks(root) intern_blocks(struct block *root)
struct block *root;
{ {
struct block *p; struct block *p;
int i, j; int i, j;
@ -1728,8 +1679,7 @@ opt_cleanup()
* Return the number of stmts in 's'. * Return the number of stmts in 's'.
*/ */
static int static int
slength(s) slength(struct slist *s)
struct slist *s;
{ {
int n = 0; int n = 0;
@ -1744,8 +1694,7 @@ slength(s)
* All nodes should be initially unmarked. * All nodes should be initially unmarked.
*/ */
static int static int
count_blocks(p) count_blocks(struct block *p)
struct block *p;
{ {
if (p == 0 || isMarked(p)) if (p == 0 || isMarked(p))
return 0; return 0;
@ -1758,8 +1707,7 @@ count_blocks(p)
* the basic blocks, and entering them into the 'blocks' array.` * the basic blocks, and entering them into the 'blocks' array.`
*/ */
static void static void
number_blks_r(p) number_blks_r(struct block *p)
struct block *p;
{ {
int n; int n;
@ -1780,8 +1728,7 @@ number_blks_r(p)
* The nodes should be unmarked before calling. * The nodes should be unmarked before calling.
*/ */
static int static int
count_stmts(p) count_stmts(struct block *p)
struct block *p;
{ {
int n; int n;
@ -1798,8 +1745,7 @@ count_stmts(p)
* from the total number of blocks and/or statements. * from the total number of blocks and/or statements.
*/ */
static void static void
opt_init(root) opt_init(struct block *root)
struct block *root;
{ {
bpf_u_int32 *p; bpf_u_int32 *p;
int i, n, max_stmts; int i, n, max_stmts;
@ -1927,8 +1873,7 @@ int bids[1000];
* properly. * properly.
*/ */
static int static int
convert_code_r(p) convert_code_r(struct block *p)
struct block *p;
{ {
struct bpf_insn *dst; struct bpf_insn *dst;
struct slist *src; struct slist *src;
@ -2086,9 +2031,7 @@ filled:
* BPF array representation. Set *lenp to the number of instructions. * BPF array representation. Set *lenp to the number of instructions.
*/ */
struct bpf_insn * struct bpf_insn *
icode_to_fcode(root, lenp) icode_to_fcode(struct block *root, int *lenp)
struct block *root;
int *lenp;
{ {
int n; int n;
struct bpf_insn *fp; struct bpf_insn *fp;

View File

@ -1,5 +1,5 @@
%{ %{
/* $OpenBSD: scanner.l,v 1.28 2020/08/03 03:40:02 dlg Exp $ */ /* $OpenBSD: scanner.l,v 1.29 2024/04/05 18:01:56 deraadt Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@ -317,8 +317,7 @@ tcp-urg { yylval.i = 0x20; return NUM; }
} }
%% %%
void void
lex_init(buf) lex_init(const char *buf)
const char *buf;
{ {
in_buffer = buf; in_buffer = buf;
yyrestart(NULL); yyrestart(NULL);
@ -336,8 +335,7 @@ yywrap()
/* Hex digit to integer. */ /* Hex digit to integer. */
static inline int static inline int
xdtoi(c) xdtoi(int c)
int c;
{ {
if (isdigit(c)) if (isdigit(c))
return c - '0'; return c - '0';
@ -352,8 +350,7 @@ xdtoi(c)
* preceding 0x or 0 and uses hex or octal instead of decimal. * preceding 0x or 0 and uses hex or octal instead of decimal.
*/ */
static int static int
stoi(s) stoi(char *s)
char *s;
{ {
int base = 10; int base = 10;
int n = 0; int n = 0;

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.87 2024/01/19 14:16:41 deraadt Exp $ # $OpenBSD: Makefile,v 1.88 2024/04/05 13:51:47 deraadt Exp $
SUBDIR=ldconfig ldd SUBDIR=ldconfig ldd
MAN= ld.so.1 MAN= ld.so.1
@ -28,7 +28,7 @@ SRCS+= dl_uname.c dl_dirname.c strlcat.c strlen.c trace.c
SRCS+= malloc.c reallocarray.c tib.c ffs.c SRCS+= malloc.c reallocarray.c tib.c ffs.c
syscall=close exit fstat getdents getentropy getthrid issetugid kbind \ syscall=close exit fstat getdents getentropy getthrid issetugid kbind \
mimmutable mmap mprotect munmap msyscall open pledge \ mimmutable mmap mprotect munmap open pledge \
pinsyscalls read __realpath sendsyslog __set_tcb sysctl thrkill \ pinsyscalls read __realpath sendsyslog __set_tcb sysctl thrkill \
utrace write utrace write

View File

@ -1,4 +1,4 @@
/* $OpenBSD: library.c,v 1.95 2024/01/17 13:00:05 deraadt Exp $ */ /* $OpenBSD: library.c,v 1.96 2024/04/05 13:51:47 deraadt Exp $ */
/* /*
* Copyright (c) 2002 Dale Rahn * Copyright (c) 2002 Dale Rahn
@ -324,21 +324,10 @@ _dl_tryload_shlib(const char *libname, int type, int flags, int nodelete)
} }
libc = _dl_islibc(dynp, loff); libc = _dl_islibc(dynp, loff);
if (libc) { if (libc && syscall_phdp)
if (syscall_phdp) _dl_pin(libfile, syscall_phdp, (void *)libaddr,
_dl_pin(libfile, syscall_phdp, (void *)libaddr, (size_t)((exec_start + exec_size) - libaddr),
(size_t)((exec_start + exec_size) - libaddr), exec_start, exec_size);
exec_start, exec_size);
/*
* XXX msyscall() can be removed once pinsyscalls()
* is fully operational
*/
/* Request permission for system calls in libc.so's text segment */
if (_dl_msyscall(exec_start, exec_size) == -1)
_dl_printf("msyscall %lx %lx error\n",
exec_start, exec_size);
}
_dl_close(libfile); _dl_close(libfile);
dynp = (Elf_Dyn *)((unsigned long)dynp + loff); dynp = (Elf_Dyn *)((unsigned long)dynp + loff);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: library_mquery.c,v 1.75 2024/01/17 13:00:05 deraadt Exp $ */ /* $OpenBSD: library_mquery.c,v 1.76 2024/04/05 13:51:47 deraadt Exp $ */
/* /*
* Copyright (c) 2002 Dale Rahn * Copyright (c) 2002 Dale Rahn
@ -332,21 +332,10 @@ retry:
} }
libc = _dl_islibc(dynp, LOFF); libc = _dl_islibc(dynp, LOFF);
if (libc) { if (libc && syscall_phdp)
if (syscall_phdp) _dl_pin(libfile, syscall_phdp, lowld->start,
_dl_pin(libfile, syscall_phdp, lowld->start, (size_t)((exec_start + exec_size) - LOFF),
(size_t)((exec_start + exec_size) - LOFF), exec_start, exec_size);
exec_start, exec_size);
/*
* XXX msyscall() can be removed once pinsyscalls()
* is fully operational
*/
/* Request permission for system calls in libc.so's text segment */
if (_dl_msyscall(exec_start, exec_size) == -1)
_dl_printf("msyscall %lx %lx error\n",
exec_start, exec_size);
}
_dl_close(libfile); _dl_close(libfile);
dynp = (Elf_Dyn *)((unsigned long)dynp + LOFF); dynp = (Elf_Dyn *)((unsigned long)dynp + LOFF);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: syscall.h,v 1.7 2024/01/19 14:16:42 deraadt Exp $ */ /* $OpenBSD: syscall.h,v 1.8 2024/04/05 13:51:47 deraadt Exp $ */
/* /*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB * Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@ -50,7 +50,6 @@ int _dl_kbind(const struct __kbind *, size_t, int64_t);
void *_dl_mmap(void *, size_t, int, int, int, off_t); void *_dl_mmap(void *, size_t, int, int, int, off_t);
int _dl_mprotect(const void *, size_t, int); int _dl_mprotect(const void *, size_t, int);
void *_dl_mquery(void *, size_t, int, int, int, off_t); void *_dl_mquery(void *, size_t, int, int, int, off_t);
int _dl_msyscall(void *addr, size_t len);
int _dl_pinsyscalls(void *base, size_t len, u_int *pin, int pinlen); int _dl_pinsyscalls(void *base, size_t len, u_int *pin, int pinlen);
int _dl_munmap(const void *, size_t); int _dl_munmap(const void *, size_t);
int _dl_mimmutable(const void *, size_t); int _dl_mimmutable(const void *, size_t);

View File

@ -1517,9 +1517,7 @@ static uint32_t drm_fb_helper_find_color_mode_format(struct drm_fb_helper *fb_he
const uint32_t *formats, size_t format_count, const uint32_t *formats, size_t format_count,
unsigned int color_mode) unsigned int color_mode)
{ {
#ifdef notyet
struct drm_device *dev = fb_helper->dev; struct drm_device *dev = fb_helper->dev;
#endif
uint32_t bpp, depth; uint32_t bpp, depth;
switch (color_mode) { switch (color_mode) {

View File

@ -112,16 +112,32 @@ devm_device_add_group(struct device *dev, const struct attribute_group *g)
printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \ printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg) __func__ , ## arg)
#else #else
#define dev_info(dev, fmt, arg...) \
do { } while(0) static inline void
#define dev_info_once(dev, fmt, arg...) \ dev_info(struct device *dev, const char *fmt, ...)
do { } while(0) {
#define dev_dbg(dev, fmt, arg...) \ }
do { } while(0)
#define dev_dbg_once(dev, fmt, arg...) \ static inline void
do { } while(0) dev_info_once(struct device *dev, const char *fmt, ...)
#define dev_dbg_ratelimited(dev, fmt, arg...) \ {
do { } while(0) }
static inline void
dev_dbg(struct device *dev, const char *fmt, ...)
{
}
static inline void
dev_dbg_once(struct device *dev, const char *fmt, ...)
{
}
static inline void
dev_dbg_ratelimited(struct device *dev, const char *fmt, ...)
{
}
#endif #endif
static inline const char * static inline const char *

View File

@ -1,10 +1,10 @@
/* $OpenBSD: init_sysent.c,v 1.276 2024/03/28 02:23:31 deraadt Exp $ */ /* $OpenBSD: init_sysent.c,v 1.277 2024/04/05 14:15:37 deraadt Exp $ */
/* /*
* System call switch table. * System call switch table.
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.259 2024/03/28 02:19:57 deraadt Exp * created from; OpenBSD: syscalls.master,v 1.260 2024/04/05 14:15:13 deraadt Exp
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -96,8 +96,8 @@ const struct sysent sysent[] = {
sys_fchflags }, /* 35 = fchflags */ sys_fchflags }, /* 35 = fchflags */
{ 0, 0, 0, { 0, 0, 0,
sys_sync }, /* 36 = sync */ sys_sync }, /* 36 = sync */
{ 2, s(struct sys_msyscall_args), 0, { 0, 0, 0,
sys_msyscall }, /* 37 = msyscall */ sys_nosys }, /* 37 = obsolete msyscall */
{ 2, s(struct sys_stat_args), 0, { 2, s(struct sys_stat_args), 0,
sys_stat }, /* 38 = stat */ sys_stat }, /* 38 = stat */
{ 0, 0, SY_NOLOCK | 0, { 0, 0, SY_NOLOCK | 0,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_pledge.c,v 1.312 2024/03/28 02:19:57 deraadt Exp $ */ /* $OpenBSD: kern_pledge.c,v 1.313 2024/04/05 13:55:26 deraadt Exp $ */
/* /*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@ -105,7 +105,6 @@ const uint64_t pledge_syscalls[SYS_MAXSYSCALL] = {
*/ */
[SYS_exit] = PLEDGE_ALWAYS, [SYS_exit] = PLEDGE_ALWAYS,
[SYS_kbind] = PLEDGE_ALWAYS, [SYS_kbind] = PLEDGE_ALWAYS,
[SYS_msyscall] = PLEDGE_ALWAYS,
[SYS___get_tcb] = PLEDGE_ALWAYS, [SYS___get_tcb] = PLEDGE_ALWAYS,
[SYS___set_tcb] = PLEDGE_ALWAYS, [SYS___set_tcb] = PLEDGE_ALWAYS,
[SYS_pledge] = PLEDGE_ALWAYS, [SYS_pledge] = PLEDGE_ALWAYS,

View File

@ -1,10 +1,10 @@
/* $OpenBSD: syscalls.c,v 1.274 2024/03/28 02:23:31 deraadt Exp $ */ /* $OpenBSD: syscalls.c,v 1.275 2024/04/05 14:15:37 deraadt Exp $ */
/* /*
* System call names. * System call names.
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.259 2024/03/28 02:19:57 deraadt Exp * created from; OpenBSD: syscalls.master,v 1.260 2024/04/05 14:15:13 deraadt Exp
*/ */
const char *const syscallnames[] = { const char *const syscallnames[] = {
@ -49,7 +49,7 @@ const char *const syscallnames[] = {
"chflags", /* 34 = chflags */ "chflags", /* 34 = chflags */
"fchflags", /* 35 = fchflags */ "fchflags", /* 35 = fchflags */
"sync", /* 36 = sync */ "sync", /* 36 = sync */
"msyscall", /* 37 = msyscall */ "#37 (obsolete msyscall)", /* 37 = obsolete msyscall */
"stat", /* 38 = stat */ "stat", /* 38 = stat */
"getppid", /* 39 = getppid */ "getppid", /* 39 = getppid */
"lstat", /* 40 = lstat */ "lstat", /* 40 = lstat */

View File

@ -1,4 +1,4 @@
; $OpenBSD: syscalls.master,v 1.259 2024/03/28 02:19:57 deraadt Exp $ ; $OpenBSD: syscalls.master,v 1.260 2024/04/05 14:15:13 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -103,7 +103,7 @@
34 STD { int sys_chflags(const char *path, u_int flags); } 34 STD { int sys_chflags(const char *path, u_int flags); }
35 STD { int sys_fchflags(int fd, u_int flags); } 35 STD { int sys_fchflags(int fd, u_int flags); }
36 STD { void sys_sync(void); } 36 STD { void sys_sync(void); }
37 STD { int sys_msyscall(void *addr, size_t len); } 37 OBSOL msyscall
38 STD { int sys_stat(const char *path, struct stat *ub); } 38 STD { int sys_stat(const char *path, struct stat *ub); }
39 STD NOLOCK { pid_t sys_getppid(void); } 39 STD NOLOCK { pid_t sys_getppid(void); }
40 STD { int sys_lstat(const char *path, struct stat *ub); } 40 STD { int sys_lstat(const char *path, struct stat *ub); }

View File

@ -1,10 +1,10 @@
/* $OpenBSD: syscall.h,v 1.273 2024/03/28 02:27:14 deraadt Exp $ */ /* $OpenBSD: syscall.h,v 1.274 2024/04/05 14:15:37 deraadt Exp $ */
/* /*
* System call numbers. * System call numbers.
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.259 2024/03/28 02:19:57 deraadt Exp * created from; OpenBSD: syscalls.master,v 1.260 2024/04/05 14:15:13 deraadt Exp
*/ */
/* syscall: "exit" ret: "void" args: "int" */ /* syscall: "exit" ret: "void" args: "int" */
@ -115,9 +115,7 @@
/* syscall: "sync" ret: "void" args: */ /* syscall: "sync" ret: "void" args: */
#define SYS_sync 36 #define SYS_sync 36
/* syscall: "msyscall" ret: "int" args: "void *" "size_t" */ /* 37 is obsolete msyscall */
#define SYS_msyscall 37
/* syscall: "stat" ret: "int" args: "const char *" "struct stat *" */ /* syscall: "stat" ret: "int" args: "const char *" "struct stat *" */
#define SYS_stat 38 #define SYS_stat 38

View File

@ -1,10 +1,10 @@
/* $OpenBSD: syscallargs.h,v 1.276 2024/03/28 02:27:14 deraadt Exp $ */ /* $OpenBSD: syscallargs.h,v 1.277 2024/04/05 14:15:37 deraadt Exp $ */
/* /*
* System call argument lists. * System call argument lists.
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.259 2024/03/28 02:19:57 deraadt Exp * created from; OpenBSD: syscalls.master,v 1.260 2024/04/05 14:15:13 deraadt Exp
*/ */
#ifdef syscallarg #ifdef syscallarg
@ -186,11 +186,6 @@ struct sys_fchflags_args {
syscallarg(u_int) flags; syscallarg(u_int) flags;
}; };
struct sys_msyscall_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
};
struct sys_stat_args { struct sys_stat_args {
syscallarg(const char *) path; syscallarg(const char *) path;
syscallarg(struct stat *) ub; syscallarg(struct stat *) ub;
@ -1196,7 +1191,6 @@ int sys_access(struct proc *, void *, register_t *);
int sys_chflags(struct proc *, void *, register_t *); int sys_chflags(struct proc *, void *, register_t *);
int sys_fchflags(struct proc *, void *, register_t *); int sys_fchflags(struct proc *, void *, register_t *);
int sys_sync(struct proc *, void *, register_t *); int sys_sync(struct proc *, void *, register_t *);
int sys_msyscall(struct proc *, void *, register_t *);
int sys_stat(struct proc *, void *, register_t *); int sys_stat(struct proc *, void *, register_t *);
int sys_getppid(struct proc *, void *, register_t *); int sys_getppid(struct proc *, void *, register_t *);
int sys_lstat(struct proc *, void *, register_t *); int sys_lstat(struct proc *, void *, register_t *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_mmap.c,v 1.188 2024/04/03 22:21:48 kettenis Exp $ */ /* $OpenBSD: uvm_mmap.c,v 1.191 2024/04/05 14:16:05 deraadt Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/* /*
@ -586,15 +586,6 @@ sys_mprotect(struct proc *p, void *v, register_t *retval)
prot, 0, FALSE, TRUE)); prot, 0, FALSE, TRUE));
} }
/*
* sys_msyscall: the msyscall system call
*/
int
sys_msyscall(struct proc *p, void *v, register_t *retval)
{
return 0;
}
/* /*
* sys_pinsyscalls. The caller is required to normalize base,len * sys_pinsyscalls. The caller is required to normalize base,len
* to the minimum .text region, and adjust pintable offsets relative * to the minimum .text region, and adjust pintable offsets relative
@ -610,6 +601,7 @@ sys_pinsyscalls(struct proc *p, void *v, register_t *retval)
syscallarg(int) npins; syscallarg(int) npins;
} */ *uap = v; } */ *uap = v;
struct process *pr = p->p_p; struct process *pr = p->p_p;
struct vm_map *map = &p->p_vmspace->vm_map;
int npins, error = 0, i; int npins, error = 0, i;
vaddr_t base; vaddr_t base;
size_t len; size_t len;
@ -622,6 +614,8 @@ sys_pinsyscalls(struct proc *p, void *v, register_t *retval)
len = (vsize_t)SCARG(uap, len); len = (vsize_t)SCARG(uap, len);
if (base > SIZE_MAX - len) if (base > SIZE_MAX - len)
return (EINVAL); /* disallow wrap-around. */ return (EINVAL); /* disallow wrap-around. */
if (base < map->min_offset || base+len > map->max_offset)
return (EINVAL);
/* XXX MP unlock */ /* XXX MP unlock */
@ -654,6 +648,12 @@ err:
pr->ps_libcpin.pn_pins = pins; pr->ps_libcpin.pn_pins = pins;
pr->ps_libcpin.pn_npins = npins; pr->ps_libcpin.pn_npins = npins;
pr->ps_flags |= PS_LIBCPIN; pr->ps_flags |= PS_LIBCPIN;
#ifdef PMAP_CHECK_COPYIN
/* Assume (and insist) on libc.so text being execute-only */
if (PMAP_CHECK_COPYIN)
uvm_map_check_copyin_add(map, base, base+len);
#endif
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aspa.c,v 1.28 2024/02/21 09:17:06 tb Exp $ */ /* $OpenBSD: aspa.c,v 1.29 2024/04/05 16:05:15 job Exp $ */
/* /*
* Copyright (c) 2022 Job Snijders <job@fastly.com> * Copyright (c) 2022 Job Snijders <job@fastly.com>
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org> * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@ -322,7 +322,8 @@ insert_vap(struct vap *v, uint32_t idx, uint32_t *p)
* Duplicated entries are merged. * Duplicated entries are merged.
*/ */
void void
aspa_insert_vaps(struct vap_tree *tree, struct aspa *aspa, struct repo *rp) aspa_insert_vaps(char *fn, struct vap_tree *tree, struct aspa *aspa,
struct repo *rp)
{ {
struct vap *v, *found; struct vap *v, *found;
size_t i, j; size_t i, j;
@ -338,6 +339,10 @@ aspa_insert_vaps(struct vap_tree *tree, struct aspa *aspa, struct repo *rp)
v->expires = aspa->expires; v->expires = aspa->expires;
if ((found = RB_INSERT(vap_tree, tree, v)) != NULL) { if ((found = RB_INSERT(vap_tree, tree, v)) != NULL) {
if (found->invalid) {
free(v);
return;
}
if (found->expires > v->expires) { if (found->expires > v->expires) {
/* decrement found */ /* decrement found */
repo_stat_inc(repo_byid(found->repoid), found->talid, repo_stat_inc(repo_byid(found->repoid), found->talid,
@ -352,6 +357,14 @@ aspa_insert_vaps(struct vap_tree *tree, struct aspa *aspa, struct repo *rp)
} else } else
repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_UNIQUE); repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_UNIQUE);
if (v->providersz >= MAX_ASPA_PROVIDERS) {
v->invalid = 1;
repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_INVALID);
warnx("%s: too many providers for ASPA Customer ASID "
"(more than %d)", fn, MAX_ASPA_PROVIDERS);
return;
}
repo_stat_inc(rp, aspa->talid, RTYPE_ASPA, STYPE_TOTAL); repo_stat_inc(rp, aspa->talid, RTYPE_ASPA, STYPE_TOTAL);
v->providers = reallocarray(v->providers, v->providers = reallocarray(v->providers,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: extern.h,v 1.213 2024/03/22 03:38:12 job Exp $ */ /* $OpenBSD: extern.h,v 1.214 2024/04/05 16:05:15 job Exp $ */
/* /*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* *
@ -403,6 +403,7 @@ struct vap {
time_t expires; time_t expires;
int talid; int talid;
unsigned int repoid; unsigned int repoid;
int invalid;
}; };
/* /*
@ -710,7 +711,7 @@ struct tak *tak_parse(X509 **, const char *, int, const unsigned char *,
void aspa_buffer(struct ibuf *, const struct aspa *); void aspa_buffer(struct ibuf *, const struct aspa *);
void aspa_free(struct aspa *); void aspa_free(struct aspa *);
void aspa_insert_vaps(struct vap_tree *, struct aspa *, void aspa_insert_vaps(char *, struct vap_tree *, struct aspa *,
struct repo *); struct repo *);
struct aspa *aspa_parse(X509 **, const char *, int, const unsigned char *, struct aspa *aspa_parse(X509 **, const char *, int, const unsigned char *,
size_t); size_t);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.255 2024/03/22 03:38:12 job Exp $ */ /* $OpenBSD: main.c,v 1.256 2024/04/05 16:05:15 job Exp $ */
/* /*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -664,7 +664,7 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
} }
aspa = aspa_read(b); aspa = aspa_read(b);
if (aspa->valid) if (aspa->valid)
aspa_insert_vaps(vaptree, aspa, rp); aspa_insert_vaps(file, vaptree, aspa, rp);
else else
repo_stat_inc(rp, talid, type, STYPE_INVALID); repo_stat_inc(rp, talid, type, STYPE_INVALID);
aspa_free(aspa); aspa_free(aspa);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: output-bgpd.c,v 1.29 2024/02/22 12:49:42 job Exp $ */ /* $OpenBSD: output-bgpd.c,v 1.30 2024/04/05 16:05:15 job Exp $ */
/* /*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* *
@ -58,6 +58,8 @@ output_bgpd(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
if (fprintf(out, "\naspa-set {\n") < 0) if (fprintf(out, "\naspa-set {\n") < 0)
return -1; return -1;
RB_FOREACH(vap, vap_tree, vaps) { RB_FOREACH(vap, vap_tree, vaps) {
if (vap->invalid)
continue;
if (fprintf(out, "\tcustomer-as %d expires %lld " if (fprintf(out, "\tcustomer-as %d expires %lld "
"provider-as { ", vap->custasid, "provider-as { ", vap->custasid,
(long long)vap->expires) < 0) (long long)vap->expires) < 0)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: output-json.c,v 1.46 2024/03/01 08:10:09 tb Exp $ */ /* $OpenBSD: output-json.c,v 1.47 2024/04/05 16:05:15 job Exp $ */
/* /*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* *
@ -93,6 +93,9 @@ print_vap(struct vap *v)
{ {
size_t i; size_t i;
if (v->invalid)
return;
json_do_object("aspa", 1); json_do_object("aspa", 1);
json_do_int("customer_asid", v->custasid); json_do_int("customer_asid", v->custasid);
json_do_int("expires", v->expires); json_do_int("expires", v->expires);