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:	Wed, 5 Dec 2012 13:46:04 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scatterlist: add a warning if sg_virt() is used on
 highmem pages

On Wed,  5 Dec 2012 12:28:18 +0100
Sebastian Andrzej Siewior <bigeasy@...utronix.de> wrote:

> sg_virt() on highmem pages won't work. This WARN_ON() should catch some
> that still try.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
>  include/linux/scatterlist.h |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> index 4bd6c06..4d4adab 100644
> --- a/include/linux/scatterlist.h
> +++ b/include/linux/scatterlist.h
> @@ -198,6 +198,9 @@ static inline dma_addr_t sg_phys(struct scatterlist *sg)
>   **/
>  static inline void *sg_virt(struct scatterlist *sg)
>  {
> +#ifdef CONFIG_DEBUG_SG
> +	WARN_ON(PageHighMem(sg_page(sg)));
> +#endif
>  	return page_address(sg_page(sg)) + sg->offset;
>  }

Why won't it work?  page_address() will search the kmap table and will
search for the page.  If the caller had previously kmapped that page,
all is well.  If the caller has failed to kmap the page, sg_virt() will
return a nearly-null pointer and presumably someone will later go oops.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ