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: <46BAB078.4020307@zytor.com>
Date:	Wed, 08 Aug 2007 23:13:12 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	jidong xiao <jidong.xiao@...il.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: Question on IS_ERR

jidong xiao wrote:
> I saw we call IS_ERR(ptr) after executing kthread_run() each time.
> But we don't need to call IS_ERR(ptr) after kmalloc().
> 
> My understanding is,
> the kernel pointer ptr for IS_ERR to check should be page aligned, so
> its kernel address should be less than 0xfffff000(or 0xffff ffff ffff
> f000, 64bits),
> 
> kthread_run returns a struct task_struct pointer,which is always page aligned,
> however the pointer returned by kmalloc() might not be page aligned,
> so we cannot use IS_ERR to check.
> 
> Is my understanding correct?
> 

No.  There is no requirement that the pointer is page-aligned.  The last
page of the address space is (in the Linux kernel) invalid by
definition, so there are in effect three kinds of pointers in the Linux
kernel: valid pointers, NULL, and ERR_PTR()s.

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