On 05/22/2013 06:49 PM, Eric Blake wrote: > I am trying to fix a bug in libvirt where a child process deadlocked > because it called initgroups() in between fork and exec when the parent > was multithreaded; it turns out that looking up group membership > information requires a mutex, but if some other thread in the parent > owns that mutex at the time of the fork, then the child will no longer > have that thread around to ever release the mutex. The solution is to > not call initgroups, but to instead split the use of the underlying > pieces of what initgroups does - a call to getgrouplist prior to forking > (requires the mutex, but pre-fork is safe) and a call to setgroups after > forking (no lookup required, therefore no mutex involved and no deadlock > possible). I ended up writing my own wrapper around getgrouplist, and > only then discovered that gnulib's mgetgroups module does a better job > at the task, except for one bit: mgetgroups is currently GPLv3 but > libvirt wants LGPLv2+. > > Since getgrouplist is implemented in glibc as LGPLv2+, is there any > objection to relicensing the following modules as LGPLv2+? > > For my argument on the xalloc-oversized module, observe that malloca.h > (part of the LGPLv2+ malloca module) has effectively inlined the > contents of lib/xalloc-oversized.h, so while the larger xalloc module > will never be LGPL (it calls exit), the mere use of checking for > oversized allocation has already been intentionally isolated for safe > use in LGPL code. > > For my own contributions to these modules, I'm okay with relaxing to > LGPLv2+. I've cc'd all other contributors as tracked by gnulib.git's > history (I'm not sure if coreutils.git would turn up any earlier authors > from before we promoted mgetgroups from coreutils to gnulib).
I rewrote mgetgroups at one stage in coreutils. I'm fine with the relicense. James Youngman (CC'd) rewrote it to use getgrouplist if available: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=49f7eba cheers, Pádraig. > I did track the history of xalloc-oversized changes further back from when the > macro was part of the larger xalloc.h (pre-split contributors marked in > '()'). Module maintainers are denoted with *. > > getgroups [LGPLv3+] => *Jim, *Eric, Bruno, Paul > getugroups [GPLv3+] => *Jim, Eric, Paul, Bruno, Lasse > mgetgroups [GPLv3+] => *Jim, *Eric, Bruno > xalloc-oversized [GPLv3+] => [*all] Eric, Paul, Jim, (Bruno) > > Also, I plan on submitting a doc patch on the gnulib initgroups.texi > page warning about the portability pitfall of trying to use it to change > the the id of a child process of a multithreaded parent. >