sync with OpenBSD -current
This commit is contained in:
parent
d875ef6d7b
commit
467ab94ea3
@ -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
|
||||
@ -34,9 +34,7 @@
|
||||
#endif
|
||||
|
||||
char *
|
||||
bpf_image(p, n)
|
||||
const struct bpf_insn *p;
|
||||
int n;
|
||||
bpf_image(const struct bpf_insn *p, int n)
|
||||
{
|
||||
int v;
|
||||
char *fmt, *op;
|
||||
|
@ -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
|
||||
@ -40,8 +40,7 @@ static __inline int skip_line(FILE *);
|
||||
|
||||
/* Hex digit to integer. */
|
||||
static __inline int
|
||||
xdtoi(c)
|
||||
int c;
|
||||
xdtoi(int c)
|
||||
{
|
||||
if (isdigit(c))
|
||||
return c - '0';
|
||||
@ -52,8 +51,7 @@ xdtoi(c)
|
||||
}
|
||||
|
||||
static __inline int
|
||||
skip_space(f)
|
||||
FILE *f;
|
||||
skip_space(FILE *f)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -65,8 +63,7 @@ skip_space(f)
|
||||
}
|
||||
|
||||
static __inline int
|
||||
skip_line(f)
|
||||
FILE *f;
|
||||
skip_line(FILE *f)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -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
|
||||
@ -220,8 +220,7 @@ freechunks(void)
|
||||
* A strdup whose allocations are freed after code generation is over.
|
||||
*/
|
||||
char *
|
||||
sdup(s)
|
||||
const char *s;
|
||||
sdup(const char *s)
|
||||
{
|
||||
int n = strlen(s) + 1;
|
||||
char *cp = newchunk(n);
|
||||
@ -231,8 +230,7 @@ sdup(s)
|
||||
}
|
||||
|
||||
static __inline struct block *
|
||||
new_block(code)
|
||||
int code;
|
||||
new_block(int code)
|
||||
{
|
||||
struct block *p;
|
||||
|
||||
@ -244,8 +242,7 @@ new_block(code)
|
||||
}
|
||||
|
||||
static __inline struct slist *
|
||||
new_stmt(code)
|
||||
int code;
|
||||
new_stmt(int code)
|
||||
{
|
||||
struct slist *p;
|
||||
|
||||
@ -256,8 +253,7 @@ new_stmt(code)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_retblk(v)
|
||||
int v;
|
||||
gen_retblk(int v)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
static void
|
||||
backpatch(list, target)
|
||||
struct block *list, *target;
|
||||
backpatch(struct block *list, struct block *target)
|
||||
{
|
||||
struct block *next;
|
||||
|
||||
@ -408,8 +403,7 @@ backpatch(list, target)
|
||||
* which of jt and jf is the link.
|
||||
*/
|
||||
static void
|
||||
merge(b0, b1)
|
||||
struct block *b0, *b1;
|
||||
merge(struct block *b0, struct block *b1)
|
||||
{
|
||||
struct block **p = &b0;
|
||||
|
||||
@ -422,8 +416,7 @@ merge(b0, b1)
|
||||
}
|
||||
|
||||
void
|
||||
finish_parse(p)
|
||||
struct block *p;
|
||||
finish_parse(struct block *p)
|
||||
{
|
||||
backpatch(p, gen_retblk(snaplen));
|
||||
p->sense = !p->sense;
|
||||
@ -448,8 +441,7 @@ finish_parse(p)
|
||||
}
|
||||
|
||||
void
|
||||
gen_and(b0, b1)
|
||||
struct block *b0, *b1;
|
||||
gen_and(struct block *b0, struct block *b1)
|
||||
{
|
||||
backpatch(b0, b1->head);
|
||||
b0->sense = !b0->sense;
|
||||
@ -460,8 +452,7 @@ gen_and(b0, b1)
|
||||
}
|
||||
|
||||
void
|
||||
gen_or(b0, b1)
|
||||
struct block *b0, *b1;
|
||||
gen_or(struct block *b0, struct block *b1)
|
||||
{
|
||||
b0->sense = !b0->sense;
|
||||
backpatch(b0, b1->head);
|
||||
@ -471,16 +462,13 @@ gen_or(b0, b1)
|
||||
}
|
||||
|
||||
void
|
||||
gen_not(b)
|
||||
struct block *b;
|
||||
gen_not(struct block *b)
|
||||
{
|
||||
b->sense = !b->sense;
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_cmp(offset, size, v)
|
||||
u_int offset, size;
|
||||
bpf_int32 v;
|
||||
gen_cmp(u_int offset, u_int size, bpf_int32 v)
|
||||
{
|
||||
struct slist *s;
|
||||
struct block *b;
|
||||
@ -496,9 +484,7 @@ gen_cmp(offset, size, v)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_cmp_gt(offset, size, v)
|
||||
u_int offset, size;
|
||||
bpf_int32 v;
|
||||
gen_cmp_gt(u_int offset, u_int size, bpf_int32 v)
|
||||
{
|
||||
struct slist *s;
|
||||
struct block *b;
|
||||
@ -514,10 +500,7 @@ gen_cmp_gt(offset, size, v)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_mcmp(offset, size, v, mask)
|
||||
u_int offset, size;
|
||||
bpf_int32 v;
|
||||
bpf_u_int32 mask;
|
||||
gen_mcmp(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask)
|
||||
{
|
||||
struct block *b = gen_cmp(offset, size, v);
|
||||
struct slist *s;
|
||||
@ -532,10 +515,7 @@ gen_mcmp(offset, size, v, mask)
|
||||
|
||||
/* Like gen_mcmp with 'dynamic off_nl' added to the offset */
|
||||
static struct block *
|
||||
gen_mcmp_nl(offset, size, v, mask)
|
||||
u_int offset, size;
|
||||
bpf_int32 v;
|
||||
bpf_u_int32 mask;
|
||||
gen_mcmp_nl(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask)
|
||||
{
|
||||
struct block *b = gen_cmp_nl(offset, size, v);
|
||||
struct slist *s;
|
||||
@ -549,9 +529,7 @@ gen_mcmp_nl(offset, size, v, mask)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_bcmp(offset, size, v)
|
||||
u_int offset, size;
|
||||
const u_char *v;
|
||||
gen_bcmp(u_int offset, u_int size, const u_char *v)
|
||||
{
|
||||
struct block *b, *tmp;
|
||||
|
||||
@ -645,9 +623,7 @@ nl2X_stmt(void)
|
||||
|
||||
/* Like gen_cmp but adds the dynamic 'off_nl' to the offset */
|
||||
static struct block *
|
||||
gen_cmp_nl(offset, size, v)
|
||||
u_int offset, size;
|
||||
bpf_int32 v;
|
||||
gen_cmp_nl(u_int offset, u_int size, bpf_int32 v)
|
||||
{
|
||||
struct slist *s, *tmp;
|
||||
struct block *b;
|
||||
@ -669,8 +645,7 @@ gen_cmp_nl(offset, size, v)
|
||||
}
|
||||
|
||||
static void
|
||||
init_linktype(type)
|
||||
int type;
|
||||
init_linktype(int type)
|
||||
{
|
||||
linktype = type;
|
||||
init_code = NULL;
|
||||
@ -806,8 +781,7 @@ init_linktype(type)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_uncond(rsense)
|
||||
int rsense;
|
||||
gen_uncond(int rsense)
|
||||
{
|
||||
struct block *b;
|
||||
struct slist *s;
|
||||
@ -833,8 +807,7 @@ gen_false()
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_linktype(proto)
|
||||
int proto;
|
||||
gen_linktype(int proto)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -956,11 +929,8 @@ gen_linktype(proto)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_hostop(addr, mask, dir, proto, src_off, dst_off)
|
||||
bpf_u_int32 addr;
|
||||
bpf_u_int32 mask;
|
||||
int dir, proto;
|
||||
u_int src_off, dst_off;
|
||||
gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir, int proto,
|
||||
u_int src_off, u_int dst_off)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
u_int offset;
|
||||
@ -1000,11 +970,8 @@ gen_hostop(addr, mask, dir, proto, src_off, dst_off)
|
||||
|
||||
#ifdef INET6
|
||||
static struct block *
|
||||
gen_hostop6(addr, mask, dir, proto, src_off, dst_off)
|
||||
struct in6_addr *addr;
|
||||
struct in6_addr *mask;
|
||||
int dir, proto;
|
||||
u_int src_off, dst_off;
|
||||
gen_hostop6(struct in6_addr *addr, struct in6_addr *mask, int dir, int proto,
|
||||
u_int src_off, u_int dst_off)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
u_int offset;
|
||||
@ -1054,9 +1021,7 @@ gen_hostop6(addr, mask, dir, proto, src_off, dst_off)
|
||||
#endif /*INET6*/
|
||||
|
||||
static struct block *
|
||||
gen_ehostop(eaddr, dir)
|
||||
const u_char *eaddr;
|
||||
int dir;
|
||||
gen_ehostop(const u_char *eaddr, int dir)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -1090,9 +1055,7 @@ gen_ehostop(eaddr, dir)
|
||||
* Like gen_ehostop, but for DLT_FDDI
|
||||
*/
|
||||
static struct block *
|
||||
gen_fhostop(eaddr, dir)
|
||||
const u_char *eaddr;
|
||||
int dir;
|
||||
gen_fhostop(const u_char *eaddr, int dir)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -1149,10 +1112,7 @@ gen_fhostop(eaddr, dir)
|
||||
* and not generate masking instructions if the mask is 0xFFFF.
|
||||
*/
|
||||
static struct block *
|
||||
gen_dnhostop(addr, dir, base_off)
|
||||
bpf_u_int32 addr;
|
||||
int dir;
|
||||
u_int base_off;
|
||||
gen_dnhostop(bpf_u_int32 addr, int dir, u_int base_off)
|
||||
{
|
||||
struct block *b0, *b1, *b2, *tmp;
|
||||
u_int offset_lh; /* offset if long header is received */
|
||||
@ -1220,11 +1180,7 @@ gen_dnhostop(addr, dir, base_off)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_host(addr, mask, proto, dir)
|
||||
bpf_u_int32 addr;
|
||||
bpf_u_int32 mask;
|
||||
int proto;
|
||||
int dir;
|
||||
gen_host(bpf_u_int32 addr, bpf_u_int32 mask, int proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -1312,11 +1268,7 @@ gen_host(addr, mask, proto, dir)
|
||||
|
||||
#ifdef INET6
|
||||
static struct block *
|
||||
gen_host6(addr, mask, proto, dir)
|
||||
struct in6_addr *addr;
|
||||
struct in6_addr *mask;
|
||||
int proto;
|
||||
int dir;
|
||||
gen_host6(struct in6_addr *addr, struct in6_addr *mask, int proto, int dir)
|
||||
{
|
||||
switch (proto) {
|
||||
|
||||
@ -1433,8 +1385,7 @@ gen_gateway(eaddr, alist, proto, dir)
|
||||
#endif /*INET6*/
|
||||
|
||||
struct block *
|
||||
gen_proto_abbrev(proto)
|
||||
int proto;
|
||||
gen_proto_abbrev(int proto)
|
||||
{
|
||||
struct block *b0 = NULL, *b1;
|
||||
|
||||
@ -1648,9 +1599,7 @@ iphl_to_x(void)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_portatom(off, v)
|
||||
int off;
|
||||
bpf_int32 v;
|
||||
gen_portatom(int off, bpf_int32 v)
|
||||
{
|
||||
struct slist *s, *tmp;
|
||||
struct block *b;
|
||||
@ -1670,17 +1619,14 @@ gen_portatom(off, v)
|
||||
|
||||
#ifdef INET6
|
||||
static struct block *
|
||||
gen_portatom6(off, v)
|
||||
int off;
|
||||
bpf_int32 v;
|
||||
gen_portatom6(int off, bpf_int32 v)
|
||||
{
|
||||
return gen_cmp_nl(40 + off, BPF_H, v);
|
||||
}
|
||||
#endif/*INET6*/
|
||||
|
||||
struct block *
|
||||
gen_portop(port, proto, dir)
|
||||
int port, proto, dir;
|
||||
gen_portop(int port, int proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1, *tmp;
|
||||
|
||||
@ -1720,10 +1666,7 @@ gen_portop(port, proto, dir)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_port(port, ip_proto, dir)
|
||||
int port;
|
||||
int ip_proto;
|
||||
int dir;
|
||||
gen_port(int port, int ip_proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1, *tmp;
|
||||
|
||||
@ -1751,8 +1694,7 @@ gen_port(port, ip_proto, dir)
|
||||
|
||||
#ifdef INET6
|
||||
struct block *
|
||||
gen_portop6(port, proto, dir)
|
||||
int port, proto, dir;
|
||||
gen_portop6(int port, int proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1, *tmp;
|
||||
|
||||
@ -1790,10 +1732,7 @@ gen_portop6(port, proto, dir)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_port6(port, ip_proto, dir)
|
||||
int port;
|
||||
int ip_proto;
|
||||
int dir;
|
||||
gen_port6(int port, int ip_proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1, *tmp;
|
||||
|
||||
@ -1821,9 +1760,7 @@ gen_port6(port, ip_proto, dir)
|
||||
#endif /* INET6 */
|
||||
|
||||
static int
|
||||
lookup_proto(name, proto)
|
||||
const char *name;
|
||||
int proto;
|
||||
lookup_proto(const char *name, int proto)
|
||||
{
|
||||
int v;
|
||||
|
||||
@ -1854,10 +1791,7 @@ lookup_proto(name, proto)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_protochain(v, proto, dir)
|
||||
int v;
|
||||
int proto;
|
||||
int dir;
|
||||
gen_protochain(int v, int proto, int dir)
|
||||
{
|
||||
struct block *b0, *b;
|
||||
struct slist *s[100];
|
||||
@ -2151,10 +2085,7 @@ gen_protochain(v, proto, dir)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_proto(v, proto, dir)
|
||||
int v;
|
||||
int proto;
|
||||
int dir;
|
||||
gen_proto(int v, int proto, int dir)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -2273,9 +2204,7 @@ gen_proto(v, proto, dir)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_scode(name, q)
|
||||
const char *name;
|
||||
struct qual q;
|
||||
gen_scode(const char *name, struct qual q)
|
||||
{
|
||||
int proto = q.proto;
|
||||
int dir = q.dir;
|
||||
@ -2479,10 +2408,7 @@ gen_scode(name, q)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_mcode(s1, s2, masklen, q)
|
||||
const char *s1, *s2;
|
||||
int masklen;
|
||||
struct qual q;
|
||||
gen_mcode(const char *s1, const char *s2, int masklen, struct qual q)
|
||||
{
|
||||
int nlen, mlen;
|
||||
bpf_u_int32 n, m;
|
||||
@ -2520,10 +2446,7 @@ gen_mcode(s1, s2, masklen, q)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_ncode(s, v, q)
|
||||
const char *s;
|
||||
bpf_u_int32 v;
|
||||
struct qual q;
|
||||
gen_ncode(const char *s, bpf_u_int32 v, struct qual q)
|
||||
{
|
||||
bpf_u_int32 mask;
|
||||
int proto = q.proto;
|
||||
@ -2606,10 +2529,7 @@ gen_ncode(s, v, q)
|
||||
|
||||
#ifdef INET6
|
||||
struct block *
|
||||
gen_mcode6(s1, s2, masklen, q)
|
||||
const char *s1, *s2;
|
||||
int masklen;
|
||||
struct qual q;
|
||||
gen_mcode6(const char *s1, const char *s2, int masklen, struct qual q)
|
||||
{
|
||||
struct addrinfo *res;
|
||||
struct in6_addr *addr;
|
||||
@ -2664,9 +2584,7 @@ gen_mcode6(s1, s2, masklen, q)
|
||||
#endif /*INET6*/
|
||||
|
||||
struct block *
|
||||
gen_ecode(eaddr, q)
|
||||
const u_char *eaddr;
|
||||
struct qual q;
|
||||
gen_ecode(const u_char *eaddr, struct qual q)
|
||||
{
|
||||
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
|
||||
if (linktype == DLT_EN10MB)
|
||||
@ -2682,8 +2600,7 @@ gen_ecode(eaddr, q)
|
||||
}
|
||||
|
||||
void
|
||||
sappend(s0, s1)
|
||||
struct slist *s0, *s1;
|
||||
sappend(struct slist *s0, struct slist *s1)
|
||||
{
|
||||
/*
|
||||
* This is definitely not the best way to do this, but the
|
||||
@ -2695,8 +2612,7 @@ sappend(s0, s1)
|
||||
}
|
||||
|
||||
static struct slist *
|
||||
xfer_to_x(a)
|
||||
struct arth *a;
|
||||
xfer_to_x(struct arth *a)
|
||||
{
|
||||
struct slist *s;
|
||||
|
||||
@ -2706,8 +2622,7 @@ xfer_to_x(a)
|
||||
}
|
||||
|
||||
static struct slist *
|
||||
xfer_to_a(a)
|
||||
struct arth *a;
|
||||
xfer_to_a(struct arth *a)
|
||||
{
|
||||
struct slist *s;
|
||||
|
||||
@ -2717,10 +2632,7 @@ xfer_to_a(a)
|
||||
}
|
||||
|
||||
struct arth *
|
||||
gen_load(proto, index, size)
|
||||
int proto;
|
||||
struct arth *index;
|
||||
int size;
|
||||
gen_load(int proto, struct arth *index, int size)
|
||||
{
|
||||
struct slist *s, *tmp;
|
||||
struct block *b;
|
||||
@ -2824,10 +2736,7 @@ gen_load(proto, index, size)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_relation(code, a0, a1, reversed)
|
||||
int code;
|
||||
struct arth *a0, *a1;
|
||||
int reversed;
|
||||
gen_relation(int code, struct arth *a0, struct arth *a1, int reversed)
|
||||
{
|
||||
struct slist *s0, *s1, *s2;
|
||||
struct block *b, *tmp;
|
||||
@ -2902,8 +2811,7 @@ gen_loadrnd()
|
||||
}
|
||||
|
||||
struct arth *
|
||||
gen_loadi(val)
|
||||
int val;
|
||||
gen_loadi(int val)
|
||||
{
|
||||
struct arth *a;
|
||||
struct slist *s;
|
||||
@ -2924,8 +2832,7 @@ gen_loadi(val)
|
||||
}
|
||||
|
||||
struct arth *
|
||||
gen_neg(a)
|
||||
struct arth *a;
|
||||
gen_neg(struct arth *a)
|
||||
{
|
||||
struct slist *s;
|
||||
|
||||
@ -2942,9 +2849,7 @@ gen_neg(a)
|
||||
}
|
||||
|
||||
struct arth *
|
||||
gen_arth(code, a0, a1)
|
||||
int code;
|
||||
struct arth *a0, *a1;
|
||||
gen_arth(int code, struct arth *a0, struct arth *a1)
|
||||
{
|
||||
struct slist *s0, *s1, *s2;
|
||||
|
||||
@ -2998,15 +2903,13 @@ alloc_reg()
|
||||
* be used later.
|
||||
*/
|
||||
static void
|
||||
free_reg(n)
|
||||
int n;
|
||||
free_reg(int n)
|
||||
{
|
||||
regused[n] = 0;
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_len(jmp, n)
|
||||
int jmp, n;
|
||||
gen_len(int jmp, int n)
|
||||
{
|
||||
struct slist *s;
|
||||
struct block *b;
|
||||
@ -3020,15 +2923,13 @@ gen_len(jmp, n)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_greater(n)
|
||||
int n;
|
||||
gen_greater(int n)
|
||||
{
|
||||
return gen_len(BPF_JGE, n);
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_less(n)
|
||||
int n;
|
||||
gen_less(int n)
|
||||
{
|
||||
struct block *b;
|
||||
|
||||
@ -3039,8 +2940,7 @@ gen_less(n)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_byteop(op, idx, val)
|
||||
int op, idx, val;
|
||||
gen_byteop(int op, int idx, int val)
|
||||
{
|
||||
struct block *b;
|
||||
struct slist *s;
|
||||
@ -3080,8 +2980,7 @@ gen_byteop(op, idx, val)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_broadcast(proto)
|
||||
int proto;
|
||||
gen_broadcast(int proto)
|
||||
{
|
||||
bpf_u_int32 hostmask;
|
||||
struct block *b0, *b1, *b2;
|
||||
@ -3122,8 +3021,7 @@ gen_broadcast(proto)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_multicast(proto)
|
||||
int proto;
|
||||
gen_multicast(int proto)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
struct slist *s;
|
||||
@ -3179,8 +3077,7 @@ gen_multicast(proto)
|
||||
* = 1 implies "outbound".
|
||||
*/
|
||||
struct block *
|
||||
gen_inbound(dir)
|
||||
int dir;
|
||||
gen_inbound(int dir)
|
||||
{
|
||||
struct block *b0;
|
||||
|
||||
@ -3348,9 +3245,7 @@ gen_p80211_type(int type, int mask)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
gen_ahostop(eaddr, dir)
|
||||
const u_char *eaddr;
|
||||
int dir;
|
||||
gen_ahostop(const u_char *eaddr, int dir)
|
||||
{
|
||||
struct block *b0, *b1;
|
||||
|
||||
@ -3380,9 +3275,7 @@ gen_ahostop(eaddr, dir)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_acode(eaddr, q)
|
||||
const u_char *eaddr;
|
||||
struct qual q;
|
||||
gen_acode(const u_char *eaddr, struct qual q)
|
||||
{
|
||||
if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) {
|
||||
if (linktype == DLT_ARCNET)
|
||||
@ -3393,8 +3286,7 @@ gen_acode(eaddr, q)
|
||||
}
|
||||
|
||||
struct block *
|
||||
gen_mpls(label)
|
||||
int label;
|
||||
gen_mpls(int label)
|
||||
{
|
||||
struct block *b0;
|
||||
|
||||
@ -3424,8 +3316,7 @@ gen_mpls(label)
|
||||
* support IEEE 802.1Q VLAN trunk over ethernet
|
||||
*/
|
||||
struct block *
|
||||
gen_vlan(vlan_num)
|
||||
int vlan_num;
|
||||
gen_vlan(int vlan_num)
|
||||
{
|
||||
struct block *b0;
|
||||
|
||||
|
@ -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
|
||||
@ -109,8 +109,7 @@ pcap_freealldevs(pcap_if_t *alldevs)
|
||||
* lowest unit number is preferred; loopback is ignored.
|
||||
*/
|
||||
char *
|
||||
pcap_lookupdev(errbuf)
|
||||
char *errbuf;
|
||||
pcap_lookupdev(char *errbuf)
|
||||
{
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
struct ifaddrs *ifap, *ifa, *mp;
|
||||
|
@ -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
|
||||
@ -255,8 +255,7 @@ pcap_nametollc(const char *s)
|
||||
|
||||
/* Hex digit to integer. */
|
||||
static __inline int
|
||||
xdtoi(c)
|
||||
int c;
|
||||
xdtoi(int c)
|
||||
{
|
||||
if (isdigit(c))
|
||||
return c - '0';
|
||||
|
@ -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
|
||||
@ -199,8 +199,7 @@ static uset all_edge_sets;
|
||||
#endif
|
||||
|
||||
static void
|
||||
find_levels_r(b)
|
||||
struct block *b;
|
||||
find_levels_r(struct block *b)
|
||||
{
|
||||
int level;
|
||||
|
||||
@ -228,8 +227,7 @@ find_levels_r(b)
|
||||
* with the 'link' field of the struct block.
|
||||
*/
|
||||
static void
|
||||
find_levels(root)
|
||||
struct block *root;
|
||||
find_levels(struct block *root)
|
||||
{
|
||||
memset((char *)levels, 0, n_blocks * sizeof(*levels));
|
||||
unMarkAll();
|
||||
@ -241,8 +239,7 @@ find_levels(root)
|
||||
* Assumes graph has been leveled.
|
||||
*/
|
||||
static void
|
||||
find_dom(root)
|
||||
struct block *root;
|
||||
find_dom(struct block *root)
|
||||
{
|
||||
int i;
|
||||
struct block *b;
|
||||
@ -272,8 +269,7 @@ find_dom(root)
|
||||
}
|
||||
|
||||
static void
|
||||
propedom(ep)
|
||||
struct edge *ep;
|
||||
propedom(struct edge *ep)
|
||||
{
|
||||
SET_INSERT(ep->edom, ep->id);
|
||||
if (ep->succ) {
|
||||
@ -287,8 +283,7 @@ propedom(ep)
|
||||
* Assumes graph has been leveled and predecessors established.
|
||||
*/
|
||||
static void
|
||||
find_edom(root)
|
||||
struct block *root;
|
||||
find_edom(struct block *root)
|
||||
{
|
||||
int i;
|
||||
uset x;
|
||||
@ -317,8 +312,7 @@ find_edom(root)
|
||||
* Assumes graph has been leveled.
|
||||
*/
|
||||
static void
|
||||
find_closure(root)
|
||||
struct block *root;
|
||||
find_closure(struct block *root)
|
||||
{
|
||||
int i;
|
||||
struct block *b;
|
||||
@ -348,8 +342,7 @@ find_closure(root)
|
||||
* The implementation should probably change to an array access.
|
||||
*/
|
||||
static int
|
||||
atomuse(s)
|
||||
struct stmt *s;
|
||||
atomuse(struct stmt *s)
|
||||
{
|
||||
int c = s->code;
|
||||
|
||||
@ -394,8 +387,7 @@ atomuse(s)
|
||||
* The implementation should probably change to an array access.
|
||||
*/
|
||||
static int
|
||||
atomdef(s)
|
||||
struct stmt *s;
|
||||
atomdef(struct stmt *s)
|
||||
{
|
||||
if (s->code == NOP)
|
||||
return -1;
|
||||
@ -420,8 +412,7 @@ atomdef(s)
|
||||
}
|
||||
|
||||
static void
|
||||
compute_local_ud(b)
|
||||
struct block *b;
|
||||
compute_local_ud(struct block *b)
|
||||
{
|
||||
struct slist *s;
|
||||
atomset def = 0, use = 0, kill = 0;
|
||||
@ -464,8 +455,7 @@ compute_local_ud(b)
|
||||
* Assume graph is already leveled.
|
||||
*/
|
||||
static void
|
||||
find_ud(root)
|
||||
struct block *root;
|
||||
find_ud(struct block *root)
|
||||
{
|
||||
int i, maxlevel;
|
||||
struct block *p;
|
||||
@ -530,9 +520,7 @@ init_val()
|
||||
|
||||
/* Because we really don't have an IR, this stuff is a little messy. */
|
||||
static int
|
||||
F(code, v0, v1)
|
||||
int code;
|
||||
int v0, v1;
|
||||
F(int code, int v0, int v1)
|
||||
{
|
||||
u_int hash;
|
||||
int val;
|
||||
@ -563,11 +551,7 @@ F(code, v0, v1)
|
||||
}
|
||||
|
||||
static __inline void
|
||||
vstore(s, valp, newval, alter)
|
||||
struct stmt *s;
|
||||
int *valp;
|
||||
int newval;
|
||||
int alter;
|
||||
vstore(struct stmt *s, int *valp, int newval, int alter)
|
||||
{
|
||||
if (alter && *valp == newval)
|
||||
s->code = NOP;
|
||||
@ -576,9 +560,7 @@ vstore(s, valp, newval, alter)
|
||||
}
|
||||
|
||||
static void
|
||||
fold_op(s, v0, v1)
|
||||
struct stmt *s;
|
||||
int v0, v1;
|
||||
fold_op(struct stmt *s, int v0, int v1)
|
||||
{
|
||||
bpf_int32 a, b;
|
||||
|
||||
@ -633,8 +615,7 @@ fold_op(s, v0, v1)
|
||||
}
|
||||
|
||||
static __inline struct slist *
|
||||
this_op(s)
|
||||
struct slist *s;
|
||||
this_op(struct slist *s)
|
||||
{
|
||||
while (s != 0 && s->s.code == NOP)
|
||||
s = s->next;
|
||||
@ -642,8 +623,7 @@ this_op(s)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_not(b)
|
||||
struct block *b;
|
||||
opt_not(struct block *b)
|
||||
{
|
||||
struct block *tmp = JT(b);
|
||||
|
||||
@ -652,8 +632,7 @@ opt_not(b)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_peep(b)
|
||||
struct block *b;
|
||||
opt_peep(struct block *b)
|
||||
{
|
||||
struct slist *s;
|
||||
struct slist *next, *last;
|
||||
@ -861,10 +840,7 @@ opt_peep(b)
|
||||
* evaluation and code transformations weren't folded together.
|
||||
*/
|
||||
static void
|
||||
opt_stmt(s, val, alter)
|
||||
struct stmt *s;
|
||||
int val[];
|
||||
int alter;
|
||||
opt_stmt(struct stmt *s, int val[], int alter)
|
||||
{
|
||||
int op;
|
||||
int v;
|
||||
@ -1048,9 +1024,7 @@ opt_stmt(s, val, alter)
|
||||
}
|
||||
|
||||
static void
|
||||
deadstmt(s, last)
|
||||
struct stmt *s;
|
||||
struct stmt *last[];
|
||||
deadstmt(struct stmt *s, struct stmt *last[])
|
||||
{
|
||||
int atom;
|
||||
|
||||
@ -1074,8 +1048,7 @@ deadstmt(s, last)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_deadstores(b)
|
||||
struct block *b;
|
||||
opt_deadstores(struct block *b)
|
||||
{
|
||||
struct slist *s;
|
||||
int atom;
|
||||
@ -1095,9 +1068,7 @@ opt_deadstores(b)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_blk(b, do_stmts)
|
||||
struct block *b;
|
||||
int do_stmts;
|
||||
opt_blk(struct block *b, int do_stmts)
|
||||
{
|
||||
struct slist *s;
|
||||
struct edge *p;
|
||||
@ -1168,8 +1139,7 @@ opt_blk(b, do_stmts)
|
||||
* from 'b'.
|
||||
*/
|
||||
static int
|
||||
use_conflict(b, succ)
|
||||
struct block *b, *succ;
|
||||
use_conflict(struct block *b, struct block *succ)
|
||||
{
|
||||
int atom;
|
||||
atomset use = succ->out_use;
|
||||
@ -1185,9 +1155,7 @@ use_conflict(b, succ)
|
||||
}
|
||||
|
||||
static struct block *
|
||||
fold_edge(child, ep)
|
||||
struct block *child;
|
||||
struct edge *ep;
|
||||
fold_edge(struct block *child, struct edge *ep)
|
||||
{
|
||||
int sense;
|
||||
int aval0, aval1, oval0, oval1;
|
||||
@ -1231,8 +1199,7 @@ fold_edge(child, ep)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_j(ep)
|
||||
struct edge *ep;
|
||||
opt_j(struct edge *ep)
|
||||
{
|
||||
int i, k;
|
||||
struct block *target;
|
||||
@ -1287,8 +1254,7 @@ opt_j(ep)
|
||||
|
||||
|
||||
static void
|
||||
or_pullup(b)
|
||||
struct block *b;
|
||||
or_pullup(struct block *b)
|
||||
{
|
||||
int val, at_top;
|
||||
struct block *pull;
|
||||
@ -1380,8 +1346,7 @@ or_pullup(b)
|
||||
}
|
||||
|
||||
static void
|
||||
and_pullup(b)
|
||||
struct block *b;
|
||||
and_pullup(struct block *b)
|
||||
{
|
||||
int val, at_top;
|
||||
struct block *pull;
|
||||
@ -1472,9 +1437,7 @@ and_pullup(b)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_blks(root, do_stmts)
|
||||
struct block *root;
|
||||
int do_stmts;
|
||||
opt_blks(struct block *root, int do_stmts)
|
||||
{
|
||||
int i, maxlevel;
|
||||
struct block *p;
|
||||
@ -1507,17 +1470,14 @@ opt_blks(root, do_stmts)
|
||||
}
|
||||
|
||||
static __inline void
|
||||
link_inedge(parent, child)
|
||||
struct edge *parent;
|
||||
struct block *child;
|
||||
link_inedge(struct edge *parent, struct block *child)
|
||||
{
|
||||
parent->next = child->in_edges;
|
||||
child->in_edges = parent;
|
||||
}
|
||||
|
||||
static void
|
||||
find_inedges(root)
|
||||
struct block *root;
|
||||
find_inedges(struct block *root)
|
||||
{
|
||||
int i;
|
||||
struct block *b;
|
||||
@ -1538,8 +1498,7 @@ find_inedges(root)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_root(b)
|
||||
struct block **b;
|
||||
opt_root(struct block **b)
|
||||
{
|
||||
struct slist *tmp, *s;
|
||||
|
||||
@ -1563,9 +1522,7 @@ opt_root(b)
|
||||
}
|
||||
|
||||
static void
|
||||
opt_loop(root, do_stmts)
|
||||
struct block *root;
|
||||
int do_stmts;
|
||||
opt_loop(struct block *root, int do_stmts)
|
||||
{
|
||||
|
||||
#ifdef BDEBUG
|
||||
@ -1592,8 +1549,7 @@ opt_loop(root, do_stmts)
|
||||
* Optimize the filter code in its dag representation.
|
||||
*/
|
||||
void
|
||||
bpf_optimize(rootp)
|
||||
struct block **rootp;
|
||||
bpf_optimize(struct block **rootp)
|
||||
{
|
||||
struct block *root;
|
||||
|
||||
@ -1608,8 +1564,7 @@ bpf_optimize(rootp)
|
||||
}
|
||||
|
||||
static void
|
||||
make_marks(p)
|
||||
struct block *p;
|
||||
make_marks(struct block *p)
|
||||
{
|
||||
if (!isMarked(p)) {
|
||||
Mark(p);
|
||||
@ -1625,8 +1580,7 @@ make_marks(p)
|
||||
* only for nodes that are alive.
|
||||
*/
|
||||
static void
|
||||
mark_code(p)
|
||||
struct block *p;
|
||||
mark_code(struct block *p)
|
||||
{
|
||||
cur_mark += 1;
|
||||
make_marks(p);
|
||||
@ -1637,8 +1591,7 @@ mark_code(p)
|
||||
* the accumulator.
|
||||
*/
|
||||
static int
|
||||
eq_slist(x, y)
|
||||
struct slist *x, *y;
|
||||
eq_slist(struct slist *x, struct slist *y)
|
||||
{
|
||||
while (1) {
|
||||
while (x && x->s.code == NOP)
|
||||
@ -1657,8 +1610,7 @@ eq_slist(x, y)
|
||||
}
|
||||
|
||||
static __inline int
|
||||
eq_blk(b0, b1)
|
||||
struct block *b0, *b1;
|
||||
eq_blk(struct block *b0, struct block *b1)
|
||||
{
|
||||
if (b0->s.code == b1->s.code &&
|
||||
b0->s.k == b1->s.k &&
|
||||
@ -1669,8 +1621,7 @@ eq_blk(b0, b1)
|
||||
}
|
||||
|
||||
static void
|
||||
intern_blocks(root)
|
||||
struct block *root;
|
||||
intern_blocks(struct block *root)
|
||||
{
|
||||
struct block *p;
|
||||
int i, j;
|
||||
@ -1728,8 +1679,7 @@ opt_cleanup()
|
||||
* Return the number of stmts in 's'.
|
||||
*/
|
||||
static int
|
||||
slength(s)
|
||||
struct slist *s;
|
||||
slength(struct slist *s)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -1744,8 +1694,7 @@ slength(s)
|
||||
* All nodes should be initially unmarked.
|
||||
*/
|
||||
static int
|
||||
count_blocks(p)
|
||||
struct block *p;
|
||||
count_blocks(struct block *p)
|
||||
{
|
||||
if (p == 0 || isMarked(p))
|
||||
return 0;
|
||||
@ -1758,8 +1707,7 @@ count_blocks(p)
|
||||
* the basic blocks, and entering them into the 'blocks' array.`
|
||||
*/
|
||||
static void
|
||||
number_blks_r(p)
|
||||
struct block *p;
|
||||
number_blks_r(struct block *p)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -1780,8 +1728,7 @@ number_blks_r(p)
|
||||
* The nodes should be unmarked before calling.
|
||||
*/
|
||||
static int
|
||||
count_stmts(p)
|
||||
struct block *p;
|
||||
count_stmts(struct block *p)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -1798,8 +1745,7 @@ count_stmts(p)
|
||||
* from the total number of blocks and/or statements.
|
||||
*/
|
||||
static void
|
||||
opt_init(root)
|
||||
struct block *root;
|
||||
opt_init(struct block *root)
|
||||
{
|
||||
bpf_u_int32 *p;
|
||||
int i, n, max_stmts;
|
||||
@ -1927,8 +1873,7 @@ int bids[1000];
|
||||
* properly.
|
||||
*/
|
||||
static int
|
||||
convert_code_r(p)
|
||||
struct block *p;
|
||||
convert_code_r(struct block *p)
|
||||
{
|
||||
struct bpf_insn *dst;
|
||||
struct slist *src;
|
||||
@ -2086,9 +2031,7 @@ filled:
|
||||
* BPF array representation. Set *lenp to the number of instructions.
|
||||
*/
|
||||
struct bpf_insn *
|
||||
icode_to_fcode(root, lenp)
|
||||
struct block *root;
|
||||
int *lenp;
|
||||
icode_to_fcode(struct block *root, int *lenp)
|
||||
{
|
||||
int n;
|
||||
struct bpf_insn *fp;
|
||||
|
@ -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
|
||||
@ -317,8 +317,7 @@ tcp-urg { yylval.i = 0x20; return NUM; }
|
||||
}
|
||||
%%
|
||||
void
|
||||
lex_init(buf)
|
||||
const char *buf;
|
||||
lex_init(const char *buf)
|
||||
{
|
||||
in_buffer = buf;
|
||||
yyrestart(NULL);
|
||||
@ -336,8 +335,7 @@ yywrap()
|
||||
|
||||
/* Hex digit to integer. */
|
||||
static inline int
|
||||
xdtoi(c)
|
||||
int c;
|
||||
xdtoi(int c)
|
||||
{
|
||||
if (isdigit(c))
|
||||
return c - '0';
|
||||
@ -352,8 +350,7 @@ xdtoi(c)
|
||||
* preceding 0x or 0 and uses hex or octal instead of decimal.
|
||||
*/
|
||||
static int
|
||||
stoi(s)
|
||||
char *s;
|
||||
stoi(char *s)
|
||||
{
|
||||
int base = 10;
|
||||
int n = 0;
|
||||
|
@ -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
|
||||
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
|
||||
|
||||
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 \
|
||||
utrace write
|
||||
|
||||
|
@ -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
|
||||
@ -324,21 +324,10 @@ _dl_tryload_shlib(const char *libname, int type, int flags, int nodelete)
|
||||
}
|
||||
|
||||
libc = _dl_islibc(dynp, loff);
|
||||
if (libc) {
|
||||
if (syscall_phdp)
|
||||
_dl_pin(libfile, syscall_phdp, (void *)libaddr,
|
||||
(size_t)((exec_start + exec_size) - libaddr),
|
||||
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);
|
||||
}
|
||||
if (libc && syscall_phdp)
|
||||
_dl_pin(libfile, syscall_phdp, (void *)libaddr,
|
||||
(size_t)((exec_start + exec_size) - libaddr),
|
||||
exec_start, exec_size);
|
||||
_dl_close(libfile);
|
||||
|
||||
dynp = (Elf_Dyn *)((unsigned long)dynp + loff);
|
||||
|
@ -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
|
||||
@ -332,21 +332,10 @@ retry:
|
||||
}
|
||||
|
||||
libc = _dl_islibc(dynp, LOFF);
|
||||
if (libc) {
|
||||
if (syscall_phdp)
|
||||
_dl_pin(libfile, syscall_phdp, lowld->start,
|
||||
(size_t)((exec_start + exec_size) - LOFF),
|
||||
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);
|
||||
}
|
||||
if (libc && syscall_phdp)
|
||||
_dl_pin(libfile, syscall_phdp, lowld->start,
|
||||
(size_t)((exec_start + exec_size) - LOFF),
|
||||
exec_start, exec_size);
|
||||
_dl_close(libfile);
|
||||
|
||||
dynp = (Elf_Dyn *)((unsigned long)dynp + LOFF);
|
||||
|
@ -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
|
||||
@ -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);
|
||||
int _dl_mprotect(const void *, size_t, int);
|
||||
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_munmap(const void *, size_t);
|
||||
int _dl_mimmutable(const void *, size_t);
|
||||
|
@ -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,
|
||||
unsigned int color_mode)
|
||||
{
|
||||
#ifdef notyet
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
#endif
|
||||
uint32_t bpp, depth;
|
||||
|
||||
switch (color_mode) {
|
||||
|
@ -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, \
|
||||
__func__ , ## arg)
|
||||
#else
|
||||
#define dev_info(dev, fmt, arg...) \
|
||||
do { } while(0)
|
||||
#define dev_info_once(dev, fmt, arg...) \
|
||||
do { } while(0)
|
||||
#define dev_dbg(dev, fmt, arg...) \
|
||||
do { } while(0)
|
||||
#define dev_dbg_once(dev, fmt, arg...) \
|
||||
do { } while(0)
|
||||
#define dev_dbg_ratelimited(dev, fmt, arg...) \
|
||||
do { } while(0)
|
||||
|
||||
static inline void
|
||||
dev_info(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
dev_info_once(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
static inline const char *
|
||||
|
@ -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.
|
||||
*
|
||||
* 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>
|
||||
@ -96,8 +96,8 @@ const struct sysent sysent[] = {
|
||||
sys_fchflags }, /* 35 = fchflags */
|
||||
{ 0, 0, 0,
|
||||
sys_sync }, /* 36 = sync */
|
||||
{ 2, s(struct sys_msyscall_args), 0,
|
||||
sys_msyscall }, /* 37 = msyscall */
|
||||
{ 0, 0, 0,
|
||||
sys_nosys }, /* 37 = obsolete msyscall */
|
||||
{ 2, s(struct sys_stat_args), 0,
|
||||
sys_stat }, /* 38 = stat */
|
||||
{ 0, 0, SY_NOLOCK | 0,
|
||||
|
@ -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>
|
||||
@ -105,7 +105,6 @@ const uint64_t pledge_syscalls[SYS_MAXSYSCALL] = {
|
||||
*/
|
||||
[SYS_exit] = PLEDGE_ALWAYS,
|
||||
[SYS_kbind] = PLEDGE_ALWAYS,
|
||||
[SYS_msyscall] = PLEDGE_ALWAYS,
|
||||
[SYS___get_tcb] = PLEDGE_ALWAYS,
|
||||
[SYS___set_tcb] = PLEDGE_ALWAYS,
|
||||
[SYS_pledge] = PLEDGE_ALWAYS,
|
||||
|
@ -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.
|
||||
*
|
||||
* 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[] = {
|
||||
@ -49,7 +49,7 @@ const char *const syscallnames[] = {
|
||||
"chflags", /* 34 = chflags */
|
||||
"fchflags", /* 35 = fchflags */
|
||||
"sync", /* 36 = sync */
|
||||
"msyscall", /* 37 = msyscall */
|
||||
"#37 (obsolete msyscall)", /* 37 = obsolete msyscall */
|
||||
"stat", /* 38 = stat */
|
||||
"getppid", /* 39 = getppid */
|
||||
"lstat", /* 40 = lstat */
|
||||
|
@ -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 $
|
||||
|
||||
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
||||
@ -103,7 +103,7 @@
|
||||
34 STD { int sys_chflags(const char *path, u_int flags); }
|
||||
35 STD { int sys_fchflags(int fd, u_int flags); }
|
||||
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); }
|
||||
39 STD NOLOCK { pid_t sys_getppid(void); }
|
||||
40 STD { int sys_lstat(const char *path, struct stat *ub); }
|
||||
|
@ -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.
|
||||
*
|
||||
* 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" */
|
||||
@ -115,9 +115,7 @@
|
||||
/* syscall: "sync" ret: "void" args: */
|
||||
#define SYS_sync 36
|
||||
|
||||
/* syscall: "msyscall" ret: "int" args: "void *" "size_t" */
|
||||
#define SYS_msyscall 37
|
||||
|
||||
/* 37 is obsolete msyscall */
|
||||
/* syscall: "stat" ret: "int" args: "const char *" "struct stat *" */
|
||||
#define SYS_stat 38
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
@ -186,11 +186,6 @@ struct sys_fchflags_args {
|
||||
syscallarg(u_int) flags;
|
||||
};
|
||||
|
||||
struct sys_msyscall_args {
|
||||
syscallarg(void *) addr;
|
||||
syscallarg(size_t) len;
|
||||
};
|
||||
|
||||
struct sys_stat_args {
|
||||
syscallarg(const char *) path;
|
||||
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_fchflags(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_getppid(struct proc *, void *, register_t *);
|
||||
int sys_lstat(struct proc *, void *, register_t *);
|
||||
|
@ -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 $ */
|
||||
|
||||
/*
|
||||
@ -586,15 +586,6 @@ sys_mprotect(struct proc *p, void *v, register_t *retval)
|
||||
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
|
||||
* 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;
|
||||
} */ *uap = v;
|
||||
struct process *pr = p->p_p;
|
||||
struct vm_map *map = &p->p_vmspace->vm_map;
|
||||
int npins, error = 0, i;
|
||||
vaddr_t base;
|
||||
size_t len;
|
||||
@ -622,6 +614,8 @@ sys_pinsyscalls(struct proc *p, void *v, register_t *retval)
|
||||
len = (vsize_t)SCARG(uap, len);
|
||||
if (base > SIZE_MAX - len)
|
||||
return (EINVAL); /* disallow wrap-around. */
|
||||
if (base < map->min_offset || base+len > map->max_offset)
|
||||
return (EINVAL);
|
||||
|
||||
/* XXX MP unlock */
|
||||
|
||||
@ -654,6 +648,12 @@ err:
|
||||
pr->ps_libcpin.pn_pins = pins;
|
||||
pr->ps_libcpin.pn_npins = npins;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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 Theo Buehler <tb@openbsd.org>
|
||||
@ -322,7 +322,8 @@ insert_vap(struct vap *v, uint32_t idx, uint32_t *p)
|
||||
* Duplicated entries are merged.
|
||||
*/
|
||||
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;
|
||||
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;
|
||||
|
||||
if ((found = RB_INSERT(vap_tree, tree, v)) != NULL) {
|
||||
if (found->invalid) {
|
||||
free(v);
|
||||
return;
|
||||
}
|
||||
if (found->expires > v->expires) {
|
||||
/* decrement found */
|
||||
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
|
||||
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);
|
||||
|
||||
v->providers = reallocarray(v->providers,
|
||||
|
@ -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>
|
||||
*
|
||||
@ -403,6 +403,7 @@ struct vap {
|
||||
time_t expires;
|
||||
int talid;
|
||||
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_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 aspa *aspa_parse(X509 **, const char *, int, const unsigned char *,
|
||||
size_t);
|
||||
|
@ -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) 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);
|
||||
if (aspa->valid)
|
||||
aspa_insert_vaps(vaptree, aspa, rp);
|
||||
aspa_insert_vaps(file, vaptree, aspa, rp);
|
||||
else
|
||||
repo_stat_inc(rp, talid, type, STYPE_INVALID);
|
||||
aspa_free(aspa);
|
||||
|
@ -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>
|
||||
*
|
||||
@ -58,6 +58,8 @@ output_bgpd(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
|
||||
if (fprintf(out, "\naspa-set {\n") < 0)
|
||||
return -1;
|
||||
RB_FOREACH(vap, vap_tree, vaps) {
|
||||
if (vap->invalid)
|
||||
continue;
|
||||
if (fprintf(out, "\tcustomer-as %d expires %lld "
|
||||
"provider-as { ", vap->custasid,
|
||||
(long long)vap->expires) < 0)
|
||||
|
@ -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>
|
||||
*
|
||||
@ -93,6 +93,9 @@ print_vap(struct vap *v)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (v->invalid)
|
||||
return;
|
||||
|
||||
json_do_object("aspa", 1);
|
||||
json_do_int("customer_asid", v->custasid);
|
||||
json_do_int("expires", v->expires);
|
||||
|
Loading…
Reference in New Issue
Block a user