Re: ipsp_spd_inp in in_pcbconnect
> On 26 Oct 2021, at 00:52, Alexander Bluhm wrote: > > Hi, > > The implementation of ipsp_spd_inp() is side effect free. It sets > the error output parameter and returns a tdb. Both are ignored in > in_pcbconnect(). So this code does nothing. > > ok? > ok mvs@ > bluhm > > Index: netinet/in_pcb.c > === > RCS file: /cvs/src/sys/netinet/in_pcb.c,v > retrieving revision 1.255 > diff -u -p -r1.255 in_pcb.c > --- netinet/in_pcb.c 10 Mar 2021 10:21:48 - 1.255 > +++ netinet/in_pcb.c 25 Oct 2021 21:49:13 - > @@ -525,14 +525,6 @@ in_pcbconnect(struct inpcb *inp, struct > inp->inp_flowid = stoeplitz_ip4port(inp->inp_faddr.s_addr, > inp->inp_laddr.s_addr, inp->inp_fport, inp->inp_lport); > #endif > -#ifdef IPSEC > - { > - /* Cause an IPsec SA to be established. */ > - /* error is just ignored */ > - ipsp_spd_inp(NULL, AF_INET, 0, &error, IPSP_DIRECTION_OUT, > - NULL, inp, NULL); > - } > -#endif > return (0); > } > >
ipsp_spd_inp in in_pcbconnect
Hi, The implementation of ipsp_spd_inp() is side effect free. It sets the error output parameter and returns a tdb. Both are ignored in in_pcbconnect(). So this code does nothing. ok? bluhm Index: netinet/in_pcb.c === RCS file: /cvs/src/sys/netinet/in_pcb.c,v retrieving revision 1.255 diff -u -p -r1.255 in_pcb.c --- netinet/in_pcb.c10 Mar 2021 10:21:48 - 1.255 +++ netinet/in_pcb.c25 Oct 2021 21:49:13 - @@ -525,14 +525,6 @@ in_pcbconnect(struct inpcb *inp, struct inp->inp_flowid = stoeplitz_ip4port(inp->inp_faddr.s_addr, inp->inp_laddr.s_addr, inp->inp_fport, inp->inp_lport); #endif -#ifdef IPSEC - { - /* Cause an IPsec SA to be established. */ - /* error is just ignored */ - ipsp_spd_inp(NULL, AF_INET, 0, &error, IPSP_DIRECTION_OUT, - NULL, inp, NULL); - } -#endif return (0); }
Re: Dell R620 - latest snapshot
On 25.10.2021. 22:58, Theo de Raadt wrote: > Can you checkout -current, and try this diff: > > It has one additional check for cpu_setperf being NULL, near the top of > setperf_auto() Hi, yes, with this diff box boot normally Tnx ..
Re: Dell R620 - latest snapshot
Can you checkout -current, and try this diff: It has one additional check for cpu_setperf being NULL, near the top of setperf_auto() Index: dev/acpi/acpiac.c === RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v retrieving revision 1.33 diff -u -p -u -r1.33 acpiac.c --- dev/acpi/acpiac.c 10 Jun 2020 22:26:40 - 1.33 +++ dev/acpi/acpiac.c 24 Oct 2021 04:00:38 - @@ -70,6 +70,7 @@ void acpiac_attach(struct device *parent, struct device *self, void *aux) { struct acpiac_softc *sc = (struct acpiac_softc *)self; + extern int hw_power; struct acpi_attach_args *aa = aux; sc->sc_acpi = (struct acpi_softc *)parent; @@ -83,6 +84,7 @@ acpiac_attach(struct device *parent, str printf("offline\n"); else printf("in unknown state\n"); + hw_power = (sc->sc_ac_stat == PSR_ONLINE); strlcpy(sc->sc_sensdev.xname, DEVNAME(sc), sizeof(sc->sc_sensdev.xname)); @@ -140,6 +142,7 @@ int acpiac_notify(struct aml_node *node, int notify_type, void *arg) { struct acpiac_softc *sc = arg; + extern int hw_power; dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, DEVNAME(sc)); @@ -159,5 +162,6 @@ acpiac_notify(struct aml_node *node, int dnprintf(10, "A/C status: %d\n", sc->sc_ac_stat); break; } + hw_power = (sc->sc_ac_stat == PSR_ONLINE); return (0); } Index: kern/kern_sysctl.c === RCS file: /cvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.395 diff -u -p -u -r1.395 kern_sysctl.c --- kern/kern_sysctl.c 24 Oct 2021 00:02:25 - 1.395 +++ kern/kern_sysctl.c 26 Oct 2021 04:41:33 - @@ -654,6 +654,7 @@ kern_sysctl(int *name, u_int namelen, vo */ char *hw_vendor, *hw_prod, *hw_uuid, *hw_serial, *hw_ver; int allowpowerdown = 1; +int hw_power = 1; /* morally const values reported by sysctl_bounded_arr */ static int byte_order = BYTE_ORDER; @@ -665,6 +666,7 @@ const struct sysctl_bounded_args hw_vars {HW_BYTEORDER, &byte_order, SYSCTL_INT_READONLY}, {HW_PAGESIZE, &page_size, SYSCTL_INT_READONLY}, {HW_DISKCOUNT, &disk_count, SYSCTL_INT_READONLY}, + {HW_POWER, &hw_power, SYSCTL_INT_READONLY}, }; int Index: kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.69 diff -u -p -u -r1.69 sched_bsd.c --- kern/sched_bsd.c9 Sep 2021 18:41:39 - 1.69 +++ kern/sched_bsd.c26 Oct 2021 05:13:22 - @@ -65,23 +65,6 @@ struct __mp_lock sched_lock; void schedcpu(void *); uint32_t decay_aftersleep(uint32_t, uint32_t); -void -scheduler_start(void) -{ - static struct timeout schedcpu_to; - - /* -* We avoid polluting the global namespace by keeping the scheduler -* timeouts static in this function. -* We setup the timeout here and kick schedcpu once to make it do -* its job. -*/ - timeout_set(&schedcpu_to, schedcpu, &schedcpu_to); - - rrticks_init = hz / 10; - schedcpu(&schedcpu_to); -} - /* * Force switch among equal priority processes every 100ms. */ @@ -532,7 +515,7 @@ void (*cpu_setperf)(int); #define PERFPOL_AUTO 1 #define PERFPOL_HIGH 2 int perflevel = 100; -int perfpolicy = PERFPOL_MANUAL; +int perfpolicy = PERFPOL_AUTO; #ifndef SMALL_KERNEL /* @@ -542,22 +525,30 @@ int perfpolicy = PERFPOL_MANUAL; void setperf_auto(void *); struct timeout setperf_to = TIMEOUT_INITIALIZER(setperf_auto, NULL); +extern int hw_power; void setperf_auto(void *v) { static uint64_t *idleticks, *totalticks; static int downbeats; - - int i, j; - int speedup; + int i, j = 0; + int speedup = 0; CPU_INFO_ITERATOR cii; struct cpu_info *ci; - uint64_t idle, total, allidle, alltotal; + uint64_t idle, total, allidle = 0, alltotal = 0; if (perfpolicy != PERFPOL_AUTO) return; + if (cpu_setperf == NULL) + return; + + if (hw_power) { + speedup = 1; + goto faster; + } + if (!idleticks) if (!(idleticks = mallocarray(ncpusfound, sizeof(*idleticks), M_DEVBUF, M_NOWAIT | M_ZERO))) @@ -569,10 +560,6 @@ setperf_auto(void *v) sizeof(*idleticks) * ncpusfound); return; } - - alltotal = allidle = 0; - j = 0; - speedup = 0; CPU_INFO_FOREACH(cii, ci) { if (!cpu_is_online(ci)) continue; @@ -596,6 +583,7 @@ setperf_auto(void *v) downbeats = 5; if (speedup && perflevel != 100) { +faster: perflevel = 100;
Dell R620 - latest snapshot
Hi all, with latest snaphost from few minutes ago Dell R620 box panic while booting vmm0 at mainbus0: VMX/EPT dt: 445 probes attempt to execute user address 0x0 in supervisor mode kernel: page fault trap, code=0 Stopped at 0TIDPIDUID PRFLAGS PFLAGS CPU COMMAND 0(64,8216f720,de001fffc258,821b1568,821ffc80,1) at 0 setperf_auto(0,0,d986fb49e8e1e7b2,0,81593260,1) at setperf_auto+0x4d softclock_process_tick_timeout(8216de78,0,e2e5855cd0aeac94,821b 1b20,0,821b1b20) at softclock_process_tick_timeout+0x106 softclock(0,0,f1deb9b688ef9df3,0,821b1578,821b1560) at softclock+0xb8 softintr_dispatch(0,0,ec7e785c93841f4b,0,0,8152d414) at softintr_dispatch+0xeb Xsoftclock(0,0,1388,0,8002e6c0,8215a700) at Xsoftclock+0x1f acpicpu_idle(cf980a4d1289648c,8215a010,82159ff0,8000f7a 0,0,0) at acpicpu_idle+0x281 sched_idle(82159ff0,82159ff0,0,0,82159ff0,81e13 660) at sched_idle+0x27e end trace frame: 0x0, count: 8 https://www.openbsd.org/ddb.html describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs. ddb{0}> ddb{0}> ps PID TID PPIDUID S FLAGS WAIT COMMAND 95902 409912 0 0 3 0x14200 usbdlyusbtask 76026 40696 0 0 3 0x14200 usbatsk usbatsk 73092 189429 0 0 3 0x40014200 acpi0 acpi0 48658 523253 0 0 1 0x14200idle5 10829 25129 0 0 1 0x14200idle4 94971 504025 0 0 1 0x14200idle3 59213 299094 0 0 1 0x14200idle2 53939 241990 0 0 1 0x14200idle1 97462 152756 0 0 3 0x14200 bored sensors 57912 119825 0 0 3 0x14200 bored softnet 73318 325240 0 0 3 0x14200 bored systqmp 83926 221734 0 0 3 0x14200 bored systq 98228 59299 0 0 3 0x40014200 bored softclock *28692 166452 0 0 7 0x40014200idle0 1 332959 0 0 3 0 initexec swapper 0 0 -1 0 3 0x10200 cfpendswapper ddb{0}> trace /t 0t166452 sched_idle(82159ff0,82159ff0,0,0,82159ff0,81e13 660) at sched_idle+0x27e end trace frame: 0x0, count: -1 ddb{0}> show reg rdi 0x64 rsi 0x8216f720timeout_mutex rbp 0x800022c48440 rbx 0x821b1568x86_soft_intrs+0x8 rdx 0xde001fffc258 rcx0x202 rax 0xd r8 0xff r90x112e0be826d694b3 r10 0x1 r110 r12 0x821ffc80timeout_todo r13 0x1 r14 0x81593260setperf_auto r150 rip0 cs 0x8 rflags 0x10202__ALIGN_SIZE+0xf202 rsp 0x800022c483f8 ss 0x10 0 OpenBSD 7.0-current (GENERIC.MP) #27: Sat Oct 23 22:57:48 CEST 2021 hrv...@r620-2.srce.hr:/sys/arch/amd64/compile/GENERIC.MP real mem = 17115840512 (16322MB) avail mem = 16581156864 (15813MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xcf42c000 (99 entries) bios0: vendor Dell Inc. version "2.9.0" date 12/06/2019 bios0: Dell Inc. PowerEdge R620 acpi0 at bios0: ACPI 3.0 acpi0: sleep states S0 S4 S5 acpi0: tables DSDT FACP APIC SPCR HPET DMAR MCFG WDAT SLIC ERST HEST BERT EINJ TCPA PC__ SRAT SSDT acpi0: wakeup devices PCI0(S5) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 4 (boot processor) cpu0: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz, 3600.49 MHz, 06-3e-04 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 2, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 100MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE cpu1 at mainbus0: apid 6 (application processor) cpu1: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz, 3600.02 MHz, 06-3e-04 cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,
/usr/src/*bin: remove unused variables
Patrick's "bootloader: remove unsued variables" mail reminded me about this diff I still have. M sbin/vnconfig/vnconfig.c M usr.sbin/pcidump/pcidump.c M usr.sbin/wsfontload/wsfontload.c M usr.bin/less/line.c M usr.bin/make/engine.c M usr.bin/systat/cpu.c M usr.bin/ctfconv/dw.c I think I gathered it from warnings during builds, not sure... All tools build with this diff, no fancy macros/defines that pull these normally unused variables/functions in. OK? Index: sbin/vnconfig/vnconfig.c === RCS file: /cvs/src/sbin/vnconfig/vnconfig.c,v retrieving revision 1.6 diff -u -p -r1.6 vnconfig.c --- sbin/vnconfig/vnconfig.c22 Sep 2021 20:43:16 - 1.6 +++ sbin/vnconfig/vnconfig.c24 Sep 2021 10:30:49 - @@ -332,7 +332,7 @@ int unconfig(char *vnd) { struct vnd_ioctl vndio; - int fd, rv = -1, unit; + int fd, rv = -1; char *rdev; if ((fd = opendev(vnd, O_RDONLY, OPENDEV_PART, &rdev)) == -1) Index: usr.sbin/pcidump/pcidump.c === RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v retrieving revision 1.67 diff -u -p -r1.67 pcidump.c --- usr.sbin/pcidump/pcidump.c 24 Oct 2021 21:24:19 - 1.67 +++ usr.sbin/pcidump/pcidump.c 25 Oct 2021 19:36:31 - @@ -377,7 +377,7 @@ print_vpd(const uint8_t *buf, size_t len const struct pci_vpd *vpd; char key0[8]; char key1[8]; - size_t vlen, i; + size_t vlen; while (len > 0) { if (len < sizeof(*vpd)) @@ -411,7 +411,6 @@ dump_vpd(int bus, int dev, int func) uint32_t data[64]; /* XXX this can be up to 32k of data */ uint8_t *buf = (uint8_t *)data; size_t len = sizeof(data); - size_t i; bzero(&io, sizeof(io)); io.pv_sel.pc_bus = bus; Index: usr.sbin/wsfontload/wsfontload.c === RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v retrieving revision 1.24 diff -u -p -r1.24 wsfontload.c --- usr.sbin/wsfontload/wsfontload.c24 Oct 2021 21:24:19 - 1.24 +++ usr.sbin/wsfontload/wsfontload.c25 Oct 2021 19:36:31 - @@ -77,7 +77,7 @@ main(int argc, char *argv[]) char *wsdev, *infile, *p; struct wsdisplay_font f; struct wsdisplay_screentype screens; - int c, res, wsfd, ffd, type, list, i; + int c, res, wsfd, ffd, list, i; int defwidth, defheight; struct stat stat; size_t len; Index: usr.bin/less/line.c === RCS file: /cvs/src/usr.bin/less/line.c,v retrieving revision 1.33 diff -u -p -r1.33 line.c --- usr.bin/less/line.c 3 Sep 2019 23:08:42 - 1.33 +++ usr.bin/less/line.c 5 Apr 2021 21:02:40 - @@ -434,7 +434,7 @@ static int backc(void) { wchar_t ch, prev_ch; - int i, len, width; + int len, width; if ((len = mbtowc_left(&ch, linebuf + curr, curr)) <= 0) return (0); Index: usr.bin/make/engine.c === RCS file: /cvs/src/usr.bin/make/engine.c,v retrieving revision 1.69 diff -u -p -r1.69 engine.c --- usr.bin/make/engine.c 26 Jan 2020 12:41:21 - 1.69 +++ usr.bin/make/engine.c 5 Apr 2021 21:04:13 - @@ -685,7 +685,6 @@ handle_job_status(Job *job, int status) int run_gnode(GNode *gn) { - Job *j; if (!gn || (gn->type & OP_DUMMY)) return NOSUCHNODE; Index: usr.bin/systat/cpu.c === RCS file: /cvs/src/usr.bin/systat/cpu.c,v retrieving revision 1.10 diff -u -p -r1.10 cpu.c --- usr.bin/systat/cpu.c28 Jun 2019 13:35:04 - 1.10 +++ usr.bin/systat/cpu.c5 Apr 2021 21:11:34 - @@ -192,7 +192,7 @@ initcpu(void) { field_view *v; size_t size = sizeof(cpu_count); - int mib[2], i; + int mib[2]; mib[0] = CTL_HW; mib[1] = HW_NCPU; Index: usr.bin/ctfconv/dw.c === RCS file: /cvs/src/usr.bin/ctfconv/dw.c,v retrieving revision 1.4 diff -u -p -r1.4 dw.c --- usr.bin/ctfconv/dw.c27 Sep 2017 08:59:38 - 1.4 +++ usr.bin/ctfconv/dw.c5 Apr 2021 21:25:45 - @@ -50,10 +50,6 @@ static intdw_read_buf(struct dwbuf *, static int dw_skip_bytes(struct dwbuf *, size_t); -static int dw_read_filename(struct dwbuf *, const char **, const char **, -uint8_t, uint64_t); - - static int dw_attr_parse(struct dwbuf *, struct dwattr *, uint8_t, struct dwaval_queue *); static void dw_attr_purge(struct dwaval_queue *); @@ -167,55 +163,6 @@ dw_skip_bytes(struct dwbuf *d, size_t
Re: ixl(4): add rx/tx checksum offloading
On Fri, Oct 22, 2021 at 03:39:01PM +0200, Hrvoje Popovski wrote: > On 22.10.2021. 13:39, Jan Klemkow wrote: > > Thats because, you only see this flags, if the checksum offloading is > > enabled for "sending". I'm still working/debugging on the sending side. > > Thus, I just send a diff with the receiving part for now. > > > > You can see if its working for your card with the netstat(8) statistics. > > > > # netstat -s | grep software-checksummed > > > > These counters should not raise much on the receive side if you put some > > traffic over the interface. > > Thank you for explanation... > > I'm sending 8 tcp streams with iperf3 from some box to openbsd ixl box > and here are results: > > without diff > smc24# netstat -s | grep software-checksummed > 5039250 input datagrams software-checksummed > 2592718 output datagrams software-checksummed > 2592709 packets software-checksummed > 5039250 packets software-checksummed > 0 input packets software-checksummed > 0 output packets software-checksummed > > cca 6.12 Gbits/sec > > > > with diff > smc24# netstat -s | grep software-checksummed > 0 input datagrams software-checksummed > 2956546 output datagrams software-checksummed > 2956537 packets software-checksummed > 0 packets software-checksummed > 0 input packets software-checksummed > 0 output packets software-checksummed > > cca 6.70 Gbits/sec > > are result like those expected? > > is forwarding testing any good for checksum offload diffs? Hi Hrvoje, Thanks a lot for you big testing efforts! In case of forwarding the forwarding box just checks the IPv4 header checksum and ignores the UDP/TCP header. Your setup from one Box to another is fine. Here is a new diff, which also includes send checksum offloading. Thus, all software-checksummed numbers should stay low in both directions. Could you test this diff with your ospf{6}d and NFS tests? If you see IPv4 fragments in the ospf and NFS traffic within tcpdump(8), your test should find the bugs pointed out by deraadt@ and claudio@. You can provoke large NFS packets with the following options on your NFS mount point. server:/export /mnt nfs ro,intr,-r65536,-w65536 Thanks, Jan Index: dev/pci/if_ixl.c === RCS file: /mount/openbsd/cvs/src/sys/dev/pci/if_ixl.c,v retrieving revision 1.75 diff -u -p -r1.75 if_ixl.c --- dev/pci/if_ixl.c23 Jul 2021 00:29:14 - 1.75 +++ dev/pci/if_ixl.c25 Oct 2021 15:11:46 - @@ -82,6 +82,10 @@ #endif #include +#include +#include +#include +#include #include #include @@ -1388,6 +1392,7 @@ static intixl_rxeof(struct ixl_softc *, static voidixl_rxfill(struct ixl_softc *, struct ixl_rx_ring *); static voidixl_rxrefill(void *); static int ixl_rxrinfo(struct ixl_softc *, struct if_rxrinfo *); +static voidixl_rx_checksum(struct mbuf *, uint64_t); #if NKSTAT > 0 static voidixl_kstat_attach(struct ixl_softc *); @@ -1942,9 +1947,9 @@ ixl_attach(struct device *parent, struct ifp->if_capabilities = IFCAP_VLAN_MTU; #if 0 ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | - IFCAP_CSUM_UDPv4; #endif + ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | + IFCAP_CSUM_UDPv4 | IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6; ifmedia_init(&sc->sc_media, 0, ixl_media_change, ixl_media_status); @@ -2772,6 +2777,69 @@ ixl_load_mbuf(bus_dma_tag_t dmat, bus_dm } static void +ixl_tx_setup_offload(struct mbuf *mp, uint64_t *cmd) +{ + uint64_t ip_hdr_len; + int ipoff = ETHER_HDR_LEN; + uint8_t ipproto; + struct ip *ip; +#ifdef INET6 + struct ip6_hdr *ip6; +#endif + struct tcphdr *th; + struct mbuf *m; + + switch (ntohs(mtod(mp, struct ether_header *)->ether_type)) { + case ETHERTYPE_IP: + if (mp->m_pkthdr.len < ETHER_HDR_LEN + sizeof(*ip)) + return; + m = m_getptr(mp, ETHER_HDR_LEN, &ipoff); + KASSERT(m != NULL && m->m_len - ipoff >= sizeof(*ip)); + ip = (struct ip *)(m->m_data + ipoff); + + if (mp->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT) + *cmd |= IXL_TX_DESC_CMD_IIPT_IPV4_CSUM; + else + *cmd |= IXL_TX_DESC_CMD_IIPT_IPV4; + + ip_hdr_len = ip->ip_hl << 2; + ipproto = ip->ip_p; + break; +#ifdef INET6 + case ETHERTYPE_IPV6: + if (mp->m_pkthdr.len < ETHER_HDR_LEN + sizeof(*ip6)) + return; + m = m_getptr(mp, ETHER_HDR_LEN, &ipoff); + KASSERT(m != NULL && m->m_len - ipoff >= sizeof(*ip6)); + ip6 = (struct
Re: snmpd(8): Log correct engineid
ok Martijn van Duren(openbsd+t...@list.imperialat.at) on 2021.10.21 08:45:51 +0100: > ping > > On Sun, 2021-09-26 at 10:22 +0200, Martijn van Duren wrote: > > ober_get_nstring writes a pointer to buf and does not overwrite the > > content of buf itself. So pushing an array in there will result in it > > only writing the pointer address to the array, which is not exactly what > > we want to show. > > > > I choose to go for sizeof, instead of using the define to be a little > > more on the safe side, but I didn't change SNMPD_MAXCONTEXNAMELEN to > > keep the diff small. > > > > OK? > > > > martijn@ > > > > Index: snmpe.c > > === > > RCS file: /cvs/src/usr.sbin/snmpd/snmpe.c,v > > retrieving revision 1.76 > > diff -u -p -r1.76 snmpe.c > > --- snmpe.c 6 Sep 2021 13:32:18 - 1.76 > > +++ snmpe.c 26 Sep 2021 08:19:59 - > > @@ -237,7 +237,7 @@ snmpe_parse(struct snmp_message *msg) > > long longerrval, erridx; > > u_intclass; > > char*comn; > > - char*flagstr, *ctxname; > > + char*flagstr, *ctxname, *engineid; > > size_t len; > > struct sockaddr_storage *ss = &msg->sm_ss; > > struct ber_element *root = msg->sm_req; > > @@ -300,9 +300,12 @@ snmpe_parse(struct snmp_message *msg) > > } > > > > if (ober_scanf_elements(a, "{xxeS$}$", > > - &msg->sm_ctxengineid, &msg->sm_ctxengineid_len, > > - &ctxname, &len, &msg->sm_pdu) != 0) > > + &engineid, &msg->sm_ctxengineid_len, &ctxname, &len, > > + &msg->sm_pdu) != 0) > > goto parsefail; > > + if (msg->sm_ctxengineid_len > sizeof(msg->sm_ctxengineid)) > > + goto parsefail; > > + memcpy(msg->sm_ctxengineid, engineid, msg->sm_ctxengineid_len); > > if (len > SNMPD_MAXCONTEXNAMELEN) > > goto parsefail; > > memcpy(msg->sm_ctxname, ctxname, len); > > > >
Re: Add missing manpage for smtpd
Hi Crystal Kolipe wrote: > I sent this to bugs@ a while back, but it seems to have been missed. > > smtpd-filters.7 is not installed by default. > > --- usr.sbin/smtpd/smtpd/Makefile.distWed Apr 21 04:54:10 2021 > +++ usr.sbin/smtpd/smtpd/Makefile Mon Oct 25 11:54:39 2021 > @@ -76,7 +76,7 @@ > > SRCS+= stat_ramstat.c > > -MAN= sendmail.8 smtpd.8 smtpd.conf.5 table.5 > +MAN= sendmail.8 smtpd-filters.7 smtpd.8 smtpd.conf.5 table.5 > BINDIR= /usr/sbin > > LDADD+= -levent -lutil -ltls -lssl -lcrypto -lz Following discussions with jmc@ and gilles@ I'm doing some work on the English language on smtpd-filters.7 with a view to getting it installed.
Re: rpki-client proc_parser cleanup
On Mon, Oct 25, 2021 at 07:50:46PM +0200, Claudio Jeker wrote: > Refactor this code and instead of passing various things around just use > globals. ok with two small nits: > @@ -560,14 +622,6 @@ proc_parser(int fd) > if ((pfd.revents & POLLHUP)) > break; > > - /* > - * Start with read events. > - * This means that the parent process is sending us > - * something we need to parse. > - * We don't actually parse it til we have space in our > - * outgoing buffer for responding, though. > - */ > - > if ((pfd.revents & POLLIN)) { > b = io_buf_read(fd, &inbuf); > Could you zap the two tabs on the line after io_buf_read() while you're here? [...] > + parse_entity(&q, &msgq); > + > } No empty line before the closing braces (or at least nuke the three tabs)
tdb unlink locked
Hi, This fixes a panic mtx locking against myself I have introduced in my previous commit. ok? bluhm Index: net/pfkeyv2.c === RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkeyv2.c,v retrieving revision 1.220 diff -u -p -r1.220 pfkeyv2.c --- net/pfkeyv2.c 22 Oct 2021 12:30:53 - 1.220 +++ net/pfkeyv2.c 25 Oct 2021 17:49:21 - @@ -1042,8 +1042,10 @@ int pfkeyv2_sa_flush(struct tdb *tdb, void *satype_vp, int last) { if (!(*((u_int8_t *) satype_vp)) || - tdb->tdb_satype == *((u_int8_t *) satype_vp)) - tdb_delete(tdb); + tdb->tdb_satype == *((u_int8_t *) satype_vp)) { + tdb_unlink_locked(tdb); + tdb_free(tdb); + } return (0); } Index: netinet/ip_ipsp.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipsp.c,v retrieving revision 1.247 diff -u -p -r1.247 ip_ipsp.c --- netinet/ip_ipsp.c 25 Oct 2021 16:00:12 - 1.247 +++ netinet/ip_ipsp.c 25 Oct 2021 17:50:58 - @@ -733,10 +733,19 @@ puttdb(struct tdb *tdbp) void tdb_unlink(struct tdb *tdbp) { + mtx_enter(&tdb_sadb_mtx); + tdb_unlink_locked(tdbp); + mtx_leave(&tdb_sadb_mtx); +} + +void +tdb_unlink_locked(struct tdb *tdbp) +{ struct tdb *tdbpp; u_int32_t hashval; - mtx_enter(&tdb_sadb_mtx); + MUTEX_ASSERT_LOCKED(&tdb_sadb_mtx); + hashval = tdb_hash(tdbp->tdb_spi, &tdbp->tdb_dst, tdbp->tdb_sproto); if (tdbh[hashval] == tdbp) { @@ -793,7 +802,6 @@ tdb_unlink(struct tdb *tdbp) ipsecstat_inc(ipsec_prevtunnels); } #endif /* IPSEC */ - mtx_leave(&tdb_sadb_mtx); } void Index: netinet/ip_ipsp.h === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipsp.h,v retrieving revision 1.218 diff -u -p -r1.218 ip_ipsp.h --- netinet/ip_ipsp.h 24 Oct 2021 23:33:37 - 1.218 +++ netinet/ip_ipsp.h 25 Oct 2021 17:50:57 - @@ -558,6 +558,7 @@ struct tdb *tdb_alloc(u_int); void tdb_free(struct tdb *); inttdb_init(struct tdb *, u_int16_t, struct ipsecinit *); void tdb_unlink(struct tdb *); +void tdb_unlink_locked(struct tdb *); inttdb_walk(u_int, int (*)(struct tdb *, void *, int), void *); /* XF_IP4 */
ipsec(4): add sockopt to manage additional udpencap ports
UDP-encapsulaton has two common use-cases: to make ESP work with NATs and to circumvent firewalls. Currently we only support a single UDP-encap port at a time, that is globally configured via sysctl. With an iked server, having a single client using a non-standard port to circumvent a firewall requires changing the global port. This in turn requires switching all other clients to use the same port if they are behind a NAT. Obviously that doesn't scale very well. The diff below adds a new UDP sockopt called UDP_ENCAP that can be used to enable receiving of UDP encapsulated IPsec packets on a bound port. This allows us to dynamically configure additional udpencap ports directly from the IKE daemon. The diff touches pledge to allow the new sockopt from a process with "inet" promise. The added attack surface seems low to me and "inet" feels like the right place for this kind of sockopt, but I'd be happy to hear more opinions on this. Feedback or ok? Index: sys/kern/kern_pledge.c === RCS file: /cvs/src/sys/kern/kern_pledge.c,v retrieving revision 1.275 diff -u -p -r1.275 kern_pledge.c --- sys/kern/kern_pledge.c 29 Jun 2021 01:46:35 - 1.275 +++ sys/kern/kern_pledge.c 25 Oct 2021 17:52:41 - @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -1417,6 +1418,12 @@ pledge_sockopt(struct proc *p, int set, case TCP_SACK_ENABLE: case TCP_MAXSEG: case TCP_NOPUSH: + return (0); + } + break; + case IPPROTO_UDP: + switch (optname) { + case UDP_ENCAP: return (0); } break; Index: sys/netinet/in_pcb.h === RCS file: /cvs/src/sys/netinet/in_pcb.h,v retrieving revision 1.121 diff -u -p -r1.121 in_pcb.h --- sys/netinet/in_pcb.h25 Jan 2021 03:40:46 - 1.121 +++ sys/netinet/in_pcb.h25 Oct 2021 17:52:41 - @@ -181,6 +181,7 @@ struct inpcbtable { #defineINP_RECVDSTPORT 0x200 /* receive IP dst addr before rdr */ #defineINP_RECVRTABLE 0x400 /* receive routing table */ #defineINP_IPSECFLOWINFO 0x800 /* receive IPsec flow info */ +#defineINP_UDPENCAP0x1000 /* check for UDP encapsulated ESP */ #defineINP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR| \ INP_RXSRCRT|INP_HOPLIMIT|INP_RECVIF|INP_RECVTTL|INP_RECVDSTPORT| \ Index: sys/netinet/in_proto.c === RCS file: /cvs/src/sys/netinet/in_proto.c,v retrieving revision 1.96 diff -u -p -r1.96 in_proto.c --- sys/netinet/in_proto.c 24 Oct 2021 22:59:47 - 1.96 +++ sys/netinet/in_proto.c 25 Oct 2021 17:52:41 - @@ -188,7 +188,7 @@ const struct protosw inetsw[] = { .pr_flags= PR_ATOMIC|PR_ADDR|PR_SPLICE, .pr_input= udp_input, .pr_ctlinput = udp_ctlinput, - .pr_ctloutput= ip_ctloutput, + .pr_ctloutput= udp_ctloutput, .pr_usrreq = udp_usrreq, .pr_attach = udp_attach, .pr_detach = udp_detach, Index: sys/netinet/udp.h === RCS file: /cvs/src/sys/netinet/udp.h,v retrieving revision 1.5 diff -u -p -r1.5 udp.h --- sys/netinet/udp.h 2 Jun 2003 23:28:15 - 1.5 +++ sys/netinet/udp.h 25 Oct 2021 17:52:41 - @@ -46,4 +46,14 @@ struct udphdr { u_int16_t uh_sum; /* udp checksum */ }; +/* + * User-settable options (used with setsockopt). + */ +#define UDP_ENCAP 0x01 + +/* + * UDP Encapsulation of IPsec Packets options. + */ +#define UDP_ENCAP_ESPINUDP 0x01 + #endif /* _NETINET_UDP_H_ */ Index: sys/netinet/udp_usrreq.c === RCS file: /cvs/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.263 diff -u -p -r1.263 udp_usrreq.c --- sys/netinet/udp_usrreq.c23 Oct 2021 22:19:37 - 1.263 +++ sys/netinet/udp_usrreq.c25 Oct 2021 17:52:41 - @@ -143,6 +143,8 @@ int udp_output(struct inpcb *, struct mb void udp_notify(struct inpcb *, int); intudp_sysctl_udpstat(void *, size_t *, void *); +static inline int udp_encap_input(struct mbuf **, int *, int, int); + #ifndefUDB_INITIAL_HASH_SIZE #defineUDB_INITIAL_HASH_SIZE 128 #endif @@ -154,6 +156,48 @@ udp_init(void) in_pcbinit(&udbtable, UDB_INITIAL_HASH_SIZE); } +static inline int +udp_encap_input(struct mbuf **mp, int *offp, int proto, int af) +{ + struct mbuf *m = *mp; + int iphlen = *offp; + u_int32_t spi; + int skip = iphlen + sizeof(struct udphdr); + int protoff; + + if (m->m_pkthdr.len - skip < sizeof(u_int32_t)) { + /* packet too short */ + m_freem(m);
rpki-client proc_parser cleanup
Refactor this code and instead of passing various things around just use globals. -- :wq Claudio Index: parser.c === RCS file: /cvs/src/usr.sbin/rpki-client/parser.c,v retrieving revision 1.16 diff -u -p -r1.16 parser.c --- parser.c23 Oct 2021 20:01:16 - 1.16 +++ parser.c25 Oct 2021 16:55:11 - @@ -38,20 +38,23 @@ #include "extern.h" static void build_chain(const struct auth *, STACK_OF(X509) **); -static struct crl *get_crl(const struct auth *, struct crl_tree *); +static struct crl *get_crl(const struct auth *); static void build_crls(const struct crl *, STACK_OF(X509_CRL) **); /* Limit how deep the RPKI tree can be. */ #defineMAX_CERT_DEPTH 12 +static X509_STORE_CTX *ctx; +static struct auth_tree auths = RB_INITIALIZER(&auths); +static struct crl_tree crlt = RB_INITIALIZER(&crlt); + /* * Parse and validate a ROA. * This is standard stuff. * Returns the roa on success, NULL on failure. */ static struct roa * -proc_parser_roa(struct entity *entp, X509_STORE_CTX *ctx, -struct auth_tree *auths, struct crl_tree *crlt) +proc_parser_roa(struct entity *entp) { struct roa *roa; X509*x509; @@ -64,10 +67,10 @@ proc_parser_roa(struct entity *entp, X50 if ((roa = roa_parse(&x509, entp->file)) == NULL) return NULL; - a = valid_ski_aki(entp->file, auths, roa->ski, roa->aki); + a = valid_ski_aki(entp->file, &auths, roa->ski, roa->aki); build_chain(a, &chain); - crl = get_crl(a, crlt); + crl = get_crl(a); build_crls(crl, &crls); assert(x509 != NULL); @@ -113,7 +116,7 @@ proc_parser_roa(struct entity *entp, X50 * the code around roa_read() to check the "valid" field itself. */ - if (valid_roa(entp->file, auths, roa)) + if (valid_roa(entp->file, &auths, roa)) roa->valid = 1; sk_X509_free(chain); @@ -134,8 +137,7 @@ proc_parser_roa(struct entity *entp, X50 * Return the mft on success or NULL on failure. */ static struct mft * -proc_parser_mft(struct entity *entp, X509_STORE_CTX *ctx, - struct auth_tree *auths, struct crl_tree *crlt) +proc_parser_mft(struct entity *entp) { struct mft *mft; X509*x509; @@ -146,7 +148,7 @@ proc_parser_mft(struct entity *entp, X50 if ((mft = mft_parse(&x509, entp->file)) == NULL) return NULL; - a = valid_ski_aki(entp->file, auths, mft->ski, mft->aki); + a = valid_ski_aki(entp->file, &auths, mft->ski, mft->aki); build_chain(a, &chain); if (!X509_STORE_CTX_init(ctx, NULL, x509, NULL)) @@ -187,8 +189,7 @@ proc_parser_mft(struct entity *entp, X50 * parse failure. */ static struct cert * -proc_parser_cert(const struct entity *entp, X509_STORE_CTX *ctx, -struct auth_tree *auths, struct crl_tree *crlt) +proc_parser_cert(const struct entity *entp) { struct cert *cert; X509*x509; @@ -205,9 +206,9 @@ proc_parser_cert(const struct entity *en if (cert == NULL) return NULL; - a = valid_ski_aki(entp->file, auths, cert->ski, cert->aki); + a = valid_ski_aki(entp->file, &auths, cert->ski, cert->aki); build_chain(a, &chain); - build_crls(get_crl(a, crlt), &crls); + build_crls(get_crl(a), &crls); assert(x509 != NULL); if (!X509_STORE_CTX_init(ctx, NULL, x509, NULL)) @@ -236,7 +237,7 @@ proc_parser_cert(const struct entity *en sk_X509_CRL_free(crls); /* Validate the cert to get the parent */ - if (!valid_cert(entp->file, auths, cert)) { + if (!valid_cert(entp->file, &auths, cert)) { X509_free(x509); // needed? XXX return cert; } @@ -262,7 +263,7 @@ proc_parser_cert(const struct entity *en if (na->fn == NULL) err(1, NULL); - if (RB_INSERT(auth_tree, auths, na) != NULL) + if (RB_INSERT(auth_tree, &auths, na) != NULL) err(1, "auth tree corrupted"); return cert; @@ -279,8 +280,7 @@ proc_parser_cert(const struct entity *en * parse failure. */ static struct cert * -proc_parser_root_cert(const struct entity *entp, X509_STORE_CTX *ctx, -struct auth_tree *auths, struct crl_tree *crlt) +proc_parser_root_cert(const struct entity *entp) { charsubject[256]; ASN1_TIME *notBefore, *notAfter; @@ -327,7 +327,7 @@ proc_parser_root_cert(const struct entit subject); goto badcert; } - if (!valid_ta(entp->file, auths, cert)) { + if (!valid_ta(entp->file, &auths, cert)) { warnx("%s: certificate not a valid ta, subject='%s'", entp->file, subject); goto badce
You have (2)One-Drive Document
OneDrive - File Sent To: [EMail] You have (1) new pending file on Onedrive: PO (4092).238kb Please advise availability, Thank you View File - PO (4092) Copyright © 2021 OneDrive, All rights reserved. Microsoft Corporation Want to change how you receive these emails? You can update your preferences or unsubscribe from this list..
Re: misspellings in i386/amd64 conf/GENERIC
On Mon, Oct 25, 2021 at 04:37:16PM +0200, Janne Johansson wrote: > (Reported by Elyes Haouas on irc) > > gmail probably will mangle the diff, but the replacement is quite simple. > ok. jmc > > Index: amd64/conf/GENERIC > === > RCS file: /cvs/src/sys/arch/amd64/conf/GENERIC,v > retrieving revision 1.503 > diff -u -p -u -r1.503 GENERIC > --- amd64/conf/GENERIC 21 Oct 2021 18:36:42 - 1.503 > +++ amd64/conf/GENERIC 25 Oct 2021 14:33:55 - > @@ -110,7 +110,7 @@ kate* at pci? # AMD K8 temperature > sen > km*at pci? # AMD K10 temperature sensor > ksmn* at pci? # AMD K17 temperature sensor > amas* at pci? disable # AMD memory configuration > -pchtemp* at pci? # Intel C610 termperature sensor > +pchtemp* at pci? # Intel C610 temperature sensor > ccp* at pci? # AMD Cryptographic Co-processor > > # National Semiconductor LM7[89] and compatible hardware monitors > Index: i386/conf/GENERIC > == > RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v > retrieving revision 1.858 > diff -u -p -u -r1.858 GENERIC > --- i386/conf/GENERIC 21 Oct 2021 18:36:42 - 1.858 > +++ i386/conf/GENERIC 25 Oct 2021 14:33:55 - > @@ -94,7 +94,7 @@ iic* at glxpcib? > kate* at pci? # AMD K8 temperature sensor > km*at pci? # AMD K10 temperature sensor > amas* at pci? disable # AMD memory configuration > -pchtemp* at pci? # Intel C610 termperature sensor > +pchtemp* at pci? # Intel C610 temperature sensor > > # power management and other environmental stuff > elansc*at pci? # AMD Elan SC520 System Controller > > > -- > May the most significant bit of your life be positive. >
Re: Add missing manpage for smtpd
On Mon, Oct 25, 2021 at 04:12:17PM +0100, Larry Hynes wrote: > Hi > > Crystal Kolipe wrote: > > I sent this to bugs@ a while back, but it seems to have been missed. > > > > smtpd-filters.7 is not installed by default. > > > > --- usr.sbin/smtpd/smtpd/Makefile.dist Wed Apr 21 04:54:10 2021 > > +++ usr.sbin/smtpd/smtpd/Makefile Mon Oct 25 11:54:39 2021 > > @@ -76,7 +76,7 @@ > > > > SRCS+= stat_ramstat.c > > > > -MAN= sendmail.8 smtpd.8 smtpd.conf.5 table.5 > > +MAN= sendmail.8 smtpd-filters.7 smtpd.8 smtpd.conf.5 table.5 > > BINDIR=/usr/sbin > > > > LDADD+=-levent -lutil -ltls -lssl -lcrypto -lz > > Following discussions with jmc@ and gilles@ I'm doing some work on the > English language on smtpd-filters.7 with a view to getting it installed. > yep, we'll hold off until you get a chance to go over it. jmc
Patch for 20 year old off by one bug
Another one I sent to bugs@ a while ago. I'm assuming that having 'i386' in the original subject line made everyone hit their 'd' key, without realizing that this affects amd64 too... The patch below fixes an off-by-one in /arch/amd64/stand/libsa/cmd_i386.c. The affected code path is handling the machine boot command in the bootloader. Currently, trying to boot from MBR partition 'a', with a command such as machine boot hd0a, will in fact boot from whichever partition is flagged as active, rather than forcing a boot from partition 'a'. The bug was introduced in revision 1.20 of the original i386 architecture file over 20 years ago on 19980224. untrusted comment: verify with signify key for exoticsilicon.com RWRn5d3Yx35u0w51USyxAkjCzjLo99UNE67gXzvuaTGbD9cMlTKdDTOAOe7JA6LV/VLWqmomwo7D9m399vKnra2KyrUn/EYcUgo= --- arch/amd64/stand/libsa/cmd_i386.c.dist Fri May 10 18:20:43 2019 +++ arch/amd64/stand/libsa/cmd_i386.c Sun Aug 15 23:44:45 2021 @@ -107,7 +107,7 @@ dev += (cmd.argv[1][2] - '0'); part = (cmd.argv[1][3] - 'a'); - if (part > 0) + if (part >= 0) printf("[%x,%d]\n", dev, part); else printf("[%x]\n", dev); @@ -119,7 +119,7 @@ goto bad; /* Frob boot flag in buffer from HD */ - if ((dev & 0x80) && (part > 0)){ + if ((dev & 0x80) && (part >= 0)){ int i, j; for (i = 0, j = DOSPARTOFF; i < 4; i++, j += 16) --- arch/i386/stand/libsa/cmd_i386.c.dist Fri Jun 10 15:36:06 2016 +++ arch/i386/stand/libsa/cmd_i386.cSun Aug 15 23:44:23 2021 @@ -119,7 +119,7 @@ dev += (cmd.argv[1][2] - '0'); part = (cmd.argv[1][3] - 'a'); - if (part > 0) + if (part >= 0) printf("[%x,%d]\n", dev, part); else printf("[%x]\n", dev); @@ -131,7 +131,7 @@ goto bad; /* Frob boot flag in buffer from HD */ - if ((dev & 0x80) && (part > 0)){ + if ((dev & 0x80) && (part >= 0)){ int i, j; for (i = 0, j = DOSPARTOFF; i < 4; i++, j += 16)
Re: bootloader: remove unsued variables
> Date: Mon, 25 Oct 2021 16:44:48 +0200 > From: Patrick Wildt > > Hi, > > this fixes the build of sys/arch/amd64/stand with LLVM 13. > > ok? ok kettenis@ > diff --git a/sys/lib/libsa/netif.c b/sys/lib/libsa/netif.c > index d1a5e180291..79c6496878e 100644 > --- a/sys/lib/libsa/netif.c > +++ b/sys/lib/libsa/netif.c > @@ -85,7 +85,7 @@ netif_match(struct netif *nif, void *machdep_hint) > struct netif * > netif_select(void *machdep_hint) > { > - int d, u, unit_done, s; > + int d, u, s; > struct netif_driver *drv; > struct netif cur_if; > static struct netif best_if; > @@ -106,7 +106,6 @@ netif_select(void *machdep_hint) > > for (u = 0; u < drv->netif_nifs; u++) { > cur_if.nif_unit = u; > - unit_done = 0; > > #ifdef NETIF_DEBUG > if (netif_debug) > diff --git a/sys/lib/libsa/tftp.c b/sys/lib/libsa/tftp.c > index 3eea8bbe66e..6bfca23a761 100644 > --- a/sys/lib/libsa/tftp.c > +++ b/sys/lib/libsa/tftp.c > @@ -383,9 +383,6 @@ tftp_write(struct open_file *f, void *start, size_t size, > size_t *resid) > int > tftp_stat(struct open_file *f, struct stat *sb) > { > - struct tftp_handle *tftpfile; > - tftpfile = (struct tftp_handle *) f->f_fsdata; > - > sb->st_mode = 0444; > sb->st_nlink = 1; > sb->st_uid = 0; > >
Add missing manpage for smtpd
I sent this to bugs@ a while back, but it seems to have been missed. smtpd-filters.7 is not installed by default. --- usr.sbin/smtpd/smtpd/Makefile.dist Wed Apr 21 04:54:10 2021 +++ usr.sbin/smtpd/smtpd/Makefile Mon Oct 25 11:54:39 2021 @@ -76,7 +76,7 @@ SRCS+= stat_ramstat.c -MAN= sendmail.8 smtpd.8 smtpd.conf.5 table.5 +MAN= sendmail.8 smtpd-filters.7 smtpd.8 smtpd.conf.5 table.5 BINDIR=/usr/sbin LDADD+=-levent -lutil -ltls -lssl -lcrypto -lz
bootloader: remove unsued variables
Hi, this fixes the build of sys/arch/amd64/stand with LLVM 13. ok? Patrick diff --git a/sys/lib/libsa/netif.c b/sys/lib/libsa/netif.c index d1a5e180291..79c6496878e 100644 --- a/sys/lib/libsa/netif.c +++ b/sys/lib/libsa/netif.c @@ -85,7 +85,7 @@ netif_match(struct netif *nif, void *machdep_hint) struct netif * netif_select(void *machdep_hint) { - int d, u, unit_done, s; + int d, u, s; struct netif_driver *drv; struct netif cur_if; static struct netif best_if; @@ -106,7 +106,6 @@ netif_select(void *machdep_hint) for (u = 0; u < drv->netif_nifs; u++) { cur_if.nif_unit = u; - unit_done = 0; #ifdef NETIF_DEBUG if (netif_debug) diff --git a/sys/lib/libsa/tftp.c b/sys/lib/libsa/tftp.c index 3eea8bbe66e..6bfca23a761 100644 --- a/sys/lib/libsa/tftp.c +++ b/sys/lib/libsa/tftp.c @@ -383,9 +383,6 @@ tftp_write(struct open_file *f, void *start, size_t size, size_t *resid) int tftp_stat(struct open_file *f, struct stat *sb) { - struct tftp_handle *tftpfile; - tftpfile = (struct tftp_handle *) f->f_fsdata; - sb->st_mode = 0444; sb->st_nlink = 1; sb->st_uid = 0;
Re: some warnings in prep for LLVM 13
On Mon, Oct 25 2021, Mark Kettenis wrote: >> From: Jeremie Courreges-Anglas >> Date: Mon, 25 Oct 2021 14:55:16 +0100 >> >> On Mon, Oct 25 2021, Mark Kettenis wrote: >> >> Date: Mon, 25 Oct 2021 12:37:41 +0200 (CEST) >> >> From: Mark Kettenis >> >> >> >> > Date: Mon, 25 Oct 2021 12:01:11 +0200 >> >> > From: Patrick Wildt >> >> > >> >> > Hi, >> >> > >> >> > mortimer@ has this diff in his tree for LLVM 13. I actually haven't >> >> > tried to see if it works fine with LLVM 11, but I feel it needs to be >> >> > sent out and not just be blindly committed. >> >> > >> >> > If someone wants to take care of this, it would be nice, so I can take >> >> > care of the remaining parts of sending out the LLVM 13 diff. >> >> >> >> > diff --git a/lib/libc/arch/amd64/sys/brk.S >> >> > b/lib/libc/arch/amd64/sys/brk.S >> >> > index ce69679e389..ee1c11f7643 100644 >> >> > --- a/lib/libc/arch/amd64/sys/brk.S >> >> > +++ b/lib/libc/arch/amd64/sys/brk.S >> >> > @@ -48,7 +48,6 @@ __minbrk: >> >> > END(__minbrk) >> >> > .type __minbrk,@object >> >> > >> >> > - .weak brk >> >> > ENTRY(brk) >> >> > cmpq%rdi,__minbrk(%rip) >> >> > jb 1f >> >> > diff --git a/lib/libc/arch/amd64/sys/sbrk.S >> >> > b/lib/libc/arch/amd64/sys/sbrk.S >> >> > index 8d7d68909b2..db53a6bb643 100644 >> >> > --- a/lib/libc/arch/amd64/sys/sbrk.S >> >> > +++ b/lib/libc/arch/amd64/sys/sbrk.S >> >> > @@ -53,7 +53,6 @@ __curbrk: >> >> > END(__curbrk) >> >> > .type __curbrk,@object >> >> > >> >> > - .weak sbrk >> >> > ENTRY(sbrk) >> >> > movq__curbrk(%rip),%rax >> >> > movslq %edi,%rsi >> >> >> >> These functions are supposed to be weak, like they are on >> >> architectures that use a C implementation. I suppose the .weak >> >> directive needs to come *after* the .global emitted by ENTRY(). >> >> Putting it after the END() works. >> > >> > So I think the diff below is what we want here. >> >> There are others left: >> >> russell /usr/src/lib/libc$ grep -B 1 -R ^ENTRY | grep -A 1 weak >> arch/i386/sys/brk.S-.weak brk >> arch/i386/sys/brk.S:ENTRY(brk) >> arch/i386/sys/sbrk.S- .weak sbrk >> arch/i386/sys/sbrk.S:ENTRY(sbrk) >> arch/riscv64/sys/sbrk.S-.weak sbrk >> arch/riscv64/sys/sbrk.S:ENTRY(sbrk) >> arch/riscv64/sys/brk.S- .weak brk >> arch/riscv64/sys/brk.S:ENTRY(brk) >> >> (and a few others where grep -B 1 isn't enough) >> >> > ok? >> >> I checked that the resulting .*o files are the same on amd64, sparc64 >> and riscv64. Actually I have messed up my tests on amd64 and riscv64, where these changes *do* fix a problem and re-add the weak attribute to the affected symbol in the object files. >> ok jca@ >> >> Here's the diff for the other architectures. I didn't touch m88k, which >> won't use clang anytime soon. Also ok? > > ok kettenis@ Committed, thanks. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
misspellings in i386/amd64 conf/GENERIC
(Reported by Elyes Haouas on irc) gmail probably will mangle the diff, but the replacement is quite simple. Index: amd64/conf/GENERIC === RCS file: /cvs/src/sys/arch/amd64/conf/GENERIC,v retrieving revision 1.503 diff -u -p -u -r1.503 GENERIC --- amd64/conf/GENERIC 21 Oct 2021 18:36:42 - 1.503 +++ amd64/conf/GENERIC 25 Oct 2021 14:33:55 - @@ -110,7 +110,7 @@ kate* at pci? # AMD K8 temperature sen km*at pci? # AMD K10 temperature sensor ksmn* at pci? # AMD K17 temperature sensor amas* at pci? disable # AMD memory configuration -pchtemp* at pci? # Intel C610 termperature sensor +pchtemp* at pci? # Intel C610 temperature sensor ccp* at pci? # AMD Cryptographic Co-processor # National Semiconductor LM7[89] and compatible hardware monitors Index: i386/conf/GENERIC == RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v retrieving revision 1.858 diff -u -p -u -r1.858 GENERIC --- i386/conf/GENERIC 21 Oct 2021 18:36:42 - 1.858 +++ i386/conf/GENERIC 25 Oct 2021 14:33:55 - @@ -94,7 +94,7 @@ iic* at glxpcib? kate* at pci? # AMD K8 temperature sensor km*at pci? # AMD K10 temperature sensor amas* at pci? disable # AMD memory configuration -pchtemp* at pci? # Intel C610 termperature sensor +pchtemp* at pci? # Intel C610 temperature sensor # power management and other environmental stuff elansc*at pci? # AMD Elan SC520 System Controller -- May the most significant bit of your life be positive.
Re: some warnings in prep for LLVM 13
> From: Jeremie Courreges-Anglas > Date: Mon, 25 Oct 2021 14:55:16 +0100 > > On Mon, Oct 25 2021, Mark Kettenis wrote: > >> Date: Mon, 25 Oct 2021 12:37:41 +0200 (CEST) > >> From: Mark Kettenis > >> > >> > Date: Mon, 25 Oct 2021 12:01:11 +0200 > >> > From: Patrick Wildt > >> > > >> > Hi, > >> > > >> > mortimer@ has this diff in his tree for LLVM 13. I actually haven't > >> > tried to see if it works fine with LLVM 11, but I feel it needs to be > >> > sent out and not just be blindly committed. > >> > > >> > If someone wants to take care of this, it would be nice, so I can take > >> > care of the remaining parts of sending out the LLVM 13 diff. > >> > >> > diff --git a/lib/libc/arch/amd64/sys/brk.S > >> > b/lib/libc/arch/amd64/sys/brk.S > >> > index ce69679e389..ee1c11f7643 100644 > >> > --- a/lib/libc/arch/amd64/sys/brk.S > >> > +++ b/lib/libc/arch/amd64/sys/brk.S > >> > @@ -48,7 +48,6 @@ __minbrk: > >> > END(__minbrk) > >> > .type __minbrk,@object > >> > > >> > -.weak brk > >> > ENTRY(brk) > >> > cmpq%rdi,__minbrk(%rip) > >> > jb 1f > >> > diff --git a/lib/libc/arch/amd64/sys/sbrk.S > >> > b/lib/libc/arch/amd64/sys/sbrk.S > >> > index 8d7d68909b2..db53a6bb643 100644 > >> > --- a/lib/libc/arch/amd64/sys/sbrk.S > >> > +++ b/lib/libc/arch/amd64/sys/sbrk.S > >> > @@ -53,7 +53,6 @@ __curbrk: > >> > END(__curbrk) > >> > .type __curbrk,@object > >> > > >> > -.weak sbrk > >> > ENTRY(sbrk) > >> > movq__curbrk(%rip),%rax > >> > movslq %edi,%rsi > >> > >> These functions are supposed to be weak, like they are on > >> architectures that use a C implementation. I suppose the .weak > >> directive needs to come *after* the .global emitted by ENTRY(). > >> Putting it after the END() works. > > > > So I think the diff below is what we want here. > > There are others left: > > russell /usr/src/lib/libc$ grep -B 1 -R ^ENTRY | grep -A 1 weak > arch/i386/sys/brk.S-.weak brk > arch/i386/sys/brk.S:ENTRY(brk) > arch/i386/sys/sbrk.S- .weak sbrk > arch/i386/sys/sbrk.S:ENTRY(sbrk) > arch/riscv64/sys/sbrk.S-.weak sbrk > arch/riscv64/sys/sbrk.S:ENTRY(sbrk) > arch/riscv64/sys/brk.S- .weak brk > arch/riscv64/sys/brk.S:ENTRY(brk) > > (and a few others where grep -B 1 isn't enough) > > > ok? > > I checked that the resulting .*o files are the same on amd64, sparc64 > and riscv64. ok jca@ > > Here's the diff for the other architectures. I didn't touch m88k, which > won't use clang anytime soon. Also ok? ok kettenis@ > Index: arch/arm/sys/brk.S > === > RCS file: /cvs/src/lib/libc/arch/arm/sys/brk.S,v > retrieving revision 1.10 > diff -u -p -r1.10 brk.S > --- arch/arm/sys/brk.S21 Nov 2017 19:08:36 - 1.10 > +++ arch/arm/sys/brk.S25 Oct 2021 13:48:05 - > @@ -44,8 +44,6 @@ __minbrk: > .word _C_LABEL(_end) > END(__minbrk) > > - .weak brk > - > /* > * Change the data segment size > */ > @@ -96,3 +94,4 @@ ENTRY(brk) > .Lcurbrk: > .word PIC_SYM(__curbrk, GOT) > END(brk) > + .weak brk > Index: arch/arm/sys/sbrk.S > === > RCS file: /cvs/src/lib/libc/arch/arm/sys/sbrk.S,v > retrieving revision 1.10 > diff -u -p -r1.10 sbrk.S > --- arch/arm/sys/sbrk.S 21 Nov 2017 19:08:36 - 1.10 > +++ arch/arm/sys/sbrk.S 25 Oct 2021 13:48:05 - > @@ -45,7 +45,6 @@ __curbrk: > .word _C_LABEL(_end) > END(__curbrk) > > - .weak sbrk > /* > * Change the data segment size > */ > @@ -85,3 +84,4 @@ ENTRY(sbrk) > .Lcurbrk: > .word PIC_SYM(__curbrk, GOT) > END(sbrk) > + .weak sbrk > Index: arch/i386/sys/brk.S > === > RCS file: /cvs/src/lib/libc/arch/i386/sys/brk.S,v > retrieving revision 1.13 > diff -u -p -r1.13 brk.S > --- arch/i386/sys/brk.S 19 Aug 2017 18:24:06 - 1.13 > +++ arch/i386/sys/brk.S 25 Oct 2021 13:48:05 - > @@ -42,7 +42,6 @@ __minbrk: > END(__minbrk) > .type __minbrk,@object > > - .weak brk > ENTRY(brk) > #ifdef __PIC__ > movl4(%esp),%ecx > @@ -82,3 +81,4 @@ ENTRY(brk) > SET_ERRNO() > ret > END(brk) > + .weak brk > Index: arch/i386/sys/sbrk.S > === > RCS file: /cvs/src/lib/libc/arch/i386/sys/sbrk.S,v > retrieving revision 1.13 > diff -u -p -r1.13 sbrk.S > --- arch/i386/sys/sbrk.S 19 Aug 2017 18:24:06 - 1.13 > +++ arch/i386/sys/sbrk.S 25 Oct 2021 13:48:05 - > @@ -42,7 +42,6 @@ __curbrk: .long _end > END(__curbrk) > .type __curbrk,@object > > - .weak sbrk > ENTRY(sbrk) > #ifdef __PIC__ > movl4(%esp),%ecx > @@ -76,3 +75,4 @@ ENTRY(sbrk) > SET_ERRNO() > ret > END(sbrk) >
ipsec tdb hash mutext
Hi, Protect the tdb hashes with a mutex. ok? bluhm Index: netinet/ip_ipsp.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipsp.c,v retrieving revision 1.246 diff -u -p -r1.246 ip_ipsp.c --- netinet/ip_ipsp.c 13 Oct 2021 14:36:31 - 1.246 +++ netinet/ip_ipsp.c 25 Oct 2021 14:00:18 - @@ -84,7 +84,7 @@ void tdb_hashstats(void); do { } while (0) #endif -void tdb_rehash(void); +inttdb_rehash(void); void tdb_reaper(void *); void tdb_timeout(void *); void tdb_firstuse(void *); @@ -186,11 +186,12 @@ const struct xformsw *const xformswNXFOR #defineTDB_HASHSIZE_INIT 32 -/* Protected by the NET_LOCK(). */ +/* Protected by the tdb_sadb_mtx. */ +struct mutex tdb_sadb_mtx = MUTEX_INITIALIZER(IPL_NET); static SIPHASH_KEY tdbkey; -static struct tdb **tdbh = NULL; -static struct tdb **tdbdst = NULL; -static struct tdb **tdbsrc = NULL; +static struct tdb **tdbh; +static struct tdb **tdbdst; +static struct tdb **tdbsrc; static u_int tdb_hashmask = TDB_HASHSIZE_INIT - 1; static int tdb_count; @@ -199,6 +200,14 @@ ipsp_init(void) { pool_init(&tdb_pool, sizeof(struct tdb), 0, IPL_SOFTNET, 0, "tdb", NULL); + + arc4random_buf(&tdbkey, sizeof(tdbkey)); + tdbh = mallocarray(tdb_hashmask + 1, sizeof(struct tdb *), M_TDB, + M_WAITOK | M_ZERO); + tdbdst = mallocarray(tdb_hashmask + 1, sizeof(struct tdb *), M_TDB, + M_WAITOK | M_ZERO); + tdbsrc = mallocarray(tdb_hashmask + 1, sizeof(struct tdb *), M_TDB, + M_WAITOK | M_ZERO); } /* @@ -211,7 +220,7 @@ tdb_hash(u_int32_t spi, union sockaddr_u { SIPHASH_CTX ctx; - NET_ASSERT_LOCKED(); + MUTEX_ASSERT_LOCKED(&tdb_sadb_mtx); SipHash24_Init(&ctx, &tdbkey); SipHash24_Update(&ctx, &spi, sizeof(spi)); @@ -332,11 +341,7 @@ gettdb_dir(u_int rdomain, u_int32_t spi, u_int32_t hashval; struct tdb *tdbp; - NET_ASSERT_LOCKED(); - - if (tdbh == NULL) - return (struct tdb *) NULL; - + mtx_enter(&tdb_sadb_mtx); hashval = tdb_hash(spi, dst, proto); for (tdbp = tdbh[hashval]; tdbp != NULL; tdbp = tdbp->tdb_hnext) @@ -346,6 +351,7 @@ gettdb_dir(u_int rdomain, u_int32_t spi, !memcmp(&tdbp->tdb_dst, dst, dst->sa.sa_len)) break; + mtx_leave(&tdb_sadb_mtx); return tdbp; } @@ -362,11 +368,7 @@ gettdbbysrcdst_dir(u_int rdomain, u_int3 struct tdb *tdbp; union sockaddr_union su_null; - NET_ASSERT_LOCKED(); - - if (tdbsrc == NULL) - return (struct tdb *) NULL; - + mtx_enter(&tdb_sadb_mtx); hashval = tdb_hash(0, src, proto); for (tdbp = tdbsrc[hashval]; tdbp != NULL; tdbp = tdbp->tdb_snext) @@ -380,8 +382,10 @@ gettdbbysrcdst_dir(u_int rdomain, u_int3 !memcmp(&tdbp->tdb_src, src, src->sa.sa_len)) break; - if (tdbp != NULL) - return (tdbp); + if (tdbp != NULL) { + mtx_leave(&tdb_sadb_mtx); + return tdbp; + } memset(&su_null, 0, sizeof(su_null)); su_null.sa.sa_len = sizeof(struct sockaddr); @@ -398,7 +402,8 @@ gettdbbysrcdst_dir(u_int rdomain, u_int3 tdbp->tdb_src.sa.sa_family == AF_UNSPEC) break; - return (tdbp); + mtx_leave(&tdb_sadb_mtx); + return tdbp; } /* @@ -450,11 +455,7 @@ gettdbbydst(u_int rdomain, union sockadd u_int32_t hashval; struct tdb *tdbp; - NET_ASSERT_LOCKED(); - - if (tdbdst == NULL) - return (struct tdb *) NULL; - + mtx_enter(&tdb_sadb_mtx); hashval = tdb_hash(0, dst, sproto); for (tdbp = tdbdst[hashval]; tdbp != NULL; tdbp = tdbp->tdb_dnext) @@ -462,12 +463,13 @@ gettdbbydst(u_int rdomain, union sockadd (tdbp->tdb_rdomain == rdomain) && ((tdbp->tdb_flags & TDBF_INVALID) == 0) && (!memcmp(&tdbp->tdb_dst, dst, dst->sa.sa_len))) { - /* Do IDs match ? */ + /* Check whether IDs match */ if (!ipsp_aux_match(tdbp, ids, filter, filtermask)) continue; break; } + mtx_leave(&tdb_sadb_mtx); return tdbp; } @@ -483,11 +485,7 @@ gettdbbysrc(u_int rdomain, union sockadd u_int32_t hashval; struct tdb *tdbp; - NET_ASSERT_LOCKED(); - - if (tdbsrc == NULL) - return (struct tdb *) NULL; - + mtx_enter(&tdb_sadb_mtx); hashval = tdb_hash(0, src, sproto); for (tdbp = tdbsrc[hashval]; tdbp != NULL; tdbp = tdbp->tdb_snext) @@ -496,16 +494,16 @@ gettdbbysrc(u_int rdomain, union sockadd
Re: some warnings in prep for LLVM 13
On Mon, Oct 25 2021, Mark Kettenis wrote: >> Date: Mon, 25 Oct 2021 12:37:41 +0200 (CEST) >> From: Mark Kettenis >> >> > Date: Mon, 25 Oct 2021 12:01:11 +0200 >> > From: Patrick Wildt >> > >> > Hi, >> > >> > mortimer@ has this diff in his tree for LLVM 13. I actually haven't >> > tried to see if it works fine with LLVM 11, but I feel it needs to be >> > sent out and not just be blindly committed. >> > >> > If someone wants to take care of this, it would be nice, so I can take >> > care of the remaining parts of sending out the LLVM 13 diff. >> >> > diff --git a/lib/libc/arch/amd64/sys/brk.S b/lib/libc/arch/amd64/sys/brk.S >> > index ce69679e389..ee1c11f7643 100644 >> > --- a/lib/libc/arch/amd64/sys/brk.S >> > +++ b/lib/libc/arch/amd64/sys/brk.S >> > @@ -48,7 +48,6 @@ __minbrk: >> >END(__minbrk) >> >.type __minbrk,@object >> > >> > - .weak brk >> > ENTRY(brk) >> >cmpq%rdi,__minbrk(%rip) >> >jb 1f >> > diff --git a/lib/libc/arch/amd64/sys/sbrk.S >> > b/lib/libc/arch/amd64/sys/sbrk.S >> > index 8d7d68909b2..db53a6bb643 100644 >> > --- a/lib/libc/arch/amd64/sys/sbrk.S >> > +++ b/lib/libc/arch/amd64/sys/sbrk.S >> > @@ -53,7 +53,6 @@ __curbrk: >> >END(__curbrk) >> >.type __curbrk,@object >> > >> > - .weak sbrk >> > ENTRY(sbrk) >> >movq__curbrk(%rip),%rax >> >movslq %edi,%rsi >> >> These functions are supposed to be weak, like they are on >> architectures that use a C implementation. I suppose the .weak >> directive needs to come *after* the .global emitted by ENTRY(). >> Putting it after the END() works. > > So I think the diff below is what we want here. There are others left: russell /usr/src/lib/libc$ grep -B 1 -R ^ENTRY | grep -A 1 weak arch/i386/sys/brk.S-.weak brk arch/i386/sys/brk.S:ENTRY(brk) arch/i386/sys/sbrk.S- .weak sbrk arch/i386/sys/sbrk.S:ENTRY(sbrk) arch/riscv64/sys/sbrk.S-.weak sbrk arch/riscv64/sys/sbrk.S:ENTRY(sbrk) arch/riscv64/sys/brk.S- .weak brk arch/riscv64/sys/brk.S:ENTRY(brk) (and a few others where grep -B 1 isn't enough) > ok? I checked that the resulting .*o files are the same on amd64, sparc64 and riscv64. ok jca@ Here's the diff for the other architectures. I didn't touch m88k, which won't use clang anytime soon. Also ok? Index: arch/arm/sys/brk.S === RCS file: /cvs/src/lib/libc/arch/arm/sys/brk.S,v retrieving revision 1.10 diff -u -p -r1.10 brk.S --- arch/arm/sys/brk.S 21 Nov 2017 19:08:36 - 1.10 +++ arch/arm/sys/brk.S 25 Oct 2021 13:48:05 - @@ -44,8 +44,6 @@ __minbrk: .word _C_LABEL(_end) END(__minbrk) - .weak brk - /* * Change the data segment size */ @@ -96,3 +94,4 @@ ENTRY(brk) .Lcurbrk: .word PIC_SYM(__curbrk, GOT) END(brk) + .weak brk Index: arch/arm/sys/sbrk.S === RCS file: /cvs/src/lib/libc/arch/arm/sys/sbrk.S,v retrieving revision 1.10 diff -u -p -r1.10 sbrk.S --- arch/arm/sys/sbrk.S 21 Nov 2017 19:08:36 - 1.10 +++ arch/arm/sys/sbrk.S 25 Oct 2021 13:48:05 - @@ -45,7 +45,6 @@ __curbrk: .word _C_LABEL(_end) END(__curbrk) - .weak sbrk /* * Change the data segment size */ @@ -85,3 +84,4 @@ ENTRY(sbrk) .Lcurbrk: .word PIC_SYM(__curbrk, GOT) END(sbrk) + .weak sbrk Index: arch/i386/sys/brk.S === RCS file: /cvs/src/lib/libc/arch/i386/sys/brk.S,v retrieving revision 1.13 diff -u -p -r1.13 brk.S --- arch/i386/sys/brk.S 19 Aug 2017 18:24:06 - 1.13 +++ arch/i386/sys/brk.S 25 Oct 2021 13:48:05 - @@ -42,7 +42,6 @@ __minbrk: END(__minbrk) .type __minbrk,@object - .weak brk ENTRY(brk) #ifdef __PIC__ movl4(%esp),%ecx @@ -82,3 +81,4 @@ ENTRY(brk) SET_ERRNO() ret END(brk) + .weak brk Index: arch/i386/sys/sbrk.S === RCS file: /cvs/src/lib/libc/arch/i386/sys/sbrk.S,v retrieving revision 1.13 diff -u -p -r1.13 sbrk.S --- arch/i386/sys/sbrk.S19 Aug 2017 18:24:06 - 1.13 +++ arch/i386/sys/sbrk.S25 Oct 2021 13:48:05 - @@ -42,7 +42,6 @@ __curbrk: .long _end END(__curbrk) .type __curbrk,@object - .weak sbrk ENTRY(sbrk) #ifdef __PIC__ movl4(%esp),%ecx @@ -76,3 +75,4 @@ ENTRY(sbrk) SET_ERRNO() ret END(sbrk) + .weak sbrk Index: arch/powerpc/sys/brk.S === RCS file: /cvs/src/lib/libc/arch/powerpc/sys/brk.S,v retrieving revision 1.15 diff -u -p -r1.15 brk.S --- arch/powerpc/sys/brk.S 26 Oct 2020 22:07:05 - 1.15 +++ arch/powerpc/sys/brk.S 25 Oct 2021 13:48:05 - @@ -30,8 +30,6 @@ .extern __curbrk .extern _C_LABEL(_end) - .weak brk
Re: vi(1): fix use after free, sigabrt
On Mon, 25 Oct 2021 09:13:40 -0400, Dave Voutila wrote: > I don't know the vi codebase, so I can't tell if this is the right way > to fix this. It's a minimal change, but I use vi mostly for quick edits > and commit messages so would appreciate anyone with more knowledge here > to chime in. With the leak of ep fixed this is OK millert@ - todd
Re: Stop mentioning ld(1) warning messages in mktemp.3 and tmpnam.3
On Mon, 25 Oct 2021 12:48:01 +1100, Jonathan Gray wrote: > Shouldn't lld instead be changed to show warnings? That was my thinking as well. - todd
vi(1): fix use after free, sigabrt
As reported by kn@ on bugs [1], here's a fix for the issue. In short, if you start vi(1)/ex(1) with a named buffer that's not associated with an existing file and then run the ex_edit command (:e) with zero args, it frees strings for the name of the buffer and the temp file. At quit, the cleanup code tries to re-use those values still referenced by the screen. [1] https://marc.info/?l=openbsd-bugs&w=2 I don't know the vi codebase, so I can't tell if this is the right way to fix this. It's a minimal change, but I use vi mostly for quick edits and commit messages so would appreciate anyone with more knowledge here to chime in. Feedback or OK? -dv Reproduction (via ex since it's easier to show in email): minmin[vi]$ ex foo foo: new file: line 1 :e :e bar File is a temporary; exit will discard modifications :q! ex(23987) in free(): write after free 0x26bc2314ec0 Abort trap (core dumped) minmin[vi]$ build/obj/vi -e foo foo: new file: line 1 :e :e bar bar: new file: line 1 :q! minmin[vi]$ echo $? 0 Some additional context to that "goto err" in the diff: 381 err: 382 free(frp->name); 383 frp->name = NULL; 384 if (frp->tname != NULL) { 385 (void)unlink(frp->tname); 386 free(frp->tname); 387 frp->tname = NULL; 388 } The diff: diff 8095b13035d3c80c255344b9166e7f4ff88e61e3 /usr/src blob - 0b6ae026533e5696a31f4bd87291ccd1d7d5e58f file + usr.bin/vi/common/exf.c --- usr.bin/vi/common/exf.c +++ usr.bin/vi/common/exf.c @@ -170,12 +170,20 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flag * If no name or backing file, for whatever reason, create a backing * temporary file, saving the temp file name so we can later unlink * it. If the user never named this file, copy the temporary file name * to the real name (we display that until the user renames it). */ oname = frp->name; + + /* +* User is editing a named file that doesn't exist yet other than as a +* temporary file. +*/ + if (!exists && oname != NULL && frp->tname != NULL) + return (1); + if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) { /* * Don't try to create a temporary support file twice. */ if (frp->tname != NULL) goto err;
Re: some warnings in prep for LLVM 13
> Date: Mon, 25 Oct 2021 12:37:41 +0200 (CEST) > From: Mark Kettenis > > > Date: Mon, 25 Oct 2021 12:01:11 +0200 > > From: Patrick Wildt > > > > Hi, > > > > mortimer@ has this diff in his tree for LLVM 13. I actually haven't > > tried to see if it works fine with LLVM 11, but I feel it needs to be > > sent out and not just be blindly committed. > > > > If someone wants to take care of this, it would be nice, so I can take > > care of the remaining parts of sending out the LLVM 13 diff. > > > diff --git a/lib/libc/arch/amd64/sys/brk.S b/lib/libc/arch/amd64/sys/brk.S > > index ce69679e389..ee1c11f7643 100644 > > --- a/lib/libc/arch/amd64/sys/brk.S > > +++ b/lib/libc/arch/amd64/sys/brk.S > > @@ -48,7 +48,6 @@ __minbrk: > > END(__minbrk) > > .type __minbrk,@object > > > > - .weak brk > > ENTRY(brk) > > cmpq%rdi,__minbrk(%rip) > > jb 1f > > diff --git a/lib/libc/arch/amd64/sys/sbrk.S b/lib/libc/arch/amd64/sys/sbrk.S > > index 8d7d68909b2..db53a6bb643 100644 > > --- a/lib/libc/arch/amd64/sys/sbrk.S > > +++ b/lib/libc/arch/amd64/sys/sbrk.S > > @@ -53,7 +53,6 @@ __curbrk: > > END(__curbrk) > > .type __curbrk,@object > > > > - .weak sbrk > > ENTRY(sbrk) > > movq__curbrk(%rip),%rax > > movslq %edi,%rsi > > These functions are supposed to be weak, like they are on > architectures that use a C implementation. I suppose the .weak > directive needs to come *after* the .global emitted by ENTRY(). > Putting it after the END() works. So I think the diff below is what we want here. ok? Index: lib/libc/arch/amd64/sys/brk.S === RCS file: /cvs/src/lib/libc/arch/amd64/sys/brk.S,v retrieving revision 1.10 diff -u -p -r1.10 brk.S --- lib/libc/arch/amd64/sys/brk.S 19 Aug 2017 18:24:06 - 1.10 +++ lib/libc/arch/amd64/sys/brk.S 25 Oct 2021 12:13:57 - @@ -48,7 +48,6 @@ __minbrk: END(__minbrk) .type __minbrk,@object - .weak brk ENTRY(brk) cmpq%rdi,__minbrk(%rip) jb 1f @@ -63,3 +62,4 @@ ENTRY(brk) SET_ERRNO ret END(brk) + .weak brk Index: lib/libc/arch/amd64/sys/sbrk.S === RCS file: /cvs/src/lib/libc/arch/amd64/sys/sbrk.S,v retrieving revision 1.10 diff -u -p -r1.10 sbrk.S --- lib/libc/arch/amd64/sys/sbrk.S 19 Aug 2017 18:24:06 - 1.10 +++ lib/libc/arch/amd64/sys/sbrk.S 25 Oct 2021 12:13:57 - @@ -53,7 +53,6 @@ __curbrk: END(__curbrk) .type __curbrk,@object - .weak sbrk ENTRY(sbrk) movq__curbrk(%rip),%rax movslq %edi,%rsi @@ -68,3 +67,4 @@ ENTRY(sbrk) SET_ERRNO ret END(sbrk) + .weak sbrk
Re: some warnings in prep for LLVM 13
On Mon, Oct 25, 2021 at 01:46:51PM +0200, Sebastien Marie wrote: > I have a working llvm13 here for building zig 0.9.0-dev. > > /usr/src/usr.bin/openssl/s_client.c:897:16: error: variable 'pbuf_off' set > but not used [-Werror,-Wunused-but-set-variable] > int pbuf_len, pbuf_off; > ^ > /usr/src/usr.bin/openssl/s_client.c:897:6: error: variable 'pbuf_len' set but > not used [-Werror,-Wunused-but-set-variable] > int pbuf_len, pbuf_off; > ^ Thanks. Your tree is slightly out of date. I removed pbuf_off already but missed that I could remove pbuf_len for the same reason. > > Your call regarding the 2nd & 3rd. If that structure really can be used > > in multiple files then "static" is probably not appropriate. Or maybe > > the structure should just be moved to x509/x509_lib.c. I missed this on review of job's addition of the RFC 3779 support. These files should not include this. I already gave an ok for all three diffs.
Re: some warnings in prep for LLVM 13
On Mon, Oct 25, 2021 at 12:35:03PM +0100, Jeremie Courreges-Anglas wrote: > On Mon, Oct 25 2021, Theo Buehler wrote: > >> index 664a5200037..e33763e7420 100644 > >> --- a/usr.bin/openssl/Makefile > >> +++ b/usr.bin/openssl/Makefile > >> @@ -17,6 +17,7 @@ CFLAGS+= -Wuninitialized > >> CFLAGS+= -Wunused > >> .if ${COMPILER_VERSION:L} == "clang" > >> CFLAGS+= -Werror > >> +CFLAGS+= -Wno-unused-but-set-variable > > > > This will break the build with LLVM 11 because of -Werror: > > > > error: unknown warning option '-Wno-unused-but-set-variable'; did you mean > > '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] > > *** Error 1 in /usr/src/usr.bin/openssl (:87 'apps.o') > > > > Also, it would be nice to know what triggered this addition. I have a working llvm13 here for building zig 0.9.0-dev. /usr/src/usr.bin/openssl/s_client.c:897:16: error: variable 'pbuf_off' set but not used [-Werror,-Wunused-but-set-variable] int pbuf_len, pbuf_off; ^ /usr/src/usr.bin/openssl/s_client.c:897:6: error: variable 'pbuf_len' set but not used [-Werror,-Wunused-but-set-variable] int pbuf_len, pbuf_off; ^ > You can use egcc to spot why clang 13 errors out, but they may not warn > exactly about the same problems. This works for easy stuff, not so much > for the kernel. We really need the clang 13 errors. > > Here's an attempt to use egcc over openssl and libcrypto. The s_client > diff probably fixes what clang 13 complains about. > > The two latter diffs for libcrypto remove unneeded includes. This looks > unrelated to the addition of -Wno-unused-but-set-variable by mortimer@, > but I thought maybe you would be interested. > egcc -Wno-unused-but-set-variable doesn't seem to find anything else in > libcrypto. > > In file included from /usr/src/lib/libcrypto/x509/x509_asid.c:28: > /usr/src/lib/libcrypto/x509/ext_dat.h:81:33: error: 'standard_exts' defined > but not used [-Werror=unused-variable] > static const X509V3_EXT_METHOD *standard_exts[] = { > > ok for the s_client diff? ok semarie@ for s_client diff but you could also remove pbuf_off :) > Your call regarding the 2nd & 3rd. If that structure really can be used > in multiple files then "static" is probably not appropriate. Or maybe > the structure should just be moved to x509/x509_lib.c. > > > Index: usr.bin/openssl/s_client.c > === > RCS file: /home/cvs/src/usr.bin/openssl/s_client.c,v > retrieving revision 1.55 > diff -u -p -r1.55 s_client.c > --- usr.bin/openssl/s_client.c22 Oct 2021 09:44:58 - 1.55 > +++ usr.bin/openssl/s_client.c25 Oct 2021 10:53:06 - > @@ -894,7 +894,6 @@ s_client_main(int argc, char **argv) > char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL, *pbuf = NULL; > int cbuf_len, cbuf_off; > int sbuf_len, sbuf_off; > - int pbuf_len; > int full_log = 1; > char *pass = NULL; > X509 *cert = NULL; > @@ -1195,7 +1194,6 @@ s_client_main(int argc, char **argv) > cbuf_off = 0; > sbuf_len = 0; > sbuf_off = 0; > - pbuf_len = 0; > > /* This is an ugly hack that does a lot of assumptions */ > /* > @@ -1502,7 +1500,6 @@ s_client_main(int argc, char **argv) > if (SSL_get_error(con, p) == SSL_ERROR_NONE) { > if (p <= 0) > goto end; > - pbuf_len = p; > > k = SSL_read(con, sbuf, p); > } -- Sebastien Marie
Re: some warnings in prep for LLVM 13
On Mon, Oct 25 2021, Theo Buehler wrote: >> index 664a5200037..e33763e7420 100644 >> --- a/usr.bin/openssl/Makefile >> +++ b/usr.bin/openssl/Makefile >> @@ -17,6 +17,7 @@ CFLAGS+= -Wuninitialized >> CFLAGS+= -Wunused >> .if ${COMPILER_VERSION:L} == "clang" >> CFLAGS+= -Werror >> +CFLAGS+= -Wno-unused-but-set-variable > > This will break the build with LLVM 11 because of -Werror: > > error: unknown warning option '-Wno-unused-but-set-variable'; did you mean > '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] > *** Error 1 in /usr/src/usr.bin/openssl (:87 'apps.o') > > Also, it would be nice to know what triggered this addition. You can use egcc to spot why clang 13 errors out, but they may not warn exactly about the same problems. This works for easy stuff, not so much for the kernel. We really need the clang 13 errors. Here's an attempt to use egcc over openssl and libcrypto. The s_client diff probably fixes what clang 13 complains about. The two latter diffs for libcrypto remove unneeded includes. This looks unrelated to the addition of -Wno-unused-but-set-variable by mortimer@, but I thought maybe you would be interested. egcc -Wno-unused-but-set-variable doesn't seem to find anything else in libcrypto. In file included from /usr/src/lib/libcrypto/x509/x509_asid.c:28: /usr/src/lib/libcrypto/x509/ext_dat.h:81:33: error: 'standard_exts' defined but not used [-Werror=unused-variable] static const X509V3_EXT_METHOD *standard_exts[] = { ok for the s_client diff? Your call regarding the 2nd & 3rd. If that structure really can be used in multiple files then "static" is probably not appropriate. Or maybe the structure should just be moved to x509/x509_lib.c. Index: usr.bin/openssl/s_client.c === RCS file: /home/cvs/src/usr.bin/openssl/s_client.c,v retrieving revision 1.55 diff -u -p -r1.55 s_client.c --- usr.bin/openssl/s_client.c 22 Oct 2021 09:44:58 - 1.55 +++ usr.bin/openssl/s_client.c 25 Oct 2021 10:53:06 - @@ -894,7 +894,6 @@ s_client_main(int argc, char **argv) char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL, *pbuf = NULL; int cbuf_len, cbuf_off; int sbuf_len, sbuf_off; - int pbuf_len; int full_log = 1; char *pass = NULL; X509 *cert = NULL; @@ -1195,7 +1194,6 @@ s_client_main(int argc, char **argv) cbuf_off = 0; sbuf_len = 0; sbuf_off = 0; - pbuf_len = 0; /* This is an ugly hack that does a lot of assumptions */ /* @@ -1502,7 +1500,6 @@ s_client_main(int argc, char **argv) if (SSL_get_error(con, p) == SSL_ERROR_NONE) { if (p <= 0) goto end; - pbuf_len = p; k = SSL_read(con, sbuf, p); } Index: lib/libcrypto/x509/x509_addr.c === RCS file: /home/cvs/src/lib/libcrypto/x509/x509_addr.c,v retrieving revision 1.16 diff -u -p -r1.16 x509_addr.c --- lib/libcrypto/x509/x509_addr.c 8 Sep 2021 10:49:34 - 1.16 +++ lib/libcrypto/x509/x509_addr.c 25 Oct 2021 11:09:00 - @@ -23,8 +23,6 @@ #include #include -#include "ext_dat.h" - #ifndef OPENSSL_NO_RFC3779 /* Index: lib/libcrypto/x509/x509_asid.c === RCS file: /home/cvs/src/lib/libcrypto/x509/x509_asid.c,v retrieving revision 1.16 diff -u -p -r1.16 x509_asid.c --- lib/libcrypto/x509/x509_asid.c 8 Sep 2021 09:49:24 - 1.16 +++ lib/libcrypto/x509/x509_asid.c 25 Oct 2021 11:09:17 - @@ -25,8 +25,6 @@ #include #include -#include "ext_dat.h" - #ifndef OPENSSL_NO_RFC3779 static const ASN1_TEMPLATE ASRange_seq_tt[] = { -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: snmpd trap community problem
On 2021/10/25 10:09, Martijn van Duren wrote: > Thanks for the detailed analysis. > > diff below should fix it. thanks, OK. I'm sure I tried that but maybe I missed the _ (SNMPV2 vs SNMP_V2).
Re: riscv64: ld.lld is too picky on ABI mismatch
On Mon, Oct 25 2021, Patrick Wildt wrote: > Am Mon, Oct 25, 2021 at 11:43:55AM +0200 schrieb Mark Kettenis: >> > From: Jeremie Courreges-Anglas >> > Date: Sun, 24 Oct 2021 17:30:46 +0100 >> > >> > clang(1) defaults to FP ABI but ld(1) -melf64lriscv doesn't. This is >> > a problem as soon as a port tries to use raw ld(1) -b binary to embed >> > data in a .o file. >> > >> > Downgrading this hard error to a warning seems more useful as far as the >> > ports tree is concerned. The diff below fixes >> > databases/postgresql-pllua and should also fix textproc/mupdf and net/utox. >> > >> > There's another diff here: https://reviews.llvm.org/D106378 >> > but it's slightly more complicated and it received seemingly negative >> > feedback. So I'm just using a minimal change to fit our needs. >> > >> > ok? >> >> I think we should try to avoid deviating from upstream as much as >> possible. And I agree with the folks who argue that the mismatching >> objects are created with the wrong tools. Well the only alternative they suggest is using assembly and .incbin. Maybe that works for the FreeBSD folks working on low-level stuff, but not so much as a general purpose tool to include binary data in builds. >> But if mortimer@ and >> patrick@ can deal with carrying this local modification I won't >> object. I can't speak for them but given the local changes we have in clang and lld land this two lines diff doesn't seem daunting. ;) > Well, I was about to send an LLVM 13 diff... so can we revisit this diff > when we're updated to LLVM 13? Sure! >> > Index: ELF/Arch/RISCV.cpp >> > === >> > RCS file: /cvs/src/gnu/llvm/lld/ELF/Arch/RISCV.cpp,v >> > retrieving revision 1.1.1.2 >> > diff -u -p -r1.1.1.2 RISCV.cpp >> > --- ELF/Arch/RISCV.cpp 28 Apr 2021 12:29:31 - 1.1.1.2 >> > +++ ELF/Arch/RISCV.cpp 24 Oct 2021 15:55:49 - >> > @@ -122,8 +122,8 @@ uint32_t RISCV::calcEFlags() const { >> >target |= EF_RISCV_RVC; >> > >> > if ((eflags & EF_RISCV_FLOAT_ABI) != (target & EF_RISCV_FLOAT_ABI)) >> > - error(toString(f) + >> > -": cannot link object files with different floating-point >> > ABI"); >> > + warn(toString(f) + >> > +": linking object files with different floating-point ABI"); >> > >> > if ((eflags & EF_RISCV_RVE) != (target & EF_RISCV_RVE)) >> >error(toString(f) + >> > >> > >> > -- >> > jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE >> > >> > >> > -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: some warnings in prep for LLVM 13
> Date: Mon, 25 Oct 2021 12:01:11 +0200 > From: Patrick Wildt > > Hi, > > mortimer@ has this diff in his tree for LLVM 13. I actually haven't > tried to see if it works fine with LLVM 11, but I feel it needs to be > sent out and not just be blindly committed. > > If someone wants to take care of this, it would be nice, so I can take > care of the remaining parts of sending out the LLVM 13 diff. Some explanation on -Wno-unused-but-set-variable and -Wno-null-pointer-subtraction and -Wno-gnu-folding-constant would be useful. I doubt base gcc supports these so we may need to add these only when building with clang. Or maybe disable these by default? Or should we fix the code instead? I guess non-amd64 arhcitectures need some love too... > diff --git a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper > b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper > index 611a2169862..f4c4e224dc5 100644 > --- a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper > +++ b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper > @@ -7,7 +7,7 @@ TARGET_ARCH?= ${MACHINE_ARCH} > SUBDIRS= opcodes bfd > CONF_SUBDIRS=opcodes bfd > > -CFLAGS+= ${PIE_DEFAULT} > +CFLAGS+= ${PIE_DEFAULT} -Wno-unused-but-set-variable > -Wno-null-pointer-subtraction > XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDSTATIC}" > # This allows moving the whole binutils installation around for > # testing purposes > diff --git a/lib/csu/crtbeginS.c b/lib/csu/crtbeginS.c > index a4a7cd19fce..41500fc1442 100644 > --- a/lib/csu/crtbeginS.c > +++ b/lib/csu/crtbeginS.c > @@ -85,6 +85,7 @@ int _thread_atfork(void (*)(void), void (*)(void), void > (*)(void), void *) > __attribute__((weak)); > > int > +__attribute__((weak)) > pthread_atfork(void (*prep)(void), void (*parent)(void), void (*child)(void)) > { > return (_thread_atfork(prep, parent, child, &__dso_handle)); Hmm, so in -current this function isn't actually weak. Not sure I fully understand the consequences of that. > diff --git a/lib/libc/arch/amd64/sys/brk.S b/lib/libc/arch/amd64/sys/brk.S > index ce69679e389..ee1c11f7643 100644 > --- a/lib/libc/arch/amd64/sys/brk.S > +++ b/lib/libc/arch/amd64/sys/brk.S > @@ -48,7 +48,6 @@ __minbrk: > END(__minbrk) > .type __minbrk,@object > > - .weak brk > ENTRY(brk) > cmpq%rdi,__minbrk(%rip) > jb 1f > diff --git a/lib/libc/arch/amd64/sys/sbrk.S b/lib/libc/arch/amd64/sys/sbrk.S > index 8d7d68909b2..db53a6bb643 100644 > --- a/lib/libc/arch/amd64/sys/sbrk.S > +++ b/lib/libc/arch/amd64/sys/sbrk.S > @@ -53,7 +53,6 @@ __curbrk: > END(__curbrk) > .type __curbrk,@object > > - .weak sbrk > ENTRY(sbrk) > movq__curbrk(%rip),%rax > movslq %edi,%rsi These functions are supposed to be weak, like they are on architectures that use a C implementation. I suppose the .weak directive needs to come *after* the .global emitted by ENTRY(). Putting it after the END() works. > diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile > index 1a3a3888352..f6063ffb194 100644 > --- a/lib/libcrypto/Makefile > +++ b/lib/libcrypto/Makefile > @@ -16,7 +16,7 @@ LCRYPTO_SRC=${.CURDIR} > > CFLAGS+= -Wall -Wundef > .if ${COMPILER_VERSION:L} == "clang" > -CFLAGS+= -Werror > +CFLAGS+= -Werror -Wno-unused-but-set-variable > .endif > CFLAGS+= -DLIBRESSL_INTERNAL > > diff --git a/sys/arch/amd64/conf/Makefile.amd64 > b/sys/arch/amd64/conf/Makefile.amd64 > index d36bae30417..83bd9a9fed1 100644 > --- a/sys/arch/amd64/conf/Makefile.amd64 > +++ b/sys/arch/amd64/conf/Makefile.amd64 > @@ -70,7 +70,8 @@ CMACHFLAGS+=-mno-retpoline > .endif > .if ${COMPILER_VERSION:Mclang} > NO_INTEGR_AS=-no-integrated-as > -CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion > +CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \ > + -Wno-unused-but-set-variable -Wno-gnu-folding-constant > .endif > > DEBUG?= -g > diff --git a/sys/arch/amd64/stand/pxeboot/Makefile > b/sys/arch/amd64/stand/pxeboot/Makefile > index 9b028d8f4aa..cc92233463b 100644 > --- a/sys/arch/amd64/stand/pxeboot/Makefile > +++ b/sys/arch/amd64/stand/pxeboot/Makefile > @@ -71,7 +71,7 @@ CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS} > -DLINKADDR=${LINKADDR} > CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE > -DBUILDFIXED > CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} -I${S}/stand/boot #-DCOMPAT_UFS > CFLAGS+=-m32 > -CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie > +CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie > -Wno-unused-but-set-variable > AFLAGS+=${NO_INTEGR_AS} > # AFLAGS+=-Wa,-a > AFLAGS+=-m32 # -Wa,-R > diff --git a/usr.bin/openssl/Makefile b/usr.bin/openssl/Makefile > index 664a5200037..e33763e7420 100644 > --- a/usr.bin/openssl/Makefile > +++ b/usr.bin/openssl/Makefile > @@ -17,6 +17,7 @@ CFLAGS+= -Wuninitialized > CFLAGS+= -Wunused > .if ${COMPILER_VERSION:L} == "clang" > CFLA
Re: some warnings in prep for LLVM 13
> index 664a5200037..e33763e7420 100644 > --- a/usr.bin/openssl/Makefile > +++ b/usr.bin/openssl/Makefile > @@ -17,6 +17,7 @@ CFLAGS+= -Wuninitialized > CFLAGS+= -Wunused > .if ${COMPILER_VERSION:L} == "clang" > CFLAGS+= -Werror > +CFLAGS+= -Wno-unused-but-set-variable This will break the build with LLVM 11 because of -Werror: error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] *** Error 1 in /usr/src/usr.bin/openssl (:87 'apps.o') Also, it would be nice to know what triggered this addition.
some warnings in prep for LLVM 13
Hi, mortimer@ has this diff in his tree for LLVM 13. I actually haven't tried to see if it works fine with LLVM 11, but I feel it needs to be sent out and not just be blindly committed. If someone wants to take care of this, it would be nice, so I can take care of the remaining parts of sending out the LLVM 13 diff. Patrick diff --git a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper index 611a2169862..f4c4e224dc5 100644 --- a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper @@ -7,7 +7,7 @@ TARGET_ARCH?= ${MACHINE_ARCH} SUBDIRS= opcodes bfd CONF_SUBDIRS= opcodes bfd -CFLAGS+= ${PIE_DEFAULT} +CFLAGS+= ${PIE_DEFAULT} -Wno-unused-but-set-variable -Wno-null-pointer-subtraction XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDSTATIC}" # This allows moving the whole binutils installation around for # testing purposes diff --git a/lib/csu/crtbeginS.c b/lib/csu/crtbeginS.c index a4a7cd19fce..41500fc1442 100644 --- a/lib/csu/crtbeginS.c +++ b/lib/csu/crtbeginS.c @@ -85,6 +85,7 @@ int _thread_atfork(void (*)(void), void (*)(void), void (*)(void), void *) __attribute__((weak)); int +__attribute__((weak)) pthread_atfork(void (*prep)(void), void (*parent)(void), void (*child)(void)) { return (_thread_atfork(prep, parent, child, &__dso_handle)); diff --git a/lib/libc/arch/amd64/sys/brk.S b/lib/libc/arch/amd64/sys/brk.S index ce69679e389..ee1c11f7643 100644 --- a/lib/libc/arch/amd64/sys/brk.S +++ b/lib/libc/arch/amd64/sys/brk.S @@ -48,7 +48,6 @@ __minbrk: END(__minbrk) .type __minbrk,@object - .weak brk ENTRY(brk) cmpq%rdi,__minbrk(%rip) jb 1f diff --git a/lib/libc/arch/amd64/sys/sbrk.S b/lib/libc/arch/amd64/sys/sbrk.S index 8d7d68909b2..db53a6bb643 100644 --- a/lib/libc/arch/amd64/sys/sbrk.S +++ b/lib/libc/arch/amd64/sys/sbrk.S @@ -53,7 +53,6 @@ __curbrk: END(__curbrk) .type __curbrk,@object - .weak sbrk ENTRY(sbrk) movq__curbrk(%rip),%rax movslq %edi,%rsi diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile index 1a3a3888352..f6063ffb194 100644 --- a/lib/libcrypto/Makefile +++ b/lib/libcrypto/Makefile @@ -16,7 +16,7 @@ LCRYPTO_SRC= ${.CURDIR} CFLAGS+= -Wall -Wundef .if ${COMPILER_VERSION:L} == "clang" -CFLAGS+= -Werror +CFLAGS+= -Werror -Wno-unused-but-set-variable .endif CFLAGS+= -DLIBRESSL_INTERNAL diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index d36bae30417..83bd9a9fed1 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -70,7 +70,8 @@ CMACHFLAGS+= -mno-retpoline .endif .if ${COMPILER_VERSION:Mclang} NO_INTEGR_AS= -no-integrated-as -CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion +CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \ + -Wno-unused-but-set-variable -Wno-gnu-folding-constant .endif DEBUG?=-g diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index 9b028d8f4aa..cc92233463b 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -71,7 +71,7 @@ CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS} -DLINKADDR=${LINKADDR} CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE -DBUILDFIXED CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} -I${S}/stand/boot #-DCOMPAT_UFS CFLAGS+=-m32 -CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie +CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie -Wno-unused-but-set-variable AFLAGS+=${NO_INTEGR_AS} # AFLAGS+=-Wa,-a AFLAGS+=-m32 # -Wa,-R diff --git a/usr.bin/openssl/Makefile b/usr.bin/openssl/Makefile index 664a5200037..e33763e7420 100644 --- a/usr.bin/openssl/Makefile +++ b/usr.bin/openssl/Makefile @@ -17,6 +17,7 @@ CFLAGS+= -Wuninitialized CFLAGS+= -Wunused .if ${COMPILER_VERSION:L} == "clang" CFLAGS+= -Werror +CFLAGS+= -Wno-unused-but-set-variable .endif CFLAGS+= -DLIBRESSL_INTERNAL diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index d36bae30417..83bd9a9fed1 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -70,7 +70,8 @@ CMACHFLAGS+= -mno-retpoline .endif .if ${COMPILER_VERSION:Mclang} NO_INTEGR_AS= -no-integrated-as -CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion +CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \ + -Wno-unused-but-set-variable -Wno-gnu-folding-constant .endif DEBUG?=-g diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index 9b028d8f4aa..cc92233463b 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -71,7 +71,7 @@ CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS} -
Re: riscv64: ld.lld is too picky on ABI mismatch
Am Mon, Oct 25, 2021 at 11:43:55AM +0200 schrieb Mark Kettenis: > > From: Jeremie Courreges-Anglas > > Date: Sun, 24 Oct 2021 17:30:46 +0100 > > > > clang(1) defaults to FP ABI but ld(1) -melf64lriscv doesn't. This is > > a problem as soon as a port tries to use raw ld(1) -b binary to embed > > data in a .o file. > > > > Downgrading this hard error to a warning seems more useful as far as the > > ports tree is concerned. The diff below fixes > > databases/postgresql-pllua and should also fix textproc/mupdf and net/utox. > > > > There's another diff here: https://reviews.llvm.org/D106378 > > but it's slightly more complicated and it received seemingly negative > > feedback. So I'm just using a minimal change to fit our needs. > > > > ok? > > I think we should try to avoid deviating from upstream as much as > possible. And I agree with the folks who argue that the mismatching > objects are created with the wrong tools. But if mortimer@ and > patrick@ can deal with carrying this local modification I won't > object. Well, I was about to send an LLVM 13 diff... so can we revisit this diff when we're updated to LLVM 13? > > Index: ELF/Arch/RISCV.cpp > > === > > RCS file: /cvs/src/gnu/llvm/lld/ELF/Arch/RISCV.cpp,v > > retrieving revision 1.1.1.2 > > diff -u -p -r1.1.1.2 RISCV.cpp > > --- ELF/Arch/RISCV.cpp 28 Apr 2021 12:29:31 - 1.1.1.2 > > +++ ELF/Arch/RISCV.cpp 24 Oct 2021 15:55:49 - > > @@ -122,8 +122,8 @@ uint32_t RISCV::calcEFlags() const { > >target |= EF_RISCV_RVC; > > > > if ((eflags & EF_RISCV_FLOAT_ABI) != (target & EF_RISCV_FLOAT_ABI)) > > - error(toString(f) + > > -": cannot link object files with different floating-point > > ABI"); > > + warn(toString(f) + > > +": linking object files with different floating-point ABI"); > > > > if ((eflags & EF_RISCV_RVE) != (target & EF_RISCV_RVE)) > >error(toString(f) + > > > > > > -- > > jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE > > > > >
Re: riscv64: ld.lld is too picky on ABI mismatch
> From: Jeremie Courreges-Anglas > Date: Sun, 24 Oct 2021 17:30:46 +0100 > > clang(1) defaults to FP ABI but ld(1) -melf64lriscv doesn't. This is > a problem as soon as a port tries to use raw ld(1) -b binary to embed > data in a .o file. > > Downgrading this hard error to a warning seems more useful as far as the > ports tree is concerned. The diff below fixes > databases/postgresql-pllua and should also fix textproc/mupdf and net/utox. > > There's another diff here: https://reviews.llvm.org/D106378 > but it's slightly more complicated and it received seemingly negative > feedback. So I'm just using a minimal change to fit our needs. > > ok? I think we should try to avoid deviating from upstream as much as possible. And I agree with the folks who argue that the mismatching objects are created with the wrong tools. But if mortimer@ and patrick@ can deal with carrying this local modification I won't object. > Index: ELF/Arch/RISCV.cpp > === > RCS file: /cvs/src/gnu/llvm/lld/ELF/Arch/RISCV.cpp,v > retrieving revision 1.1.1.2 > diff -u -p -r1.1.1.2 RISCV.cpp > --- ELF/Arch/RISCV.cpp28 Apr 2021 12:29:31 - 1.1.1.2 > +++ ELF/Arch/RISCV.cpp24 Oct 2021 15:55:49 - > @@ -122,8 +122,8 @@ uint32_t RISCV::calcEFlags() const { >target |= EF_RISCV_RVC; > > if ((eflags & EF_RISCV_FLOAT_ABI) != (target & EF_RISCV_FLOAT_ABI)) > - error(toString(f) + > -": cannot link object files with different floating-point ABI"); > + warn(toString(f) + > +": linking object files with different floating-point ABI"); > > if ((eflags & EF_RISCV_RVE) != (target & EF_RISCV_RVE)) >error(toString(f) + > > > -- > jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE > >
Re: snmpd trap community problem
Thanks for the detailed analysis. diff below should fix it. martijn@ On Sun, 2021-10-24 at 22:44 +0100, Stuart Henderson wrote: > ooops, sorry not trondd, it was jhuldtgren who spotted it! > > On 2021/10/24 22:26, Stuart Henderson wrote: > > trondd noticed a startup problem with snmpd on mips64 but didn't see > > them on amd64 and wondered if it was arch-specific, I had a go at > > reproducing and see it very often on aarch64 and also sometimes on > > amd64. > > > > Any setting of "trap receiver $ip snmpv2c community $community" > > triggers the problem: > > > > # for i in `jot 20`; do snmpd -nvf /etc/snmpd.conf; done > > trap receiver: missing community > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > trap receiver: missing community > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > configuration ok > > trap receiver: missing community > > > > Additionally even when configuration is accepted, the community is set > > to junk > > > > 822 tr->ta_oid = $2; > > 823 tr->ta_version = $3.type; > > > > with snmpv2c ta_version is set to 1 > > > > 824 if ($3.type == ADDRESS_FLAG_SNMPV2) { > > > > so this branch isn't taken > > > > 825 (void)strlcpy(tr->ta_community, > > $3.data, > > 826 sizeof(tr->ta_community)); > > 827 free($3.data); > > 828 } else { > > 829 tr->ta_usmusername = $3.data; > > 830 tr->ta_seclevel = $3.value; > > 831 } > > > > at this point ta_usmusername is set to the community and ta_community > > is junk. > > > > 810 if ($4 != NULL) { > > (gdb) > > 823 tr->ta_version = $3.type; > > (gdb) > > 824 if ($3.type == ADDRESS_FLAG_SNMPV2) { > > (gdb) p *tr > > $3 = {ta_ss = {ss_len = 16 '\020', ss_family = 2 '\002', __ss_pad1 = > > "\000\242\303_\273T", __ss_pad2 = 0, > > __ss_pad3 = "\002\000\000\000\001\000\000\000\001\000\000\000\a", > > '\000' }, ta_sslocal = { > > ss_len = 0 '\000', ss_family = 0 '\000', __ss_pad1 = > > "\000\000\000\000\000", __ss_pad2 = 0, > > __ss_pad3 = '\000' }, ta_version = 1, {ta_community > > = '\000' , { > > ta_usmusername = 0x0, ta_usmuser = 0x0, ta_seclevel = 0}}, ta_oid = > > 0x0, entry = {tqe_next = 0x0, > > tqe_prev = 0x0}} > > (gdb) n > > 829 tr->ta_usmusername = $3.data; > > (gdb) > > 830 tr->ta_seclevel = $3.value; > > (gdb) > > 832 TAILQ_INSERT_TAIL(&(conf->sc_trapreceivers), > > tr, entry); > > (gdb) p *tr > > $4 = {ta_ss = {ss_len = 16 '\020', ss_family = 2 '\002', __ss_pad1 = > > "\000\242\303_\273T", __ss_pad2 = 0, > > __ss_pad3 = "\002\000\000\000\001\000\000\000\001\000\000\000\a", > > '\000' }, ta_sslocal = { > > ss_len = 0 '\000', ss_family = 0 '\000', __ss_pad1 = > > "\000\000\000\000\000", __ss_pad2 = 0, > > __ss_pad3 = '\000' }, ta_version = 1, { > > ta_community = "\340\035a\250O\005", '\000' , { > > ta_usmusername = 0x54fa8611de0 "zz", ta_usmuser = > > 0x0, ta_seclevel = 0}}, ta_oid = 0x0, > > entry = {tqe_next = 0x0, tqe_prev = 0x0}} > > > > > > Index: parse.y === RCS file: /cvs/src/usr.sbin/snmpd/parse.y,v retrieving revision 1.71 diff -u -p -r1.71 parse.y --- parse.y 20 Oct 2021 16:00:47 - 1.71 +++ parse.y 25 Oct 2021 09:09:14 - @@ -821,7 +821,7 @@ hostdef : STRING hostoid hostauth srcad } tr->ta_oid = $2; tr->ta_version = $3.type; - if ($3.type == ADDRESS_FLAG_SNMPV2) { + if ($3.type == SNMP_V2) { (void)strlcpy(tr->ta_community, $3.data, sizeof(tr->ta_community)); free($3.data);
sndio: initial bits for multiple devices support, please test
Hi, Current sndiod logic supports one device only: If two -f are used then two independent instances of the whole server are created, each with its own set of clients, options, controls, and so on. This diff shifts sndiod towards a more flexible (and conceptually simpler) model: - clients connect to logical devices (created with -s option) - logical devices route data to/from physical devices registered with -f option This logic removes obstacles to working on multiple devices support, including a single client using one device for recording and another for playback. This logic makes not only sndiod internals simpler but allows to simplify sndio(7) naming scheme. Instead of: "snd/." we only need: "snd/" where becomes the logical device (or "virtual device" to use Ingo's words). This doesn't affect setup using default. For those using an advanced configuration, there is a compatibility layer making the change almost transparent. This change also makes -F and -f rougly the same: logical device can be migrated from one physical device to another, so the need for the whole "alternate device" hack^Wconcept vanishes. Documentation change is the bare minimum. Man pages could be simplified, I'll do so as soon as MIDI has received the same treatment (next step). The diff is big, but it mostly moves existing bits from one object to another, so there's little risk of breaking things, but please test and report regressions, if any. Index: usr.bin/sndiod/dev.c === RCS file: /cvs/src/usr.bin/sndiod/dev.c,v retrieving revision 1.102 diff -u -p -u -p -r1.102 dev.c --- usr.bin/sndiod/dev.c3 May 2021 04:29:50 - 1.102 +++ usr.bin/sndiod/dev.c23 Oct 2021 13:40:34 - @@ -45,16 +45,13 @@ struct dev *dev_new(char *, struct apara unsigned int, unsigned int, unsigned int, unsigned int); void dev_adjpar(struct dev *, int, int, int); int dev_allocbufs(struct dev *); -int dev_open(struct dev *); void dev_freebufs(struct dev *); -void dev_close(struct dev *); int dev_ref(struct dev *); void dev_unref(struct dev *); int dev_init(struct dev *); void dev_done(struct dev *); struct dev *dev_bynum(int); void dev_del(struct dev *); -void dev_setalt(struct dev *, unsigned int); unsigned int dev_roundof(struct dev *, unsigned int); void dev_wakeup(struct dev *); @@ -930,10 +927,8 @@ dev_new(char *path, struct aparams *par, return NULL; } d = xmalloc(sizeof(struct dev)); - d->alt_list = NULL; - dev_addname(d,path); + d->path = path; d->num = dev_sndnum++; - d->alt_num = -1; d->reqpar = *par; d->reqmode = mode; @@ -948,6 +943,7 @@ dev_new(char *path, struct aparams *par, d->slot_list = NULL; d->master = MIDI_MAXCTL; d->master_enabled = 0; + d->alt_next = d; snprintf(d->name, CTL_NAMEMAX, "%u", d->num); for (pd = &dev_list; *pd != NULL; pd = &(*pd)->next) ; @@ -957,51 +953,6 @@ dev_new(char *path, struct aparams *par, } /* - * add a alternate name - */ -int -dev_addname(struct dev *d, char *name) -{ - struct dev_alt *a; - - if (d->alt_list != NULL && d->alt_list->idx == DEV_NMAX - 1) { - log_puts(name); - log_puts(": too many alternate names\n"); - return 0; - } - a = xmalloc(sizeof(struct dev_alt)); - a->name = name; - a->idx = (d->alt_list == NULL) ? 0 : d->alt_list->idx + 1; - a->next = d->alt_list; - d->alt_list = a; - return 1; -} - -/* - * set prefered alt device name - */ -void -dev_setalt(struct dev *d, unsigned int idx) -{ - struct dev_alt **pa, *a; - - /* find alt with given index */ - for (pa = &d->alt_list; (a = *pa)->idx != idx; pa = &a->next) - ; - - /* detach from list */ - *pa = a->next; - - /* attach at head */ - a->next = d->alt_list; - d->alt_list = a; - - /* reopen device with the new alt */ - if (idx != d->alt_num) - dev_reopen(d); -} - -/* * adjust device parameters and mode */ void @@ -1099,9 +1050,6 @@ dev_allocbufs(struct dev *d) int dev_open(struct dev *d) { - char name[CTL_NAMEMAX]; - struct dev_alt *a; - d->mode = d->reqmode; d->round = d->reqround; d->bufsz = d->reqbufsz; @@ -1123,16 +1071,6 @@ dev_open(struct dev *d) if (!dev_allocbufs(d)) return 0; - /* if there are multiple alt devs, add server.device knob */ - if (d->alt_list->next != NULL) { - for (a = d->alt_list; a != NULL; a = a->next) { - snprintf(name, sizeof(name), "%d", a->idx); - ctl_new(CTL_DEV_ALT, d, &a->idx, - CTL_SEL, d->name, "server", -1, "device", - name, -1, 1, a->idx == d->alt_num); -