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, 30 Jul 2015 15:59:45 +0200
From:	Michal Nazarewicz <mina86@...a86.com>
To:	Feng Tang <feng.tang@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Joonsoo Kim <iamjoonsoo.kim@....com>,
	linux-kernel@...r.kernel.org
Cc:	Feng Tang <feng.tang@...el.com>
Subject: Re: [PATCH] CMA: Don't return a valid cma for non-cma dev

On Thu, Jul 30 2015, Feng Tang wrote:
> When system(one x86 soc) boot, we saw many normal dma allocation requests
> goes to cma area. The call chain is
> 	dma_generic_alloc_coherent
> 	    dma_alloc_from_contiguous	-- arch/x86/kernel/pci-dma.c
> 	        cma_alloc(dev_get_cma_area(dev), count, align)
>
> Current dev_get_cma_area() will return a valid "cma" anyway. Then all
> these requests will be taken as valid cma request, and get pages from
> cma area, which has 2 problems:
> 1. make the cma area fragmented
> 2. confuse the cma reservation, usually cma memory size is set according
>    to the expectation of system scenario, these unexpected requests
>    will affect the designed cma usage.
>
> So this patch will enforce the judgement, and only return valid "cma"
> for real cma user, thus make normal user like IO device driver not
> abuse cma reserved region.

Just don’t set dma_contiguous_default_area.  This patch defeats the
purpose of a *default* area.

> Signed-off-by: Feng Tang <feng.tang@...el.com>
> ---
>  include/linux/dma-contiguous.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
> index 569bbd0..d6ccc19 100644
> --- a/include/linux/dma-contiguous.h
> +++ b/include/linux/dma-contiguous.h
> @@ -66,7 +66,8 @@ static inline struct cma *dev_get_cma_area(struct device *dev)
>  {
>  	if (dev && dev->cma_area)
>  		return dev->cma_area;
> -	return dma_contiguous_default_area;
> +	else
> +		return NULL;
>  }
>  
>  static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
> -- 
> 1.7.9.5
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--
--
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