diff --git a/gnu/llvm/libunwind/src/assembly.h b/gnu/llvm/libunwind/src/assembly.h index fb07d0407..a7091108b 100644 --- a/gnu/llvm/libunwind/src/assembly.h +++ b/gnu/llvm/libunwind/src/assembly.h @@ -15,7 +15,7 @@ #ifndef UNWIND_ASSEMBLY_H #define UNWIND_ASSEMBLY_H -#if defined(__linux__) && defined(__CET__) +#if defined(__CET__) #include #define _LIBUNWIND_CET_ENDBR _CET_ENDBR #else diff --git a/lib/libcrypto/perlasm/x86_64-xlate.pl b/lib/libcrypto/perlasm/x86_64-xlate.pl index c1c00a6ba..8aeee4e38 100755 --- a/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/lib/libcrypto/perlasm/x86_64-xlate.pl @@ -567,7 +567,15 @@ my %globals; $v.="$line\tSEGMENT"; if ($line=~/\.([prx])data/) { $v.=" READONLY"; - $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); + if ($masm>=$masmref) { + if ($1 eq "r") { + $v.=" ALIGN(64)"; + } elsif ($1 eq "p") { + $v.=" ALIGN(4)"; + } else { + $v.=" ALIGN(8)"; + } + } } elsif ($line=~/\.CRT\$/i) { $v.=" READONLY "; $v.=$masm>=$masmref ? "ALIGN(8)" : "DWORD"; diff --git a/regress/sys/btcfi/foobar.c b/regress/sys/btcfi/foobar.c index e521979c5..8ed60c1d8 100644 --- a/regress/sys/btcfi/foobar.c +++ b/regress/sys/btcfi/foobar.c @@ -1,6 +1,8 @@ /* Public domain */ #include +#include +#include #include extern void foo(void); @@ -19,11 +21,30 @@ handler(int sig, siginfo_t *si, void *context) exit(0); } +#if defined(__amd64__) +static int +has_cet_ibt(void) +{ + uint32_t d; + + asm("cpuid" : "=d" (d) : "a" (7), "c" (0)); + return (d & (1U << 20)) ? 1 : 0; +} +#endif + int main(void) { struct sigaction sa; +#if defined(__amd64__) + if (!has_cet_ibt()) { + printf("Unsupported CPU\n"); + printf("SKIPPED\n"); + exit(0); + } +#endif + sa.sa_sigaction = handler; sa.sa_mask = 0; sa.sa_flags = SA_SIGINFO; diff --git a/regress/sys/netinet/in_pcbbind/Makefile b/regress/sys/netinet/in_pcbbind/Makefile index cb35b6cdb..7953d4843 100644 --- a/regress/sys/netinet/in_pcbbind/Makefile +++ b/regress/sys/netinet/in_pcbbind/Makefile @@ -1,22 +1,22 @@ -# $OpenBSD: Makefile,v 1.5 2016/09/05 10:15:24 vgross Exp $ +# $OpenBSD: Makefile,v 1.6 2024/02/27 07:21:07 anton Exp $ PROG = runtest PORT = 23000 IFADDR != route -n show -inet | awk '$$8 !~ "lo0" && $$3 ~ /U.*l/ { print $$1; exit }' IF6ADDR != route -n show -inet6 | awk '$$8 !~ "lo0" && $$3 ~ /U.*l/ && $$1 !~ /^fe80/ { print $$1; exit }' +.if empty(IF6ADDR) +REGRESS_SKIP_TARGETS += run-regress-runtest6 +.endif + +REGRESS_TARGETS += run-regress-runtest4 run-regress-runtest4: ${PROG} ${.OBJDIR}/${PROG} ${IFADDR} ${PORT} ${.OBJDIR}/${PROG} 224.0.2.1 ${PORT} ${IFADDR} -REGRESS_TARGETS += run-regress-runtest4 - -.if ! empty(IF6ADDR) +REGRESS_TARGETS += run-regress-runtest6 run-regress-runtest6: ${PROG} ${.OBJDIR}/${PROG} ${IF6ADDR} ${PORT} ${SUDO} ${.OBJDIR}/${PROG} ff1e::123 ${PORT} ${IF6ADDR} -REGRESS_TARGETS += run-regress-runtest6 -.endif - .include diff --git a/regress/usr.bin/ctfdump/base_types_encoding.amd64 b/regress/usr.bin/ctfdump/base_types_encoding.amd64 index 529a417dd..4fd3a4c5b 100644 --- a/regress/usr.bin/ctfdump/base_types_encoding.amd64 +++ b/regress/usr.bin/ctfdump/base_types_encoding.amd64 @@ -1,7 +1,7 @@ - [] FLOAT float encoding=LDOUBLE offset=0 bits=128 - [] FLOAT float encoding=LDOUBLE offset=0 bits=32 - [] FLOAT float encoding=LDOUBLE offset=0 bits=64 - [] INTEGER char encoding=SIGNED CHAR offset=0 bits=8 - [] INTEGER signed encoding=SIGNED offset=0 bits=32 - [] INTEGER signed encoding=SIGNED offset=0 bits=64 - [] INTEGER void encoding=SIGNED offset=0 bits=0 + [] FLOAT float encoding=LDOUBLE offset=0 bits=128 (16 bytes) + [] FLOAT float encoding=LDOUBLE offset=0 bits=32 (4 bytes) + [] FLOAT float encoding=LDOUBLE offset=0 bits=64 (8 bytes) + [] INTEGER char encoding=SIGNED CHAR offset=0 bits=8 (1 bytes) + [] INTEGER signed encoding=SIGNED offset=0 bits=32 (4 bytes) + [] INTEGER signed encoding=SIGNED offset=0 bits=64 (8 bytes) + [] INTEGER void encoding=SIGNED offset=0 bits=0 (0 bytes) diff --git a/regress/usr.bin/ctfdump/base_types_encoding.i386 b/regress/usr.bin/ctfdump/base_types_encoding.i386 index eb222d04f..dee6a86e3 100644 --- a/regress/usr.bin/ctfdump/base_types_encoding.i386 +++ b/regress/usr.bin/ctfdump/base_types_encoding.i386 @@ -1,7 +1,7 @@ - [] FLOAT float encoding=LDOUBLE offset=0 bits=32 - [] FLOAT float encoding=LDOUBLE offset=0 bits=64 - [] FLOAT float encoding=LDOUBLE offset=0 bits=96 - [] INTEGER char encoding=SIGNED CHAR offset=0 bits=8 - [] INTEGER signed encoding=SIGNED offset=0 bits=32 - [] INTEGER signed encoding=SIGNED offset=0 bits=64 - [] INTEGER void encoding=SIGNED offset=0 bits=0 + [] FLOAT float encoding=LDOUBLE offset=0 bits=32 (4 bytes) + [] FLOAT float encoding=LDOUBLE offset=0 bits=64 (8 bytes) + [] FLOAT float encoding=LDOUBLE offset=0 bits=96 (12 bytes) + [] INTEGER char encoding=SIGNED CHAR offset=0 bits=8 (1 bytes) + [] INTEGER signed encoding=SIGNED offset=0 bits=32 (4 bytes) + [] INTEGER signed encoding=SIGNED offset=0 bits=64 (8 bytes) + [] INTEGER void encoding=SIGNED offset=0 bits=0 (0 bytes) diff --git a/regress/usr.sbin/btrace/str.args b/regress/usr.sbin/btrace/str.args index 355af032c..f162d36b5 100644 --- a/regress/usr.sbin/btrace/str.args +++ b/regress/usr.sbin/btrace/str.args @@ -3,5 +3,5 @@ is "free!" 4 SSH -111111111111111111111111111111111111111111111111111111111111112333 +1111111111111111111111111111111111111111111111111111111111111112111111111111111111111111111111111111111111111111111111111111112333 2 diff --git a/regress/usr.sbin/btrace/str.bt b/regress/usr.sbin/btrace/str.bt index 84455aa2c..e7953bdb9 100644 --- a/regress/usr.sbin/btrace/str.bt +++ b/regress/usr.sbin/btrace/str.bt @@ -6,7 +6,7 @@ BEGIN { /* Should truncate when given an index < the max (currently 64) */ printf("%sSSH %s %s\n", str($1, $4), $2, $3); - /* Should truncate long arguments to 64 bytes */ + /* Should truncate long arguments to STRLEN bytes */ printf("No 3 please: %s\n", str($6)); /* Should support nested expressions for the index */ diff --git a/regress/usr.sbin/btrace/str.ok b/regress/usr.sbin/btrace/str.ok index 88c5ba720..57d14c225 100644 --- a/regress/usr.sbin/btrace/str.ok +++ b/regress/usr.sbin/btrace/str.ok @@ -1,5 +1,5 @@ OpenBSD is free! OpenSSH is free! -No 3 please: 111111111111111111111111111111111111111111111111111111111111112 +No 3 please: 1111111111111111111111111111111111111111111111111111111111111112111111111111111111111111111111111111111111111111111111111111112 Open Open diff --git a/sys/dev/fdt/if_dwxe.c b/sys/dev/fdt/if_dwxe.c index 609bb31d0..922849863 100644 --- a/sys/dev/fdt/if_dwxe.c +++ b/sys/dev/fdt/if_dwxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwxe.c,v 1.23 2023/11/10 15:51:19 bluhm Exp $ */ +/* $OpenBSD: if_dwxe.c,v 1.24 2024/02/27 10:47:20 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * Copyright (c) 2017 Patrick Wildt @@ -374,8 +374,10 @@ dwxe_attach(struct device *parent, struct device *self, void *aux) { struct dwxe_softc *sc = (void *)self; struct fdt_attach_args *faa = aux; + char phy_mode[16] = { 0 }; struct ifnet *ifp; uint32_t phy; + int mii_flags = 0; int node; sc->sc_node = faa->fa_node; @@ -387,6 +389,16 @@ dwxe_attach(struct device *parent, struct device *self, void *aux) } sc->sc_dmat = faa->fa_dmat; + OF_getprop(faa->fa_node, "phy-mode", phy_mode, sizeof(phy_mode)); + if (strcmp(phy_mode, "rgmii") == 0) + mii_flags |= MIIF_SETDELAY; + else if (strcmp(phy_mode, "rgmii-rxid") == 0) + mii_flags |= MIIF_SETDELAY | MIIF_RXID; + else if (strcmp(phy_mode, "rgmii-txid") == 0) + mii_flags |= MIIF_SETDELAY | MIIF_TXID; + else if (strcmp(phy_mode, "rgmii-id") == 0) + mii_flags |= MIIF_SETDELAY | MIIF_RXID | MIIF_TXID; + /* Lookup PHY. */ phy = OF_getpropint(faa->fa_node, "phy-handle", 0); node = OF_getnodebyphandle(phy); @@ -394,6 +406,7 @@ dwxe_attach(struct device *parent, struct device *self, void *aux) sc->sc_phyloc = OF_getpropint(node, "reg", MII_PHY_ANY); else sc->sc_phyloc = MII_PHY_ANY; + sc->sc_mii.mii_node = node; sc->sc_clk = clock_get_frequency(faa->fa_node, "stmmaceth"); if (sc->sc_clk > 160000000) @@ -435,7 +448,7 @@ dwxe_attach(struct device *parent, struct device *self, void *aux) ifmedia_init(&sc->sc_media, 0, dwxe_media_change, dwxe_media_status); mii_attach(self, &sc->sc_mii, 0xffffffff, sc->sc_phyloc, - MII_OFFSET_ANY, MIIF_NOISOLATE); + MII_OFFSET_ANY, MIIF_NOISOLATE | mii_flags); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { printf("%s: no PHY found!\n", sc->sc_dev.dv_xname); ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); diff --git a/sys/net/route.c b/sys/net/route.c index 9188b6c4c..ffc87f6e9 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.433 2024/02/22 14:25:58 bluhm Exp $ */ +/* $OpenBSD: route.c,v 1.434 2024/02/27 12:37:49 bluhm Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -239,6 +239,28 @@ route_cache(struct route *ro, const struct in_addr *dst, return (ESRCH); } +/* + * Check cache for route, else allocate a new one, potentially using multipath + * to select the peer. Update cache and return valid route or NULL. + */ +struct rtentry * +route_mpath(struct route *ro, const struct in_addr *dst, + const struct in_addr *src, u_int rtableid) +{ + if (route_cache(ro, dst, src, rtableid)) { + uint32_t *s = NULL; + + if (ro->ro_srcin.s_addr != INADDR_ANY) + s = &ro->ro_srcin.s_addr; + ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, s, ro->ro_tableid); + if (!rtisvalid(ro->ro_rt)) { + rtfree(ro->ro_rt); + ro->ro_rt = NULL; + } + } + return (ro->ro_rt); +} + #ifdef INET6 int route6_cache(struct route *ro, const struct in6_addr *dst, @@ -277,6 +299,24 @@ route6_cache(struct route *ro, const struct in6_addr *dst, return (ESRCH); } + +struct rtentry * +route6_mpath(struct route *ro, const struct in6_addr *dst, + const struct in6_addr *src, u_int rtableid) +{ + if (route6_cache(ro, dst, src, rtableid)) { + uint32_t *s = NULL; + + if (!IN6_IS_ADDR_UNSPECIFIED(&ro->ro_srcin6)) + s = &ro->ro_srcin6.s6_addr32[0]; + ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, s, ro->ro_tableid); + if (!rtisvalid(ro->ro_rt)) { + rtfree(ro->ro_rt); + ro->ro_rt = NULL; + } + } + return (ro->ro_rt); +} #endif /* diff --git a/sys/net/route.h b/sys/net/route.h index fe652bd09..6a7ee94e6 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.207 2024/02/22 14:25:58 bluhm Exp $ */ +/* $OpenBSD: route.h,v 1.208 2024/02/27 12:37:49 bluhm Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -465,8 +465,12 @@ struct bfd_config; void route_init(void); int route_cache(struct route *, const struct in_addr *, const struct in_addr *, u_int); +struct rtentry *route_mpath(struct route *, const struct in_addr *, + const struct in_addr *, u_int); int route6_cache(struct route *, const struct in6_addr *, const struct in6_addr *, u_int); +struct rtentry *route6_mpath(struct route *, const struct in6_addr *, + const struct in6_addr *, u_int); void rtm_ifchg(struct ifnet *); void rtm_ifannounce(struct ifnet *, int); void rtm_bfd(struct bfd_config *); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index cc08e6292..8135144c9 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.294 2024/02/22 14:25:58 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.295 2024/02/27 12:37:49 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -908,23 +908,15 @@ in_pcblookup_local_lock(struct inpcbtable *table, const void *laddrp, struct rtentry * in_pcbrtentry(struct inpcb *inp) { - struct route *ro; - #ifdef INET6 if (ISSET(inp->inp_flags, INP_IPV6)) return in6_pcbrtentry(inp); #endif - ro = &inp->inp_route; - if (inp->inp_faddr.s_addr == INADDR_ANY) return (NULL); - if (route_cache(ro, &inp->inp_faddr, &inp->inp_laddr, - inp->inp_rtableid)) { - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, - &inp->inp_laddr.s_addr, ro->ro_tableid); - } - return (ro->ro_rt); + return (route_mpath(&inp->inp_route, &inp->inp_faddr, &inp->inp_laddr, + inp->inp_rtableid)); } /* @@ -938,7 +930,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, struct inpcb *inp) { struct ip_moptions *mopts = inp->inp_moptions; - struct route *ro = &inp->inp_route; + struct rtentry *rt; const struct in_addr *laddr = &inp->inp_laddr; u_int rtableid = inp->inp_rtableid; struct sockaddr *ip4_source = NULL; @@ -983,17 +975,14 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, * If route is known or can be allocated now, * our src addr is taken from the i/f, else punt. */ - if (route_cache(ro, &sin->sin_addr, NULL, rtableid)) { - /* No route yet, so try to acquire one */ - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, NULL, ro->ro_tableid); - } + rt = route_mpath(&inp->inp_route, &sin->sin_addr, NULL, rtableid); /* * If we found a route, use the address * corresponding to the outgoing interface. */ - if (ro->ro_rt != NULL) - ia = ifatoia(ro->ro_rt->rt_ifa); + if (rt != NULL) + ia = ifatoia(rt->rt_ifa); /* * Use preferred source address if : @@ -1001,8 +990,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, * - preferred source address is set * - output interface is UP */ - if (ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO) && - !(ro->ro_rt->rt_flags & RTF_HOST)) { + if (rt && !(rt->rt_flags & RTF_LLINFO) && !(rt->rt_flags & RTF_HOST)) { ip4_source = rtable_getsource(rtableid, AF_INET); if (ip4_source != NULL) { struct ifaddr *ifa; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index cea4415c1..c678bbf56 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.139 2024/02/22 14:25:58 bluhm Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.140 2024/02/27 12:37:49 bluhm Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -561,16 +561,10 @@ in6_pcbnotify(struct inpcbtable *table, const struct sockaddr_in6 *dst, struct rtentry * in6_pcbrtentry(struct inpcb *inp) { - struct route *ro = &inp->inp_route; - if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) return (NULL); - if (route6_cache(ro, &inp->inp_faddr6, &inp->inp_laddr6, - inp->inp_rtableid)) { - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, - &inp->inp_laddr6.s6_addr32[0], ro->ro_tableid); - } - return (ro->ro_rt); + return (route6_mpath(&inp->inp_route, &inp->inp_faddr6, + &inp->inp_laddr6, inp->inp_rtableid)); } struct inpcb * diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index ac35960a0..145a1c11a 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.95 2024/02/22 14:25:58 bluhm Exp $ */ +/* $OpenBSD: in6_src.c,v 1.96 2024/02/27 12:37:49 bluhm Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -95,7 +95,7 @@ in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock, struct inpcb *inp, struct ip6_pktopts *opts) { struct ip6_moptions *mopts = inp->inp_moptions6; - struct route *ro = &inp->inp_route; + struct rtentry *rt; const struct in6_addr *laddr = &inp->inp_laddr6; u_int rtableid = inp->inp_rtableid; struct ifnet *ifp = NULL; @@ -118,7 +118,8 @@ in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock, struct sockaddr_in6 sa6; /* get the outgoing interface */ - error = in6_selectif(dst, opts, mopts, ro, &ifp, rtableid); + error = in6_selectif(dst, opts, mopts, &inp->inp_route, &ifp, + rtableid); if (error) return (error); @@ -179,9 +180,7 @@ in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock, * If route is known or can be allocated now, * our src addr is taken from the i/f, else punt. */ - if (route6_cache(ro, dst, NULL, rtableid)) { - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, NULL, ro->ro_tableid); - } + rt = route6_mpath(&inp->inp_route, dst, NULL, rtableid); /* * in_pcbconnect() checks out IFF_LOOPBACK to skip using @@ -190,14 +189,14 @@ in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock, * so doesn't check out IFF_LOOPBACK. */ - if (ro->ro_rt) { - ifp = if_get(ro->ro_rt->rt_ifidx); + if (rt != NULL) { + ifp = if_get(rt->rt_ifidx); if (ifp != NULL) { ia6 = in6_ifawithscope(ifp, dst, rtableid); if_put(ifp); } if (ia6 == NULL) /* xxx scope error ?*/ - ia6 = ifatoia6(ro->ro_rt->rt_ifa); + ia6 = ifatoia6(rt->rt_ifa); } /* @@ -206,8 +205,7 @@ in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock, * - preferred source address is set * - output interface is UP */ - if (ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO) && - !(ro->ro_rt->rt_flags & RTF_HOST)) { + if (rt && !(rt->rt_flags & RTF_LLINFO) && !(rt->rt_flags & RTF_HOST)) { ip6_source = rtable_getsource(rtableid, AF_INET6); if (ip6_source != NULL) { struct ifaddr *ifa; @@ -304,11 +302,9 @@ in6_selectroute(const struct in6_addr *dst, struct ip6_pktopts *opts, * a new one. */ if (ro) { - if (route6_cache(ro, dst, NULL, rtableid)) { - /* No route yet, so try to acquire one */ - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, NULL, - ro->ro_tableid); - } + struct rtentry *rt; + + rt = route6_mpath(ro, dst, NULL, rtableid); /* * Check if the outgoing interface conflicts with @@ -319,15 +315,13 @@ in6_selectroute(const struct in6_addr *dst, struct ip6_pktopts *opts, */ if (opts && opts->ip6po_pktinfo && opts->ip6po_pktinfo->ipi6_ifindex) { - if (ro->ro_rt != NULL && - !ISSET(ro->ro_rt->rt_flags, RTF_LOCAL) && - ro->ro_rt->rt_ifidx != - opts->ip6po_pktinfo->ipi6_ifindex) { + if (rt != NULL && !ISSET(rt->rt_flags, RTF_LOCAL) && + rt->rt_ifidx != opts->ip6po_pktinfo->ipi6_ifindex) { return (NULL); } } - return (ro->ro_rt); + return (rt); } return (NULL); @@ -338,7 +332,7 @@ in6_selectif(const struct in6_addr *dst, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route *ro, struct ifnet **retifp, u_int rtableid) { - struct rtentry *rt = NULL; + struct rtentry *rt; struct in6_pktinfo *pi = NULL; /* If the caller specify the outgoing interface explicitly, use it. */ @@ -377,11 +371,10 @@ in6_selectif(const struct in6_addr *dst, struct ip6_pktopts *opts, * Although this may not be very harmful, it should still be confusing. * We thus reject the case here. */ - if (rt && (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE))) + if (ISSET(rt->rt_flags, RTF_REJECT | RTF_BLACKHOLE)) return (rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); - if (rt != NULL) - *retifp = if_get(rt->rt_ifidx); + *retifp = if_get(rt->rt_ifidx); return (0); } diff --git a/usr.bin/ctfconv/generate.c b/usr.bin/ctfconv/generate.c index fdbaa0ea3..3306edcb6 100644 --- a/usr.bin/ctfconv/generate.c +++ b/usr.bin/ctfconv/generate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: generate.c,v 1.6 2024/02/22 13:15:17 claudio Exp $ */ +/* $OpenBSD: generate.c,v 1.7 2024/02/27 06:58:19 anton Exp $ */ /* * Copyright (c) 2017 Martin Pieuchot @@ -197,7 +197,7 @@ imcs_add_type(struct imcs *imcs, struct itype *it) ctsz = sizeof(struct ctf_stype); } else if (size <= CTF_MAX_SIZE) { if (kind == CTF_K_INTEGER || kind == CTF_K_FLOAT) { - assert(size <= 64); + assert(size <= 128); if (size == 0) ctt.ctt_size = 0; else if (size <= 8) @@ -206,8 +206,10 @@ imcs_add_type(struct imcs *imcs, struct itype *it) ctt.ctt_size = 2; else if (size <= 32) ctt.ctt_size = 4; - else + else if (size <= 64) ctt.ctt_size = 8; + else + ctt.ctt_size = 16; } else ctt.ctt_size = size; ctsz = sizeof(struct ctf_stype); diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c index 56790729f..11f9e2740 100644 --- a/usr.bin/rsync/blocks.c +++ b/usr.bin/rsync/blocks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blocks.c,v 1.21 2021/11/03 14:42:12 deraadt Exp $ */ +/* $OpenBSD: blocks.c,v 1.22 2024/02/27 11:28:30 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -280,6 +280,8 @@ blk_match(struct sess *sess, const struct blkset *blks, blk->len, blk->idx); tok = -(blk->idx + 1); + hash_file_buf(&st->ctx, st->map + last, sz + blk->len); + /* * Write the data we have, then follow it with * the tag of the block that matches. @@ -293,6 +295,7 @@ blk_match(struct sess *sess, const struct blkset *blks, st->total += blk->len; st->offs += blk->len; st->hint = blk->idx + 1; + return; } @@ -308,6 +311,8 @@ blk_match(struct sess *sess, const struct blkset *blks, st->curlen = st->curpos + sz; st->curtok = 0; st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK; + + hash_file_buf(&st->ctx, st->map + st->curpos, sz); } else { st->curpos = 0; st->curlen = st->mapsz; @@ -315,6 +320,8 @@ blk_match(struct sess *sess, const struct blkset *blks, st->curst = st->mapsz ? BLKSTAT_DATA : BLKSTAT_TOK; st->dirty = st->total = st->mapsz; + hash_file_buf(&st->ctx, st->map, st->mapsz); + LOG4("%s: flushing whole file %zu B", path, st->mapsz); } diff --git a/usr.bin/rsync/extern.h b/usr.bin/rsync/extern.h index a36d93715..940db81d5 100644 --- a/usr.bin/rsync/extern.h +++ b/usr.bin/rsync/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.47 2023/11/27 11:30:49 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.48 2024/02/27 11:28:30 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -17,6 +17,8 @@ #ifndef EXTERN_H #define EXTERN_H +#include + /* * This is the rsync protocol version that we support. */ @@ -214,6 +216,7 @@ struct blkstat { struct blktab *blktab; /* hashtable of blocks */ uint32_t s1; /* partial sum for computing fast hash */ uint32_t s2; /* partial sum for computing fast hash */ + MD4_CTX ctx; /* context for hash_file */ }; /* @@ -388,8 +391,10 @@ int blk_send_ack(struct sess *, int, struct blkset *); uint32_t hash_fast(const void *, size_t); void hash_slow(const void *, size_t, unsigned char *, const struct sess *); -void hash_file(const void *, size_t, unsigned char *, - const struct sess *); + +void hash_file_start(MD4_CTX *, const struct sess *); +void hash_file_buf(MD4_CTX *, const void *, size_t); +void hash_file_final(MD4_CTX *, unsigned char *); void copy_file(int, const char *, const struct flist *); diff --git a/usr.bin/rsync/hash.c b/usr.bin/rsync/hash.c index b87c56f52..37529e951 100644 --- a/usr.bin/rsync/hash.c +++ b/usr.bin/rsync/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.4 2021/06/30 13:10:04 claudio Exp $ */ +/* $OpenBSD: hash.c,v 1.5 2024/02/27 11:28:30 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -82,14 +82,21 @@ hash_slow(const void *buf, size_t len, * of the sequence, not the beginning. */ void -hash_file(const void *buf, size_t len, - unsigned char *md, const struct sess *sess) +hash_file_start(MD4_CTX *ctx, const struct sess *sess) { - MD4_CTX ctx; int32_t seed = htole32(sess->seed); - MD4_Init(&ctx); - MD4_Update(&ctx, (unsigned char *)&seed, sizeof(int32_t)); - MD4_Update(&ctx, buf, len); - MD4_Final(md, &ctx); + MD4_Init(ctx); + MD4_Update(ctx, (unsigned char *)&seed, sizeof(int32_t)); +} + +void +hash_file_buf(MD4_CTX *ctx, const void *buf, size_t len) +{ + MD4_Update(ctx, buf, len); +} +void +hash_file_final(MD4_CTX *ctx, unsigned char *md) +{ + MD4_Final(md, ctx); } diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c index 8e49f4d0e..43ccfbd64 100644 --- a/usr.bin/rsync/sender.c +++ b/usr.bin/rsync/sender.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sender.c,v 1.31 2024/02/19 16:39:18 claudio Exp $ */ +/* $OpenBSD: sender.c,v 1.32 2024/02/27 11:28:30 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -159,7 +159,7 @@ send_up_fsm(struct sess *sess, size_t *phase, * finished with the file. */ - hash_file(up->stat.map, up->stat.mapsz, fmd, sess); + hash_file_final(&up->stat.ctx, fmd); if (!io_lowbuffer_alloc(sess, wb, wbsz, wbmax, dsz)) { ERRX1("io_lowbuffer_alloc"); return 0; @@ -619,6 +619,7 @@ rsync_sender(struct sess *sess, int fdin, /* Hash our blocks. */ + hash_file_start(&up.stat.ctx, sess); blkhash_set(up.stat.blktab, up.cur->blks); /* diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c index 4450e98b8..ce32989be 100644 --- a/usr.sbin/btrace/btrace.c +++ b/usr.sbin/btrace/btrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.c,v 1.88 2024/02/24 19:42:54 mpi Exp $ */ +/* $OpenBSD: btrace.c,v 1.89 2024/02/27 12:38:12 mpi Exp $ */ /* * Copyright (c) 2019 - 2023 Martin Pieuchot @@ -1640,6 +1640,9 @@ ba2long(struct bt_arg *ba, struct dt_evt *dtev) long val; switch (ba->ba_type) { + case B_AT_STR: + val = (*ba2str(ba, dtev) == '\0') ? 0 : 1; + break; case B_AT_LONG: val = (long)ba->ba_value; break; diff --git a/usr.sbin/btrace/btrace.h b/usr.sbin/btrace/btrace.h index b5fb90f8c..0e4c26da6 100644 --- a/usr.sbin/btrace/btrace.h +++ b/usr.sbin/btrace/btrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.h,v 1.13 2023/09/11 19:01:26 mpi Exp $ */ +/* $OpenBSD: btrace.h,v 1.14 2024/02/27 12:50:33 mpi Exp $ */ /* * Copyright (c) 2019 - 2020 Martin Pieuchot @@ -58,7 +58,7 @@ void hist_increment(struct hist *, const char *); void hist_print(struct hist *, const char *); #define KLEN 1024 /* # of characters in map key, contain a stack trace */ -#define STRLEN 64 /* maximum # of bytes to output via str() function */ +#define STRLEN 128 /* maximum # of bytes to output via str() function */ /* printf.c */ int stmt_printf(struct bt_stmt *, struct dt_evt *);