linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Mapping to 0x0
@ 2006-02-22 14:10 Jan Engelhardt
  2006-02-22 14:31 ` linux-os (Dick Johnson)
  2006-02-24 11:37 ` Michael Buesch
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Engelhardt @ 2006-02-22 14:10 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hello,



from somewhere in my INBOX, this claim was made:

>> (also note that userland processes can map 0x00000000 and the kernel 
>> would jump to it ...)

In C code:

#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
int main(void) {
    int fd   = open("badcode.bin", O_RDONLY);
    mmap(NULL, 4096, PROT_READ | PROT_EXEC, MAP_FIXED, fd, 0);
}

The mmap() usually succeeds and maps something at address 0x00000000. Now 
what if the kernel would try to execute this (of course badly programmed) 
code in the context of this very process?

    int (*callback)(int xyz) = NULL;
    callback();

Would not be the badcode be executed with kernel privileges?



Jan Engelhardt
-- 


^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <5J30B-8wi-7@gated-at.bofh.it>]

end of thread, other threads:[~2006-02-25 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-22 14:10 Mapping to 0x0 Jan Engelhardt
2006-02-22 14:31 ` linux-os (Dick Johnson)
2006-02-23 17:14   ` Jan Engelhardt
2006-02-23 17:45     ` linux-os (Dick Johnson)
2006-02-24 11:37 ` Michael Buesch
2006-02-25 18:25   ` Kyle Moffett
2006-02-25 22:10     ` Jan Engelhardt
     [not found] <5J30B-8wi-7@gated-at.bofh.it>
2006-02-24  2:17 ` Robert Hancock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).