Index | Thread | Search

From:
Vitaliy Makkoveev <mvs@openbsd.org>
Subject:
Re: Use `sb_mtx' instead of `inp_mtx' in receive path for inet sockets
To:
Alexander Bluhm <alexander.bluhm@gmx.net>
Cc:
tech@openbsd.org
Date:
Mon, 12 Feb 2024 19:14:20 +0300

Download raw body.

Thread
On Mon, Feb 12, 2024 at 03:57:20PM +0100, Alexander Bluhm wrote:
> On Mon, Feb 12, 2024 at 03:25:14AM +0300, Vitaliy Makkoveev wrote:
> > This time only sbappendaddr() requires to hold sb_mtx for some
> > cases, so it uses sbmtxassertlocked() instead of soassertlocked().
> 
> I looks like regress already found something.  This was a test with
> your diff applied.
> 
> [-- MARK -- Sun Feb 11 21:30:00 2024]
> splassert: soassertlocked: want 0 have 1
> Starting stack trace...
> soassertlocked(0) at soassertlocked+0xc7
> soassertlocked(d7e26a68) at soassertlocked+0xc7
> sbappendaddr(d7e26a68,d7e26adc,f58028c4,d8c73900,0) at sbappendaddr+0x21
> divert_packet(d8c73900,1,9a02) at divert_packet+0x239
> pf_test(2,1,d835c830,f5802a70) at pf_test+0x873
> ip_input_if(f5802a70,f5802a5c,f5802a88,0,d835c830) at ip_input_if+0xab
> ipv4_input(d835c830,d8c73900) at ipv4_input+0x3a
> ether_input(d835c830,d8c73900) at ether_input+0x2c4
> if_input_process(d835c830,f5802ac4) at if_input_process+0x4d
> ifiq_process(d835cb00) at ifiq_process+0x66
> taskq_thread(d82e7000) at taskq_thread+0x84
> End of stack trace.

That's interesting. Divert sockets are raw inet sockets, so `sb_flags'
should have SB_MTXLOCK bit set, but it seems to be missing. Can you
check this please?