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: <20160114213048.GB19062@n2100.arm.linux.org.uk>
Date:	Thu, 14 Jan 2016 21:30:48 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Grygorii Strashko <grygorii.strashko@...com>
Cc:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Sekhar Nori <nsekhar@...com>, linux-rt-users@...r.kernel.org,
	linux-arm <linux-arm-kernel@...ts.infradead.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [4.4-rc6-rt1 PATCH 0/2] ARM: am437x: boot test report

On Thu, Jan 14, 2016 at 10:11:09PM +0200, Grygorii Strashko wrote:
> diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
> index deabc36..b9b4f9c 100644
> --- a/arch/arm/mm/highmem.c
> +++ b/arch/arm/mm/highmem.c
> @@ -167,7 +167,7 @@ void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p)
>          * Clear @prev's kmap_atomic mappings
>          */
>         for (i = 0; i < prev_p->kmap_idx; i++) {
> -               int idx = i + KM_TYPE_NR * smp_processor_id();
> +               int idx = FIX_KMAP_BEGIN + i + KM_TYPE_NR * smp_processor_id();
>  
>                 set_fixmap_pte(idx, __pte(0));
>         }
> @@ -175,7 +175,7 @@ void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p)
>          * Restore @next_p's kmap_atomic mappings
>          */
>         for (i = 0; i < next_p->kmap_idx; i++) {
> -               int idx = i + KM_TYPE_NR * smp_processor_id();
> +               int idx = FIX_KMAP_BEGIN + i + KM_TYPE_NR * smp_processor_id();
>  
>                 if (!pte_none(next_p->kmap_pte[i]))
>                         set_fixmap_pte(idx, next_p->kmap_pte[i]);

This looks like it introduces the 4th and 5th copies of the same
calcuation, so can I suggest that we do this to prevent this kind
of error?

diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index d02f8187b1cc..61f0d5941116 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -34,6 +34,11 @@ static inline pte_t get_fixmap_pte(unsigned long vaddr)
 	return *ptep;
 }
 
+static unsigned int fixmap_idx(int type)
+{
+	return FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id();
+}
+
 void *kmap(struct page *page)
 {
 	might_sleep();
@@ -79,7 +84,7 @@ void *kmap_atomic(struct page *page)
 
 	type = kmap_atomic_idx_push();
 
-	idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id();
+	idx = fixmap_idx(type);
 	vaddr = __fix_to_virt(idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
 	/*
@@ -106,7 +111,7 @@ void __kunmap_atomic(void *kvaddr)
 
 	if (kvaddr >= (void *)FIXADDR_START) {
 		type = kmap_atomic_idx();
-		idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id();
+		idx = fixmap_idx(type);
 
 		if (cache_is_vivt())
 			__cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE);
@@ -138,7 +143,7 @@ void *kmap_atomic_pfn(unsigned long pfn)
 		return page_address(page);
 
 	type = kmap_atomic_idx_push();
-	idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id();
+	idx = fixmap_idx(type);
 	vaddr = __fix_to_virt(idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
 	BUG_ON(!pte_none(get_fixmap_pte(vaddr)));


-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ