mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Cc: musl@lists.openwall.com
Subject: Re: [musl] BUG: Calling readdir/dirfd after vfork will cause deadlock.
Date: Mon, 27 Jun 2022 09:44:07 +0200	[thread overview]
Message-ID: <87fsjqeek8.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <1656161421.nztip0vma0.none@localhost> (Alex Xu's message of "Sat, 25 Jun 2022 08:56:46 -0400")

* Alex Xu:

> Excerpts from Nick Peng's message of June 24, 2022 11:40 pm:
>> Description:  After vfork, calling functions such as readdir/dirfd may
>> cause deadlock. GNU C is OK.
>
> This is not a bug. TFM:
>
> DESCRIPTION
>    Standard description
>        (From  POSIX.1)  The vfork() function has the same effect as 
>        fork(2), except that the behavior is undefined if the process 
>        created by vfork() either modifies any data other than a variable 
>        of type pid_t used to store the return value from vfork(), or 
>        returns from the function in which vfork() was called, or calls 
>        any other function before successfully calling _exit(2) or one of 
>        the exec(3) family of functions.
>
> It may happen to appear to work in some cases on some libcs, or kernels, 
> or architectures, or it may deadlock, corrupt data, or cause demons to 
> fly out your nose. Do not use vfork in this manner. Avoid using fork in 
> this manner either; that may work in musl 1.2.2+, and appear to work in 
> glibc (but sometimes randomly corrupt data), but is not portable to 
> other libcs.

Could you describe the memory corruption you have seen with
opendir/readdir on glibc?

Thanks,
Florian


  reply	other threads:[~2022-06-27  7:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25  3:40 Nick Peng
2022-06-25 12:51 ` Szabolcs Nagy
2022-06-27  4:05   ` Nick Peng
2022-06-27 10:38     ` Laurent Bercot
2022-06-27 14:21     ` Rich Felker
2022-06-27 14:29     ` Markus Wichmann
2022-06-27  7:42   ` Florian Weimer
2022-06-27  8:37     ` Szabolcs Nagy
2022-06-27  9:23       ` Florian Weimer
2022-06-27 17:33         ` Szabolcs Nagy
2022-06-25 12:56 ` Alex Xu (Hello71)
2022-06-27  7:44   ` Florian Weimer [this message]
2022-06-27 12:28     ` Alex Xu (Hello71)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsjqeek8.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=alex_y_xu@yahoo.ca \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).