Import ts(1) - a timestamp utility

2022-06-28 Thread Job Snijders
Dear all, The below changeset is a from scratch & pledged C implementation of the 'ts' perl utility found in the moreutils collection by Joey Hess. OK to add to /usr/bin? Kind regards, Job Index: ts/Makefile === RCS file:

Re: ip6 hbhchcheck mbuf pointer

2022-06-28 Thread Alexandr Nedvedicky
Hello, I like the idea. I would just consider to make ip6_hbhchcheck() to always free mp on error and set NULL as return value. for example here in current ip6_input_if() we may leak memory on error: 308 int 309 ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)

ip6 hbhchcheck mbuf pointer

2022-06-28 Thread Alexander Bluhm
Hi, Deep in ip6_hbhchcheck() may modify the mbuf pointer. Instead of having dangling pointer that we must not use, pass pointer to mbuf pointer and keep it consistent in the caller. ok? bluhm Index: netinet6/ip6_input.c === RCS

Re: Unlocking pledge(2)

2022-06-28 Thread Jeremie Courreges-Anglas
On Tue, Jun 28 2022, Martin Pieuchot wrote: > On 28/06/22(Tue) 18:17, Jeremie Courreges-Anglas wrote: >> >> Initially I just wandered in syscall_mi.h and found the locking scheme >> super weird, even if technically correct. pledge_syscall() better be >> safe to call without the kernel lock so I

Re: pipex(4): use per-session `pxs_mtx' mutex(9) for protection

2022-06-28 Thread Vitaliy Makkoveev
On Tue, Jun 28, 2022 at 09:05:09PM +0300, Vitaliy Makkoveev wrote: > The updated diff. It was triggered by Hrvoje Popovski, we could do > direct (*if_qstart)() call in pipex(4) PPPOE input path, and this > provides deadlock. The updated diff uses ip{,6}_send() instead of > ipv{4,6}_input(). > I

Re: Unlocking pledge(2)

2022-06-28 Thread Martin Pieuchot
On 28/06/22(Tue) 18:17, Jeremie Courreges-Anglas wrote: > > Initially I just wandered in syscall_mi.h and found the locking scheme > super weird, even if technically correct. pledge_syscall() better be > safe to call without the kernel lock so I don't understand why we're > sometimes calling it

Re: pipex(4): use per-session `pxs_mtx' mutex(9) for protection

2022-06-28 Thread Vitaliy Makkoveev
The updated diff. It was triggered by Hrvoje Popovski, we could do direct (*if_qstart)() call in pipex(4) PPPOE input path, and this provides deadlock. The updated diff uses ip{,6}_send() instead of ipv{4,6}_input(). r420-1# witness: acquiring duplicate lock of same type: ">pxs_mtx" 1st >pxs_mtx

Unlocking pledge(2)

2022-06-28 Thread Jeremie Courreges-Anglas
Initially I just wandered in syscall_mi.h and found the locking scheme super weird, even if technically correct. pledge_syscall() better be safe to call without the kernel lock so I don't understand why we're sometimes calling it with the kernel lock and sometimes not. ps_pledge is 64 bits so

Re: Fix the swapper

2022-06-28 Thread Martin Pieuchot
On 27/06/22(Mon) 15:44, Martin Pieuchot wrote: > Diff below contain 3 parts that can be committed independently. The 3 > of them are necessary to allow the pagedaemon to make progress in OOM > situation and to satisfy all the allocations waiting for pages in > specific ranges. > > *

bgplgd - a JSON frontend to bgpd

2022-06-28 Thread Claudio Jeker
This is bgplgd that can be used to provide a JSON REST API for bgpd. It can be used to integrate bgpd into external looking glasses. The bgplgd uses a modified version of slowcgi. It forks bgpctl per request and returns the output via the slowcgi socket. Securing the API needs to be done in the

pipex(4): use per-session `pxs_mtx' mutex(9) for protection

2022-06-28 Thread Vitaliy Makkoveev
We can't predict netlock state when we executing pipex(4) related (*if_qstart)() handlers, so we can't use netlock for pipex(4) protection. We already use `pipex_list_mtx' for global pipex(4) data, so Use per-session `pxs_mtx' mutex(9) for pipex session context protection. We already use

Re: rewrite amd64 cache printing

2022-06-28 Thread Jonathan Gray
On Sat, Jun 25, 2022 at 04:21:54AM -0700, Mike Larkin wrote: > On Fri, Jun 24, 2022 at 07:19:47PM +1000, Jonathan Gray wrote: > > +void > > +amd_cpu_cacheinfo(struct cpu_info *ci) > > +{ > > + u_int eax, ebx, ecx, edx; > > + > > + /* used by vmm */ > > + > > If this is the only user of these

Introduce uvm_pagewait()

2022-06-28 Thread Martin Pieuchot
I'd like to abstract the use of PG_WANTED to start unifying & cleaning the various cases where a code path is waiting for a busy page. Here's the first step. ok? Index: uvm/uvm_amap.c === RCS file: /cvs/src/sys/uvm/uvm_amap.c,v

install.sub: don't ask about vlan0 unless some other interface exists

2022-06-28 Thread Stuart Henderson
The current handling of network interfaces in the installer is rather confusing when somebody has an unsupported network device - it offers to configure vlan0, but there is no interface on which a vlan can run anyway. Available network interfaces are: vlan0. Which network interface do you wish to

Re: do pppoe(4) input through netisr

2022-06-28 Thread Alexander Bluhm
On Tue, Jun 28, 2022 at 12:44:30PM +0300, Vitaliy Makkoveev wrote: > ether_input() called with shared netlock, but pppoe(4) wants it to be > exclusive. Do the pppoe(4) input within netisr handler with exclusive > netlok held, and remove kernel lock hack from ether_input(). > > This is the step

Re: snmpd(8): Add blocklist feature

2022-06-28 Thread Martijn van Duren
On Tue, 2022-06-28 at 12:21 +0200, Martijn van Duren wrote: > On Tue, 2022-06-28 at 10:21 +0200, Martijn van Duren wrote: > > Back in 2020 florian@ added the filter-pf-addresses keyword. > > Although useful, I always felt it was a bit too case-specific. The diff > > below adds a new blocklist

Re: snmpd(8): Add blocklist feature

2022-06-28 Thread Martijn van Duren
On Tue, 2022-06-28 at 10:21 +0200, Martijn van Duren wrote: > Back in 2020 florian@ added the filter-pf-addresses keyword. > Although useful, I always felt it was a bit too case-specific. The diff > below adds a new blocklist feature/backend, which takes hold of an > entire subtree, effectively

Re: arpintr without kernel lock

2022-06-28 Thread Alexander Bluhm
On Tue, Jun 28, 2022 at 10:51:29AM +0200, Alexander Bluhm wrote: > arpintr() looks MP safe and I cannot trigger a crash with this diff. Running parallel forwarding and arp -d in a loop triggers route NULL pointer dereference after a while. I have to figure out if it is related to this diff.

pkg_create tweak for PORTSDIR_PATH

2022-06-28 Thread Marc Espie
As noticed by landry, going to the ports tree for dependencies can fail hilariously in case of a PORTSDIR_PATH. Most specifically, assuming you are building something like firefox-102 in one of your ports directory, when building the debug package, dependency look-up in pkg_create is going to

do pppoe(4) input through netisr

2022-06-28 Thread Vitaliy Makkoveev
ether_input() called with shared netlock, but pppoe(4) wants it to be exclusive. Do the pppoe(4) input within netisr handler with exclusive netlok held, and remove kernel lock hack from ether_input(). This is the step back, but it makes ether_input() path better then it is now. ok? Index:

Re: bcmdmac: minor nit

2022-06-28 Thread Mark Kettenis
ok kettenis@ > Op 28-06-2022 07:20 schreef Anton Lindqvist : > > > Hi, > No need to pass a copy of the bcmdmac_channel structure to predicate > routines. > > Comments? OK? > > diff --git sys/dev/fdt/bcm2835_dmac.c sys/dev/fdt/bcm2835_dmac.c > index 145810dd7af..e9b31af568c 100644 > ---

Re: com at acpi: minor nit

2022-06-28 Thread Mark Kettenis
meh not really worth fixing, but since you already wrote the diff ok kettenis@ > Op 28-06-2022 07:23 schreef Anton Lindqvist : > > > Hi, > A com_acpi_softc pointer is used as the interrupt callback cookie which > is later on interpreted as a com_softc pointer. This is not a problem in >

snmpd(8): Allow for symbolic OID names in snmpd.conf

2022-06-28 Thread Martijn van Duren
When playing with the blocklist I noticed that the oid directive only supports numeric OIDs. So if florian wants to use filter-pf-table in the future he'd have to set: blocklist 1.3.6.1.4.1.30155.1.9.129 which is pure insanity, if: blocklist pfTblAddrTable could be an option. Diff below changes

arpintr without kernel lock

2022-06-28 Thread Alexander Bluhm
Hi, arpintr() looks MP safe and I cannot trigger a crash with this diff. Hrvoje, can you try it? bluhm Index: net/if.c === RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v retrieving revision 1.654 diff -u -p -r1.654 if.c ---

snmpd(8): Add blocklist feature

2022-06-28 Thread Martijn van Duren
Back in 2020 florian@ added the filter-pf-addresses keyword. Although useful, I always felt it was a bit too case-specific. The diff below adds a new blocklist feature/backend, which takes hold of an entire subtree, effectively removing it from the tree. With this I've deprecated the

Re: acpitz(4): perform passive cooling only when perfpolicy is AUTO

2022-06-28 Thread Theo de Raadt
Stefan Hagen wrote: > Stuart Henderson wrote (2022-06-28 08:13 CEST): > > On 2022/06/27 17:12, Bryan Steele wrote: > > > > > > Shouldn't this also take into consideration hw.power as well? If it > > > doesn't make sense for perfpolicy=high then it probably doesn't for > > > perfpolicy=auto when

Re: acpitz(4): perform passive cooling only when perfpolicy is AUTO

2022-06-28 Thread Stuart Henderson
On 2022/06/27 17:12, Bryan Steele wrote: > > Shouldn't this also take into consideration hw.power as well? If it > doesn't make sense for perfpolicy=high then it probably doesn't for > perfpolicy=auto when on AC power? Why so? perfpolicy=high says to me, "I want it fast, I don't care about fan

Re: ip6 hbhchcheck next protocol

2022-06-28 Thread Alexandr Nedvedicky
Hello, On Tue, Jun 28, 2022 at 02:39:24AM +0200, Alexander Bluhm wrote: > Hi, > > The ip6_hbhchcheck() function never reads the nxtp parameter, it > only sets its value. It is more obvious if we return the next > protocol and return IPPROTO_DONE to signal error. All IP protocol > functions do

Re: stop using mquery(2) inside realloc(3)

2022-06-28 Thread Theo de Raadt
This diff to stop using mquery has been in snaps for a few weeks, and I finally noticed some fallout. But it is amusing fallout: If you have a snap with the diff installed, you cannot build an install media in a shortcut way, since malloc.c in the real tree uses mquery, but the installed libc