Re: [patch] CPU frequency scheduler change proposal

2022-03-21 Thread Matthias Schmidt
Hi, * Solene Rapenne wrote: > I'm proposing a very simple change to the automatic policy of the CPU > frequency scheduler. > > Currently, every 100ms the scheduler is doing this: > > - when the CPU load exceeds the threshold, CPU frequency is set to the > maximum and the variable downbeats is

udp_sbappend() with inpcb table mutex

2022-03-21 Thread Alexander Bluhm
Hi, syzkaller and witness found a bug in my pcb table mutex commit. https://syzkaller.appspot.com/bug?id=90a4811c99d6a2df7b252971b754612ca632894d For multicast and broadcast packets udp_input() traverses the loop of all UDP PCBs. There it calls udp_sbappend() while holding the UDB table mutex.

constify *_hw_if

2022-03-21 Thread Miod Vallat
The following diff makes {audio,midi,radio,video}_hw_if structs in the kernel const, in order to move them to rodata. Index: share/man/man9/audio.9 === RCS file: /OpenBSD/src/share/man/man9/audio.9,v retrieving revision 1.29 diff -u

Re: bgpd reload when rib flags change

2022-03-21 Thread Theo Buehler
On Mon, Mar 21, 2022 at 12:24:33PM +0100, Claudio Jeker wrote: > During config reload the RIB may need to be resynced when the > 'no evaluate' setting changes. > > This changes the code to actually flush the Adj-RIB-Out of affected peers > and then adjust the RIB in a 2nd step. That way there is

bgpd, remove active prefix cache in rib_element

2022-03-21 Thread Claudio Jeker
In struct rib_entry bgpd keeps the 'best' or active prefix cached. Now to support more than one one prefix per path (for ECMP and add-path) I need the ability to access the previous element. The currently used LIST macros do not support that. So I want to switch that to TAILQ but the TAILQ head is

Re: refcount btrace

2022-03-21 Thread Martin Pieuchot
On 20/03/22(Sun) 05:39, Visa Hankala wrote: > On Sat, Mar 19, 2022 at 12:10:11AM +0100, Alexander Bluhm wrote: > > On Thu, Mar 17, 2022 at 07:25:27AM +, Visa Hankala wrote: > > > On Thu, Mar 17, 2022 at 12:42:13AM +0100, Alexander Bluhm wrote: > > > > I would like to use btrace to debug

Re: constify *_hw_if

2022-03-21 Thread Alexandre Ratchov
On Mon, Mar 21, 2022 at 12:09:54PM +, Miod Vallat wrote: > The following diff makes {audio,midi,radio,video}_hw_if structs in the > kernel const, in order to move them to rodata. > ok ratchov

Re: bgpd reload when rib flags change

2022-03-21 Thread Claudio Jeker
On Mon, Mar 21, 2022 at 01:19:53PM +0100, Theo Buehler wrote: > On Mon, Mar 21, 2022 at 12:24:33PM +0100, Claudio Jeker wrote: > > During config reload the RIB may need to be resynced when the > > 'no evaluate' setting changes. > > > > This changes the code to actually flush the Adj-RIB-Out of

Re: bgpd, remove active prefix cache in rib_element

2022-03-21 Thread Theo Buehler
On Mon, Mar 21, 2022 at 05:16:53PM +0100, Claudio Jeker wrote: > In struct rib_entry bgpd keeps the 'best' or active prefix cached. > Now to support more than one one prefix per path (for ECMP and add-path) > I need the ability to access the previous element. The currently used > LIST macros do

Re: riscv64: adjust VM_MIN_ADDRESS

2022-03-21 Thread Theo de Raadt
Miod Vallat wrote: Absolutely this should be fixed. > Shortly afterwards, in addition to fixing the overtrusting code, it was > decided never to allow mmap(2) to allow address zero to get mapped, by > never making VM_MIN_ADDRESS equal to zero (I actually argued for this > change to only be

Re: riscv64: adjust VM_MIN_ADDRESS

2022-03-21 Thread Mark Kettenis
> Date: Mon, 21 Mar 2022 19:56:14 + > From: Miod Vallat > > A long, long time ago (I think it was late 2003), OpenBSD/i386 was > vulnerable to a trusted-yet-NULL pointer dereference in the agp code. > The attack involved using mmap(2) with MAP_FIXED and a hint of zero. > > Shortly

Re: [External] : udp_sbappend() with inpcb table mutex

2022-03-21 Thread Alexandr Nedvedicky
Hello, On Mon, Mar 21, 2022 at 04:53:12PM +0100, Alexander Bluhm wrote: > Hi, > > syzkaller and witness found a bug in my pcb table mutex commit. > > https://syzkaller.appspot.com/bug?id=90a4811c99d6a2df7b252971b754612ca632894d > > For multicast and broadcast packets udp_input() traverses the

introduce pfioctl_rw

2022-03-21 Thread Alexandr Nedvedicky
Hello, there was a brief email discussion off-list between bluhm, mbuhl and me preceding diff below. Let me briefly summarize a context for tech@ here. Moritz (mbuhl) is working on a fix reported syzkaller by syzkaller [1]. In order to fix it he wants to move both locks (pf_lock and net_lock)

Re: [patch] CPU frequency scheduler change proposal

2022-03-21 Thread Stuart Henderson
On 2022/03/20 19:51, Stuart Henderson wrote: > On 2022/03/20 18:13, Stuart Henderson wrote: > > On 2022/03/20 18:13, Solene Rapenne wrote: > > > I'm proposing a very simple change to the automatic policy of the CPU > > > frequency scheduler. > > > > > > Currently, every 100ms the scheduler is

riscv64: adjust VM_MIN_ADDRESS

2022-03-21 Thread Miod Vallat
A long, long time ago (I think it was late 2003), OpenBSD/i386 was vulnerable to a trusted-yet-NULL pointer dereference in the agp code. The attack involved using mmap(2) with MAP_FIXED and a hint of zero. Shortly afterwards, in addition to fixing the overtrusting code, it was decided never to

Re: bgpd, remove active prefix cache in rib_element

2022-03-21 Thread Claudio Jeker
On Mon, Mar 21, 2022 at 05:51:36PM +0100, Theo Buehler wrote: > On Mon, Mar 21, 2022 at 05:16:53PM +0100, Claudio Jeker wrote: > > In struct rib_entry bgpd keeps the 'best' or active prefix cached. > > Now to support more than one one prefix per path (for ECMP and add-path) > > I need the ability

riscv64: simplify

2022-03-21 Thread Miod Vallat
The riscv64 was likely copied from an architecture providing optimized byte-swapping code (I'd bet arm64), but doesn't have any such optimization, and copies the MI code. Acknowledge this by dropping the __HAVE_MD_SWAP define to get the MI code for free, rather than duplicating it. Completely

riscv64: faster setregs()

2022-03-21 Thread Miod Vallat
The current state of the kernel starts userland processes with register a0 pointing to the stack, with a comment mentioning this is copied from FreeBSD. But while FreeBSD userland startup code (lib/csu) depends on this, OpenBSD binaries do not need this. Thus, don't bother setting up a0 upon

riscv64: minor tweaks to sig_machdep.c

2022-03-21 Thread Miod Vallat
Two simple changes here: - dumpframe() is not used by anything. I opted to remove it, but it could be wrapped in #if 0 or #ifdef DEBUG if people want to keep it around. - the /* NOTREACHED */ comment in sendsig() is obviously reachable, so remove it and update the comment to match the new

OpenBSD Errata: March 22, 2022 (slaacd)

2022-03-21 Thread Alexander Bluhm
Errata patches for slaacd have been released for OpenBSD 6.9 and 7.0. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata69.html

riscv64: fix kernel longjmp

2022-03-21 Thread Miod Vallat
Unlike userland, the OpenBSD kernel longjmp() function does not take a return value for setjmp as second argument, but is guaranteed to return nonzero. The following diff makes sure the code matches this expectation. Completely untested, yadda yadda. Index: support.S

Re: riscv64: fix kernel longjmp

2022-03-21 Thread Jonathan Gray
On Mon, Mar 21, 2022 at 08:03:40PM +, Miod Vallat wrote: > Unlike userland, the OpenBSD kernel longjmp() function does not take a > return value for setjmp as second argument, but is guaranteed to return > nonzero. > > The following diff makes sure the code matches this expectation. > >

CMSG_DATA(3): add an example for receiving mulitple control messages

2022-03-21 Thread David Gwynne
i couldnt find any good examples of what to do when you wanted to receive multiple control messages from a single recvmsg call. the most interesting bit is how much space the buffer needs to be. if i struggled maybe someone else will too? Index: CMSG_DATA.3

Re: riscv64: faster setregs()

2022-03-21 Thread Jonathan Gray
On Mon, Mar 21, 2022 at 08:00:56PM +, Miod Vallat wrote: > The current state of the kernel starts userland processes with register > a0 pointing to the stack, with a comment mentioning this is copied from > FreeBSD. > > But while FreeBSD userland startup code (lib/csu) depends on this, >

Re: riscv64: minor tweaks to sig_machdep.c

2022-03-21 Thread Jonathan Gray
On Mon, Mar 21, 2022 at 08:24:05PM +, Miod Vallat wrote: > Two simple changes here: > - dumpframe() is not used by anything. I opted to remove it, but it > could be wrapped in #if 0 or #ifdef DEBUG if people want to keep it > around. > - the /* NOTREACHED */ comment in sendsig() is

Re: riscv64: simplify

2022-03-21 Thread Jonathan Gray
On Mon, Mar 21, 2022 at 07:51:25PM +, Miod Vallat wrote: > The riscv64 was likely copied from an architecture > providing optimized byte-swapping code (I'd bet arm64), but doesn't have > any such optimization, and copies the MI code. > > Acknowledge this by dropping the __HAVE_MD_SWAP define

Re: XBox One gamecontroller support

2022-03-21 Thread Stefan Sperling
On Sun, Mar 20, 2022 at 05:00:13PM -0600, Thomas Frohwein wrote: > I updated the diff for the controller with your diff. Below is the > complete diff for all the files involved. I tested it again with my > controller and sdl-jstest (in ports); it continues to work as intended. > > ok? Thanks! Ok

Re: aarch64 I2C usage on Raspberry Pi 4B

2022-03-21 Thread David Gwynne
are you trying to add an i2c device to the sensor framework? or are you asking how to touch i2c devices from userland? > On 21 Mar 2022, at 16:21, Dr. T.I.S. wrote: > > I know the rule, try to research first on man pages, openbsd.org, ect, > and ask people as a last resort. Unfortunately, I

Re: aarch64 I2C usage on Raspberry Pi 4B

2022-03-21 Thread Dr. T.I.S.
Hello, thank you for your reply! I am trying to read data from an i2c sensor. On Mon, Mar 21, 2022 at 2:53 AM David Gwynne wrote: > are you trying to add an i2c device to the sensor framework? or are you > asking how to touch i2c devices from userland? > > > On 21 Mar 2022, at 16:21, Dr.

aarch64 I2C usage on Raspberry Pi 4B

2022-03-21 Thread Dr. T.I.S.
I know the rule, try to research first on man pages, openbsd.org, ect, and ask people as a last resort. Unfortunately, I have exhausted all resources online that I could find. (I was recommend to use this email list by OpenBSd dev on reddit) Currently, I am trying to use I2C on the latest

bgpd, rename flag field

2022-03-21 Thread Claudio Jeker
This diff just renames F_CTL_ACTIVE and F_PREF_ACTIVE to the more correct F_CTL_BEST and F_PREF_BEST. The flags are used to mark the one best path. ACTIVE is not the right term here since with ECMP and add-path more than one route can be active. I will probably add more flags to mark ECMP

Re: have in_pcbselsrc copy the selected ip to the caller instead of a reference to it

2022-03-21 Thread Alexander Bluhm
On Mon, Mar 21, 2022 at 11:13:24AM +0100, Claudio Jeker wrote: > On Mon, Mar 21, 2022 at 02:17:21PM +1000, David Gwynne wrote: > > in_pcbselsrc has this: > > > > ifp = if_get(mopts->imo_ifidx); > > if (ifp != NULL) { > > if (ifp->if_rdomain ==

Re: bgpd, rename flag field

2022-03-21 Thread Theo Buehler
On Mon, Mar 21, 2022 at 10:56:03AM +0100, Claudio Jeker wrote: > This diff just renames F_CTL_ACTIVE and F_PREF_ACTIVE to the more correct > F_CTL_BEST and F_PREF_BEST. The flags are used to mark the one best path. > > ACTIVE is not the right term here since with ECMP and add-path more than > one

Re: have in_pcbselsrc copy the selected ip to the caller instead of a reference to it

2022-03-21 Thread Claudio Jeker
On Mon, Mar 21, 2022 at 02:17:21PM +1000, David Gwynne wrote: > in_pcbselsrc has this: > > ifp = if_get(mopts->imo_ifidx); > if (ifp != NULL) { > if (ifp->if_rdomain == rtable_l2(rtableid)) > IFP_TO_IA(ifp, ia); >

bgpd reload when rib flags change

2022-03-21 Thread Claudio Jeker
During config reload the RIB may need to be resynced when the 'no evaluate' setting changes. This changes the code to actually flush the Adj-RIB-Out of affected peers and then adjust the RIB in a 2nd step. That way there is no need to use rde_generate_updates() to remove the prefixes one by one