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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110822134348.a57db0e1.akpm@linux-foundation.org>
Date:	Mon, 22 Aug 2011 13:43:48 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Akinobu Mita <akinobu.mita@...il.com>
Cc:	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 2/4] debug-pagealloc: add support for highmem pages

On Tue, 23 Aug 2011 01:29:06 +0900
Akinobu Mita <akinobu.mita@...il.com> wrote:

> This adds support for highmem pages poisoning and verification to the
> debug-pagealloc feature for no-architecture support.
> 
> ...
>
>  static void poison_page(struct page *page)
>  {
>  	void *addr;
> -
> -	if (PageHighMem(page)) {
> -		poison_highpage(page);
> -		return;
> +	unsigned long flags;
> +	bool highmem = PageHighMem(page);
> +
> +	if (highmem) {
> +		local_irq_save(flags);
> +		addr = kmap_atomic(page);
> +	} else {
> +		addr = page_address(page);
>  	}
>  	set_page_poison(page);
> -	addr = page_address(page);
>  	memset(addr, PAGE_POISON, PAGE_SIZE);
> +
> +	if (highmem) {
> +		kunmap_atomic(addr);
> +		local_irq_restore(flags);
> +	}
>  }

This seems more complicated than is needed.  Couldn't we just do

static void poison_page(struct page *page)
{
	void *addr;

	preempt_disable();
	addr = kmap_atomic(page);
	set_page_poison(page);
	memset(addr, PAGE_POISON, PAGE_SIZE);
	kunmap_atomic(addr);
	preempt_enable();
}

?

> +		addr = kmap_atomic(page);

That reminds me - we need to convert every "kmap_atomic(p, foo)" to
"kmap_atomic(p)" then remove the kmap_atomic back-compatibility macro.

--
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