[linux-lvm] [lvm-devel] MUSL fun

Zdenek Kabelac zkabelac at redhat.com
Sat Feb 13 21:36:20 UTC 2016

Dne 13.2.2016 v 22:31 Brendan Heading napsal(a):
>>> There is a reason from lvm2 implementation here - freopen() is not giving
>>> application full control over internal buffer allocation and we need to be
>>> sure we lock-in memory for critical section - and some glibc versions are
>>> allocating buffers here via 'mmap' call.
>>> That said - there could be accepted a patch checking in configure  for
>>> 'read-only' stdin  - and using then #ifdef compilation that would
>>> replace use of  internal lvm2 reopen code with libc function.
>> I had a suspicion you would have a good reason.
>> On first glance your proposal sounds like a good compromise and one
>> that would be worth exploring.
> As an alternative idea, what about changing the codebase not to use
> stdin/stdout/stderr, using it's own file descriptor names and calling
> dup2() as appropriate to set them up on startup ?
> Just flying the kite - I haven't looked to see how painful this might be.


Well don't know anyone who would play with this approach which is several 
orders in magnitude more difficult then the plain and simple #ifdef.

I also assume we may probably even overwrite value of stdin via tricky pointer 
magic so compiler will not be able to spot mods of stdin in buildtime.



More information about the linux-lvm mailing list