lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 Jul 2019 10:43:46 -0400
From:   Jeff Moyer <jmoyer@...hat.com>
To:     "zhangyi \(F\)" <yi.zhang@...wei.com>
Cc:     <linux-aio@...ck.org>, <linux-fsdevel@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <bcrl@...ck.org>,
        <viro@...iv.linux.org.uk>, <wangkefeng.wang@...wei.com>
Subject: Re: [PATCH] aio: add timeout validity check for io_[p]getevents

"zhangyi (F)" <yi.zhang@...wei.com> writes:

> io_[p]getevents syscall should return -EINVAL if if timeout is out of
> range, add this validity check.
>
> Signed-off-by: zhangyi (F) <yi.zhang@...wei.com>
> ---
>  fs/aio.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 01e0fb9..dd967a0 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -2031,10 +2031,17 @@ static long do_io_getevents(aio_context_t ctx_id,
>  		struct io_event __user *events,
>  		struct timespec64 *ts)
>  {
> -	ktime_t until = ts ? timespec64_to_ktime(*ts) : KTIME_MAX;
> -	struct kioctx *ioctx = lookup_ioctx(ctx_id);
> +	ktime_t until = KTIME_MAX;
> +	struct kioctx *ioctx = NULL;
>  	long ret = -EINVAL;
>  
> +	if (ts) {
> +		if (!timespec64_valid(ts))
> +			return ret;
> +		until = timespec64_to_ktime(*ts);
> +	}
> +
> +	ioctx = lookup_ioctx(ctx_id);
>  	if (likely(ioctx)) {
>  		if (likely(min_nr <= nr && min_nr >= 0))
>  			ret = read_events(ioctx, min_nr, nr, events, until);

Reviewed-by: Jeff Moyer <jmoyer@...hat.com>

The previous suggestion[1] of fixing the helpers never materialized, so
let's just get this fixed, already.

-Jeff

[1] https://marc.info/?l=linux-fsdevel&m=152209450618587&w=2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ