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: <20090629040954.GA13117@elte.hu>
Date:	Mon, 29 Jun 2009 06:09:54 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	"Figo.zhang" <figo1802@...il.com>
Cc:	lkml <linux-kernel@...r.kernel.org>, Andrew Morton <akpm@...l.org>
Subject: Re: [PATCH]highmem_32.c: add argument pointer checking


* Figo.zhang <figo1802@...il.com> wrote:

> It had better add argument pointer checking.
> 
> If any guys write driver want to alloc hightmem and pass a no-initial pointer,
> it would be crashed.
> 
> Signed-off-by: Figo.zhang <figo1802@...il.com>
> ---  
> arch/x86/mm/highmem_32.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
> index 58f621e..e52e1a9 100644
> --- a/arch/x86/mm/highmem_32.c
> +++ b/arch/x86/mm/highmem_32.c
> @@ -31,6 +31,7 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
>  {
>  	enum fixed_addresses idx;
>  	unsigned long vaddr;
> +	BUG_ON(!page);
>  
>  	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
>  	pagefault_disable();
> @@ -58,6 +59,9 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
>  	unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
>  	enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
>  
> +	if(!kvaddr)
> +		return;
> +

(Please run patches through scripts/checkpatch.pl before 
submission.)

Also, what's the improvement here? Before the patch we'd crash on a 
NULL dereference ... after the patch we'd crash on a BUG_ON().

Furthermore, he kunmap_atomic() change is outright wrong - it will 
now allow NULL kunmaps, which can hide bugs in drivers.

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