|
Message-ID: <87fsjqeek8.fsf@oldenburg.str.redhat.com> Date: Mon, 27 Jun 2022 09:44:07 +0200 From: Florian Weimer <fweimer@...hat.com> To: "Alex Xu (Hello71)" <alex_y_xu@...oo.ca> Cc: musl@...ts.openwall.com Subject: Re: BUG: Calling readdir/dirfd after vfork will cause deadlock. * 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.