This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/22273] Improper assert in Linux posix_spawn implementation


https://sourceware.org/bugzilla/show_bug.cgi?id=22273

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I do not see the scenario you described as expected because of CLONE_VFORK and
every fail path is handled on 'fail' label.  On the code:

271   args->err = 0;                                                            
272   args->exec (args->file, args->argv, args->envp);                          
273                                                                             
274   /* This is compatibility function required to enable posix_spawn run      
275      script without shebang definition for older posix_spawn versions       
276      (2.15).  */                                                            
277   maybe_script_execute (args);                                              
278                                                                             
279 fail:                                                                       
280   /* errno should have an appropriate non-zero value; otherwise,            
281      there's a bug in glibc or the kernel.  For lack of an error code       
282      (EINTERNALBUG) describing that, use ECHILD.  Another option would      
283      be to set args->err to some negative sentinel and have the parent      
284      abort(), but that seems needlessly harsh.  */                          
285   args->err = errno ? : ECHILD;                                             
286   _exit (SPAWN_ERROR);                                                      
287 }

So the input err memory position won't be accessed concurrently on parent
because CLONE_VFORK (since kernel interface guarantee that calling process is
suspended) and all return path on the child functions will be either default
execution through args->exec/maybe_script_execute or through the fail label.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]