Re: [PATCH] close.2: Suggest shutdown(2) when closing socket from another thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 25, 2023 at 08:05:01PM +0200, Alejandro Colomar wrote:
> Hi Tomáš,
> 
> On 2023-08-22 17:19, Tomáš Golembiovský wrote:
> > This is another take on the ancient saga of closing sockets from one
> > thread while another thread is blocked on recv(2). It all started with
> > [1,2] and continued by [3]. It was established that this is expected and
> > long term behavior or Linux and the issue was closed by Michael Kerrisk
> > by commit c2f15a1349a7271f6c1d81361ec8b256266e1c09.
> > 
> > This is all fine and the patch covered the issue in general terms.
> > However, it does not mention the specific case of sockets and shutdown,
> > where the issue can be (at least for the read case) mitigated by proper
> > shutdown. While one may argue that such information may be implied by
> > other man pages (perhaps return value of recv(2)) and thus is redundant,
> > it seems only fair to mention shutdown(2) here as it is only rarely
> > noted in Linux documentation that properly shutting down both side of
> > the socket is a good programming practice when dealing with sockets.
> > 
> > As a test program I am attaching the program originally written by Lukas
> > Czerner. Only with small fixes here and there.
> > 
> > [1] https://lore.kernel.org/linux-man/1314620800-15587-1-git-send-email-lczerner@xxxxxxxxxx/
> > [2] https://bugzilla.redhat.com/show_bug.cgi?id=650985
> > [3] https://bugzilla.kernel.org/show_bug.cgi?id=53781
> > 
> > ```c
> > /**
> >  * Copyright 2011 (C) Red Hat, Inc., Lukas Czerner <lczerner@xxxxxxxxxx>
> >  * Copyright 2023 (C) Red Hat, Inc., Tomas Golembiovsky <tgolembi@xxxxxxxxxx>
> >  *
> >  * This program is free software; you can redistribute it and/or
> >  * modify it under the terms of the GNU General Public License as
> >  * published by the Free Software Foundation.
> 
> No version of the GPL may be understood as GPL-1.0-or-later.  I suggest
> specifying.  But rather, we prefer SPDX license tags in this project,
> so could you please specify the license as something SPDX?

I have checked with Lukas and GPL-2.0-or-later will be used. I will post
a new patch with updated file header.

    Tomas




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux