GNU bug report logs - #55223
Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludovic.courtes <at> inria.fr>

Date: Mon, 2 May 2022 14:53:02 UTC

Severity: important

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55223 in the body.
You can then email your comments to 55223 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#55223; Package guix. (Mon, 02 May 2022 14:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 02 May 2022 14:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: bug-guix <at> gnu.org
Subject: Shepherd 0.9.0 ‘make-inetd-constructor’
 can leak file descriptors
Date: Mon, 02 May 2022 16:52:05 +0200
‘make-inetd-constructor’ creates a socket and then calls bind(2) on it.

--8<---------------cut here---------------start------------->8---
  (lambda args
    (let ((sock  (non-blocking-port
                  (socket (sockaddr:fam address) socket-style 0)))
          […])
      (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
      […]
      (bind sock address)
--8<---------------cut here---------------end--------------->8---

If bind(2) fails, for instance with EADDRINUSE, the socket it created is
leaked; it will be closed “eventually”, when GC runs, but that could
happen much later.

Solution is to use some sort of ‘unwind-protect’ and close it upon
exception.

Ludo’.




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 02 May 2022 20:50:01 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 02 May 2022 21:12:02 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
bug acknowledged by developer. (Mon, 02 May 2022 21:12:02 GMT) Full text and rfc822 format available.

Message #12 received at 55223-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 55223-done <at> debbugs.gnu.org
Subject: Re: bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors
Date: Mon, 02 May 2022 23:11:45 +0200
Ludovic Courtès <ludovic.courtes <at> inria.fr> skribis:

> ‘make-inetd-constructor’ creates a socket and then calls bind(2) on it.
>
>   (lambda args
>     (let ((sock  (non-blocking-port
>                   (socket (sockaddr:fam address) socket-style 0)))
>           […])
>       (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
>       […]
>       (bind sock address)
>
> If bind(2) fails, for instance with EADDRINUSE, the socket it created is
> leaked; it will be closed “eventually”, when GC runs, but that could
> happen much later.

Fixed in Shepherd commit b4a30a309f0e9451a671691b19fa7a5e1ef92b69.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 31 May 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.