Re: [PATCH] Fix F_DUPFD_CLOEXEC operation args

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

 



On 05/03/2013 04:12 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> The F_DUPFD_CLOEXEC operation with fcntl() expects a single
> int argument, specifying the minimum FD number for the newly
> dup'd file descriptor. We were not specifying that causing
> random stack data to be accessed as the FD number. Sometimes
> that worked, sometimes it didn't.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/rpc/virnetsocket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Bug introduced in commit f4287c76 in Aug 2011.  ACK.

> 
> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
> index e950d7f..dcf98b1 100644
> --- a/src/rpc/virnetsocket.c
> +++ b/src/rpc/virnetsocket.c
> @@ -1055,7 +1055,7 @@ int virNetSocketDupFD(virNetSocketPtr sock, bool cloexec)
>      int fd;
>  
>      if (cloexec)
> -        fd = fcntl(sock->fd, F_DUPFD_CLOEXEC);
> +        fd = fcntl(sock->fd, F_DUPFD_CLOEXEC, 0);
>      else
>          fd = dup(sock->fd);
>      if (fd < 0) {
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]