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: <56D41087.60506@samsung.com>
Date:	Mon, 29 Feb 2016 10:33:59 +0100
From:	Marek Szyprowski <m.szyprowski@...sung.com>
To:	Arnd Bergmann <arnd@...db.de>, Joerg Roedel <jroedel@...e.de>,
	Joerg Roedel <joro@...tes.org>, Kukjin Kim <kgene@...nel.org>,
	Krzysztof Kozlowski <k.kozlowski@...sung.com>
Cc:	linux-arm-kernel@...ts.infradead.org,
	iommu@...ts.linux-foundation.org,
	linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu: exynos: pointers are nto physical addresses

Hi Arnd,

On 2016-02-29 09:45, Arnd Bergmann wrote:
> The exynos iommu driver changed an incorrect cast from pointer
> to 'unsigned int' to an equally incorrect cast to a 'phys_addr_t',
> which results in an obvious compile-time error when phys_addr_t
> is wider than pointers are:
>
> drivers/iommu/exynos-iommu.c: In function 'alloc_lv2entry':
> drivers/iommu/exynos-iommu.c:918:32: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>
> The code does not actually want the physical address (which would
> involve using virt_to_phys()), but just checks the alignment,
> so we can change it to use a cast to uintptr_t instead.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> Fixes: 740a01eee9ad ("iommu/exynos: Add support for v5 SYSMMU")

Thanks for this fix.

> ---
> I also see that some incorrect __raw_writel() calls have crept in
> around the same time, which breaks running big-endian kernels when
> this driver is loaded.
>
> Please fix and that that as well.

Okay, so in the driver code all __raw_writel should be replaced by
writel(), right?

Those __raw_writel() calls were there from the beginning and I didn't
know that they should not be used in the driver code.

>   drivers/iommu/exynos-iommu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index b0665042bf29..484b3b37631f 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -915,7 +915,7 @@ static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain,
>   		bool need_flush_flpd_cache = lv1ent_zero(sent);
>   
>   		pent = kmem_cache_zalloc(lv2table_kmem_cache, GFP_ATOMIC);
> -		BUG_ON((phys_addr_t)pent & (LV2TABLE_SIZE - 1));
> +		BUG_ON((uintptr_t)pent & (LV2TABLE_SIZE - 1));
>   		if (!pent)
>   			return ERR_PTR(-ENOMEM);
>   

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ