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: <x49mt6f7ljy.fsf@segfault.boston.devel.redhat.com>
Date:   Wed, 18 Jan 2023 13:19:13 -0500
From:   Jeff Moyer <jmoyer@...hat.com>
To:     Kent Overstreet <kent.overstreet@...ux.dev>
Cc:     linux-kernel@...r.kernel.org, linux-aio@...ck.org,
        linux-fsdevel@...r.kernel.org, fmdefrancesco@...il.com
Subject: Re: [PATCH 1/2] fs/aio: Use kmap_local() instead of kmap()

Hi, Kent,

Kent Overstreet <kent.overstreet@...ux.dev> writes:

> Originally, we used kmap() instead of kmap_atomic() for reading events
> out of the completion ringbuffer because we're using copy_to_user(),
> which can fault.
>
> Now that kmap_local() is a thing, use that instead.

This has already been proposed as part of a more comprehensive patch:
  https://lore.kernel.org/linux-fsdevel/20230109175629.9482-1-fmdefrancesco@gmail.com/

Would you be willing to review that one?

Thanks!
Jeff

>
> Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
> Cc: Benjamin LaHaise <bcrl@...ck.org
> Cc: linux-aio@...ck.org
> Cc: linux-fsdevel@...r.kernel.org
> ---
>  fs/aio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 5b2ff20ad3..3f795ed2a2 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1246,10 +1246,10 @@ static long aio_read_events_ring(struct kioctx *ctx,
>  		avail = min(avail, nr - ret);
>  		avail = min_t(long, avail, AIO_EVENTS_PER_PAGE - pos);
>  
> -		ev = kmap(page);
> +		ev = kmap_local_page(page);
>  		copy_ret = copy_to_user(event + ret, ev + pos,
>  					sizeof(*ev) * avail);
> -		kunmap(page);
> +		kunmap_local(ev);
>  
>  		if (unlikely(copy_ret)) {
>  			ret = -EFAULT;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ