xfs
[Top] [All Lists]

Re: [PATCH 5/5] xfstests: test 197, add a testcase for d_off truncation

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 5/5] xfstests: test 197, add a testcase for d_off truncation
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 30 Dec 2008 22:00:17 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20081230230913.619447000@xxxxxxxxxxxxxxxxxxxxxx>
References: <20081230230810.986105000@xxxxxxxxxxxxxxxxxxxxxx> <20081230230913.619447000@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)
Christoph Hellwig wrote:

> Make sure our directory offsets fit into a 32 bit value.
> Based on a report by John Stanley.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 

...

> +struct linux_dirent64 {
> +     uint64_t        d_ino;
> +     int64_t         d_off;
> +     unsigned short  d_reclen;
> +     unsigned char   d_type;
> +        char         d_name[0];
> +};

...

> +             for (bpos = 0; bpos < nread;) {
> +                     d = (struct linux_dirent64 *) (buf + bpos);
> +                     /*
> +                      * Can't use off_t here xfsqa is compiled with
> +                      * -D_FILE_OFFSET_BITS=64
> +                      */
> +                     if (d->d_off != (long)d->d_off) {

So can this test only fail on a 32-bit arch?  I haven't paid enough
attention to the original bug... sorry if that's a dumb question.  :)

-Eric

> +                             fprintf(stderr, "detected d_off truncation "
> +                                             "d_name = %s, d_off = %lld\n",
> +                                             d->d_name, (long long)d->d_off);
> +                             exit(EXIT_FAILURE);
> +                     }
> +                     bpos += d->d_reclen;
> +             }
> +     }
> +
> +     exit(EXIT_SUCCESS);
> +}

<Prev in Thread] Current Thread [Next in Thread>