qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user: Use *at functions to implement inte


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] linux-user: Use *at functions to implement interp_prefix
Date: Tue, 13 Feb 2018 10:38:18 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/13/2018 09:31 AM, Richard Henderson wrote:
I wonder if there are guest programs that make assumptions about
file descriptor numbers such that it would be worthwhile dup2'ing
the interp_dirfd away from the presumably low number fd it will
get by default into something larger...

Hmm.  Using dup2(probe, probe) to test if the new (high) fd itself has not been
allocated?

fcntl(F_DUPFD[_CLOEXEC]) is smarter than dup2/3, if you plan on atomically guaranteeing a dup to a not-in-use fd.

Will dup'ing to a high fd violate assumptions of programs that assume that open() and friends favor the next available fd by default, rather than having a gap? (Probably not, but skipping fds is not usual, so it's worth asking.)


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]