On Thu, Sep 01, 2022 at 10:58:49PM +0300, Vitaliy Makkoveev wrote:
> On Thu, Sep 01, 2022 at 09:00:50PM +0200, Alexander Bluhm wrote:
> > On Mon, Aug 15, 2022 at 05:12:22PM +0200, Alexander Bluhm wrote:
> > > System calls should not fail due to temporary memory shortage in
> > > malloc(9) or pool_get(9).
> > > 
> > > Pass down a wait flag to pru_attach().  During syscall socket(2)
> > > it is ok to wait, this logic was missing for internet pcb.  Pfkey
> > > and route sockets were already waiting.
> > > 
> > > sonewconn() cannot wait when called during TCP 3-way handshake.
> > > This logic has been preserved.  Unix domain stream socket connect(2)
> > > can wait until the other side has created the socket to accept.
> > 
> > rebased to -current.
> > 
> > Anyone?
> > 
> 
> At least these ones should have the "pcb == NULL" check as the inet and
> unix cases. Or the `wait' could be ignored for all cases except tcp.
> 
> > -   kp = pool_get(&pkpcb_pool, PR_WAITOK|PR_ZERO);
> > +   kp = pool_get(&pkpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
> > +       PR_ZERO);
> >     so->so_pcb = kp;
> 
> > -   rop = pool_get(&rtpcb_pool, PR_WAITOK|PR_ZERO);
> > +   rop = pool_get(&rtpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
> > +       PR_ZERO);
> >     so->so_pcb = rop;
> 

But I don't understand what this diff fixes? Userland will check the
socket(2) return value in any cases, because it's absolutely normal to
fail here. And nothing stops userland to call socket(2) as times as
required.

Reply via email to