diff mbox

RFC: pwritev2 regression test for invalid flags

Message ID 43631a74-8934-6940-3eaa-e562e49c5cb2@intel.com
State New
Headers show

Commit Message

Jon Derrick June 1, 2017, 5:52 p.m. UTC
Hi Zanella,

On 06/15/2017 04:10 PM, Adhemerval Zanella wrote:
> After the issue with LO_HI_LONG definition on x86_64-linux-gnu, I planed to add 
> this patch to check the above patch for correct check for invalid flags (which
> would also have show this issue with LO_HI_LONG being used on p{read,write}v2).
> 
> However it seems to trigger what I think it is a kernel bug on version that
> provides p{read,write}v, where preadv2 does fails with EOPNOTSUPP but
> pwritev2 does not.  For instance, on x86_64-linux-gnu-x32 and i686-linux-gnu
> (4.10.0-21-generic/x86_64):

It looks like the issue is that you are going through the compat_writev
path, which for some reason discards the flags parameter.

Can you apply the patch below to your kernel?

Comments

Christoph Hellwig June 16, 2017, 6:04 a.m. UTC | #1
On Thu, Jun 01, 2017 at 11:52:25AM -0600, Jon Derrick wrote:
> Can you apply the patch below to your kernel?

I've already sent this patch to Al twice (including a stable tag),
but it didn't seem to make it anywhere.

> diff --git a/fs/read_write.c b/fs/read_write.c
> index c4f88af..f77eb22 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1210,7 +1210,7 @@ static size_t compat_writev(struct file *file,
>         if (!(file->f_mode & FMODE_CAN_WRITE))
>                 goto out;
> 
> -       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, 0);
> +       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags);
> 
>  out:
>         if (ret > 0)
---end quoted text---
Adhemerval Zanella Netto June 16, 2017, 1:01 p.m. UTC | #2
On 16/06/2017 03:04, Christoph Hellwig wrote:
> On Thu, Jun 01, 2017 at 11:52:25AM -0600, Jon Derrick wrote:
>> Can you apply the patch below to your kernel?
> 
> I've already sent this patch to Al twice (including a stable tag),
> but it didn't seem to make it anywhere.

Right, thanks for the reply.  So it is a kernel issue and I think it
should not prevent us to use it a regression test.

> 
>> diff --git a/fs/read_write.c b/fs/read_write.c
>> index c4f88af..f77eb22 100644
>> --- a/fs/read_write.c
>> +++ b/fs/read_write.c
>> @@ -1210,7 +1210,7 @@ static size_t compat_writev(struct file *file,
>>         if (!(file->f_mode & FMODE_CAN_WRITE))
>>                 goto out;
>>
>> -       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, 0);
>> +       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags);
>>
>>  out:
>>         if (ret > 0)
> ---end quoted text---
>
diff mbox

Patch

diff --git a/fs/read_write.c b/fs/read_write.c
index c4f88af..f77eb22 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1210,7 +1210,7 @@  static size_t compat_writev(struct file *file,
        if (!(file->f_mode & FMODE_CAN_WRITE))
                goto out;

-       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, 0);
+       ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags);

 out:
        if (ret > 0)