qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>, Jevon Qiao <scaleqiao@gmail.com>
Cc: haomaiwang@gmail.com, mst@redhat.com, qemu-devel@nongnu.org,
	aneesh.kumar@linux.vnet.ibm.com, sage@newdream.net,
	ceph-devel@vger.kernel.org, gfarnum@redhat.com
Subject: Re: [Qemu-devel] [PATCH] hw/9pfs: Add CephFS support in VirtFS
Date: Wed, 9 Mar 2016 13:09:58 -0700	[thread overview]
Message-ID: <56E08316.7070805@redhat.com> (raw)
In-Reply-To: <20160309200243.5b00eea7@bahia.lab.toulouse-stg.fr.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

On 03/09/2016 12:02 PM, Greg Kurz wrote:
> On Wed,  2 Mar 2016 23:41:43 +0800
> Jevon Qiao <scaleqiao@gmail.com> wrote:
> 

>> +}
>> +
>> +static int cephfs_readdir_r(FsContext *ctx, V9fsFidOpenState *fs,
>> +                            struct dirent *entry,
>> +                            struct dirent **result)
>> +{
>> +    int ret;

>> +    
>> +    return ret;
> 
> This function should behave like the original readdir_r() function from the
> C library, but it doesn't.
> 

readdir_r() is hopelessly broken.  POSIX is withdrawing it as such.
http://austingroupbugs.net/view.php?id=696

readdir() should be all the more any sane program needs, because it
should already be thread-safe.

> According to the the libcephfs.h header:
> 
>  * @returns 1 if the next entry was filled in, 0 if the end of the directory stream was reached,
>  *          and a negative error code on failure.
>  */
> int ceph_readdir_r(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, struct dirent *de);
> 
> and the readdir_r() manual page says:
> 
>    The  readdir_r() function returns 0 on success.  On error, it returns a
>    positive error number (listed under ERRORS).  If the end of the  direc‐
>    tory  stream  is  reached,  readdir_r()  returns 0, and returns NULL in
>    *result.

readdir_r() can silently overflow buffers, with no recourse.  Its use
should not be encouraged.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-03-09 20:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 15:41 [Qemu-devel] [PATCH] hw/9pfs: Add CephFS support in VirtFS Jevon Qiao
2016-03-08  0:51 ` Jevon Qiao
2016-03-09  9:59   ` Greg Kurz
2016-03-09 19:02 ` Greg Kurz
2016-03-09 20:09   ` Eric Blake [this message]
2016-03-10  9:08     ` Greg Kurz
2016-03-14  2:02   ` Jevon Qiao
     [not found] <1457971368-1335-1-git-send-email-scaleqiao@gmail.com>
2016-03-15  9:30 ` Greg Kurz
2016-03-15 13:39   ` Jevon Qiao
2016-03-15 13:46     ` Greg Kurz
2016-03-15 14:16       ` Jevon Qiao
2016-04-05 15:27         ` Jevon Qiao
2016-04-05 15:31           ` Greg Kurz
2016-04-06  4:28             ` Jevon Qiao
2016-03-15 13:52 ` Michael S. Tsirkin
2016-03-15 14:33   ` Jevon Qiao
2016-04-07 15:50 ` Greg Kurz
2016-04-10  6:55   ` Jevon Qiao
2016-04-13 14:20     ` Greg Kurz
2016-04-16 18:53   ` Aneesh Kumar K.V
2016-04-15 12:01 ` Greg Kurz
2016-04-15 13:21 ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E08316.7070805@redhat.com \
    --to=eblake@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=gfarnum@redhat.com \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=haomaiwang@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sage@newdream.net \
    --cc=scaleqiao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).