semctl, semget and semop possible panics

2022-09-16 Thread Moritz Buhl
Syzkaller found a panic with sysv semaphores: https://syzkaller.appspot.com/bug?id=f7e8e2822779918d7a23d9ff9d7c0a3779c00a46 The problem is that the code uses a few globals (sema, semtot, seminfo) that can change during sleeping points where the kernel lock is released. Usually copyin, copyout, mal

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 13:20 +, Miod Vallat wrote: > > I've also removed the hidkbd_apple_mba_iso_munge() function as it is > > the same as hidkbd_apple_iso_munge() so this also cleans up the switch > > in ukbd.c > > Oh no, it isn't. > > See, you are in a maze of twisty little functions, all alike. > >

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Miod Vallat
> I've also removed the hidkbd_apple_mba_iso_munge() function as it is > the same as hidkbd_apple_iso_munge() so this also cleans up the switch > in ukbd.c Oh no, it isn't. See, you are in a maze of twisty little functions, all alike. The current state of ukbd has four apple munge routines: - "

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 13:03 +, Miod Vallat wrote: > > rev3: > > Almost there! Minor nits below, then ok. > > > Index: dev/hid/hidkbd.c > > > +static const struct hidkbd_translation apple_iso_trans[] = { > > + { 53, 100 },/* less -> grave */ > > + { 100, 53 } > > +}; > > + > > +static const str

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Miod Vallat
> rev3: Almost there! Minor nits below, then ok. > Index: dev/hid/hidkbd.c > +static const struct hidkbd_translation apple_iso_trans[] = { > + { 53, 100 },/* less -> grave */ > + { 100, 53 } > +}; > + > +static const struct hidkbd_translation apple_iso_mba_trans[] = { > + { 53, 1

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 12:43 +, Miod Vallat wrote: > > On 16/09/22 12:20 +, Miod Vallat wrote: > > > > Index: dev/hid/hidkbdtrans.h > > > > > > > +static const struct hidkbd_translation apple_fn_trans[] = { > > > > > > No effing way. Every file including this header will embed its own copy > > > of

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 12:45 +, Klemens Nanni wrote: > > Index: dev/hid/hidkbd.c > > > +static const struct hidkbd_translation apple_mba_trans[] = { > > These *_apple_* structs could be under #ifdef __arm64__ as only arm64 > has a driver using them, no? no. ukbd(4)

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Klemens Nanni
> Index: dev/hid/hidkbd.c > +static const struct hidkbd_translation apple_mba_trans[] = { These *_apple_* structs could be under #ifdef __arm64__ as only arm64 has a driver using them, no? > +static const struct hidkbd_translation apple_iso_trans[] = { > +static const struct hidkbd_translation

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 06:40 -0600, Theo de Raadt wrote: > > thing inside !SMALL_KERNEL > > Is that neccessary? > > Because arm64 has no limitation on bsd.rd size but hidkbd is not arm64 only

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Miod Vallat
> On 16/09/22 12:20 +, Miod Vallat wrote: > > > Index: dev/hid/hidkbdtrans.h > > > > > +static const struct hidkbd_translation apple_fn_trans[] = { > > > > No effing way. Every file including this header will embed its own copy > > of these tables. > > > > Better keep the tables in their ori

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Theo de Raadt
> thing inside !SMALL_KERNEL Is that neccessary? Because arm64 has no limitation on bsd.rd size

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 12:20 +, Miod Vallat wrote: > > Index: dev/hid/hidkbdtrans.h > > > +static const struct hidkbd_translation apple_fn_trans[] = { > > No effing way. Every file including this header will embed its own copy > of these tables. > > Better keep the tables in their original locations. T

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Miod Vallat
> Index: dev/hid/hidkbdtrans.h > +static const struct hidkbd_translation apple_fn_trans[] = { No effing way. Every file including this header will embed its own copy of these tables. Better keep the tables in their original locations. The munge interfaces already take a pointer to a table and it

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 16/09/22 14:01 +0200, Robert Nagy wrote: > On 14/09/22 17:21 +0200, Tobias Heider wrote: > > On Wed, Sep 14, 2022 at 11:56:48AM +, Miod Vallat wrote: > > > > Hey, > > > > > > > > the diff below adds FN key combos for Page Up, Page Down and some more > > > > on the M2 keyboard. Most of the

Re: apldckbd(4): add fn key combose for Page Up/Down

2022-09-16 Thread Robert Nagy
On 14/09/22 17:21 +0200, Tobias Heider wrote: > On Wed, Sep 14, 2022 at 11:56:48AM +, Miod Vallat wrote: > > > Hey, > > > > > > the diff below adds FN key combos for Page Up, Page Down and some more > > > on the M2 keyboard. Most of the logic was copied from ukbd. > > > > This means most of