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]
Message-ID: <20190612092403.GA38578@lakrids.cambridge.arm.com>
Date:   Wed, 12 Jun 2019 10:24:04 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Stephen Bates <sbates@...thlin.com>
Cc:     "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jens Axboe <axboe@...nel.dk>,
        "shhuiw@...mail.com" <shhuiw@...mail.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] io_uring: fix SQPOLL cpu check

On Tue, Jun 11, 2019 at 11:56:06PM +0000, Stephen  Bates wrote:
> The array_index_nospec() check in io_sq_offload_start() is performed
> before any checks on p->sq_thread_cpu are done. This means cpu is
> clamped and therefore no error occurs when out-of-range values are
> passed in from userspace. This is in violation of the specification
> for io_ring_setup() and causes the io_ring_setup unit test in liburing
> to regress.
> 
> Add a new bounds check on sq_thread_cpu at the start of
> io_sq_offload_start() so we can exit the function early when bad
> values are passed in.
> 
> Fixes: 975554b03edd ("io_uring: fix SQPOLL cpu validation")
> Signed-off-by: Stephen Bates <sbates@...thlin.com>

Aargh. My original patch [1] handled that correctly, and this case was
explicitly called out in the commit message, which was retained even
when the patch was "simplified". That's rather disappointing. :/

Thanks,
Mark.

[1] https://lore.kernel.org/lkml/20190430123451.44227-1-mark.rutland@arm.com/

> ---
>  fs/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 30a5687..e458470 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2316,6 +2316,9 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
>  {
>  	int ret;
>  
> +	if (p->sq_thread_cpu >= nr_cpu_ids)
> +		return -EINVAL;
> +
>  	init_waitqueue_head(&ctx->sqo_wait);
>  	mmgrab(current->mm);
>  	ctx->sqo_mm = current->mm;
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ