All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aio: Check for aio_flags
@ 2017-02-08  2:33 Goldwyn Rodrigues
  2017-02-08  7:59 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Goldwyn Rodrigues @ 2017-02-08  2:33 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Goldwyn Rodrigues

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

aio_flags are not checked when performing io_submit() and
can contain non-conforming values.
Return -EINVAL if they are invalid.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

diff --git a/fs/aio.c b/fs/aio.c
index 428484f..f2dd175 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1521,6 +1521,11 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
 		return -EINVAL;
 	}
 
+	if (unlikely(iocb->aio_flags & ~IOCB_FLAG_RESFD)) {
+		pr_debug("EINVAL: incorrect flags\n");
+		return -EINVAL;
+	}
+
 	req = aio_get_req(ctx);
 	if (unlikely(!req))
 		return -EAGAIN;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: Check for aio_flags
  2017-02-08  2:33 [PATCH] aio: Check for aio_flags Goldwyn Rodrigues
@ 2017-02-08  7:59 ` Christoph Hellwig
  2017-02-08 11:19   ` Goldwyn Rodrigues
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2017-02-08  7:59 UTC (permalink / raw)
  To: Goldwyn Rodrigues; +Cc: linux-fsdevel, Goldwyn Rodrigues

On Tue, Feb 07, 2017 at 08:33:23PM -0600, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> aio_flags are not checked when performing io_submit() and
> can contain non-conforming values.
> Return -EINVAL if they are invalid.

while this is what we should have done from the start it could break
existing userspace programs now. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: Check for aio_flags
  2017-02-08  7:59 ` Christoph Hellwig
@ 2017-02-08 11:19   ` Goldwyn Rodrigues
  0 siblings, 0 replies; 3+ messages in thread
From: Goldwyn Rodrigues @ 2017-02-08 11:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, Goldwyn Rodrigues



On 02/08/2017 01:59 AM, Christoph Hellwig wrote:
> On Tue, Feb 07, 2017 at 08:33:23PM -0600, Goldwyn Rodrigues wrote:
>> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>>
>> aio_flags are not checked when performing io_submit() and
>> can contain non-conforming values.
>> Return -EINVAL if they are invalid.
> 
> while this is what we should have done from the start it could break
> existing userspace programs now. 
> 

Yes, I agree. it would be the one's who are using it incorrectly and
have been certified to work. However, I did run it through LTP and it
passed the tests (I understand it does not represent all of userspace
programs). We would need to correct behavior at some point in time
hoping not many depend on it.

Besides, this would also restrict expansion of aio_flags, which I intend
to do... (yeah, you see my ulterior motive now ;))

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-08 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08  2:33 [PATCH] aio: Check for aio_flags Goldwyn Rodrigues
2017-02-08  7:59 ` Christoph Hellwig
2017-02-08 11:19   ` Goldwyn Rodrigues

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.