Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
Re: Remove soassertlocked() assertion from soreserve()
To:
Vitaliy Makkoveev <mvs@openbsd.org>
Cc:
tech@openbsd.org
Date:
Mon, 17 Feb 2025 18:46:08 +0100

Download raw body.

Thread
On Mon, Feb 17, 2025 at 12:43:23PM +0300, Vitaliy Makkoveev wrote:
> We don't need it anymore. Note, the modification of both socket buffers
> is serialized.

I found some sb_hiwat reads which are not protected by sb_mtx.  But
they have socket lock.  We could keep socket lock here and not care
about sb_mtx.

Any reason why you want to remove it?  Is socket lock not taken
anyway by all callers?

bluhm

> Index: sys/kern/uipc_socket2.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket2.c,v
> diff -u -p -r1.180 uipc_socket2.c
> --- sys/kern/uipc_socket2.c	17 Feb 2025 08:56:33 -0000	1.180
> +++ sys/kern/uipc_socket2.c	17 Feb 2025 09:34:24 -0000
> @@ -609,8 +609,6 @@ sowakeup(struct socket *so, struct sockb
>  int
>  soreserve(struct socket *so, u_long sndcc, u_long rcvcc)
>  {
> -	soassertlocked(so);
> -
>  	mtx_enter(&so->so_rcv.sb_mtx);
>  	mtx_enter(&so->so_snd.sb_mtx);
>  	if (sbreserve(&so->so_snd, sndcc))