public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Dan Kruchinin" <dubalom@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy@xensource.com>,
	Andi Kleen <ak@suse.de>, William Irwin <bill.irwin@oracle.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC BUG?] dereference PAGE_OFFSET address (rc7-mm2)
Date: Wed, 2 May 2007 00:51:40 -0700	[thread overview]
Message-ID: <20070502005140.b94500ff.akpm@linux-foundation.org> (raw)
In-Reply-To: <a8f16e2b0705012026u6078f90dsbe55f854d8638795@mail.gmail.com>

On Wed, 2 May 2007 07:26:13 +0400 "Dan Kruchinin" <dubalom@gmail.com> wrote:

> Hi.
> 
> I don't know why, but when I'm dereferencing PAGE_OFFSET(0xC0000000 on
> x86) address from user space on rc7-mm2 I don't receive SIGSEGV signal
> and there is no any core dump.
> btw: on poor rc-7 all is ok.
> 
> test_code:
> ---
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <unistd.h>
> #include <sys/wait.h>
> #include <sys/time.h>
> #include <sys/resource.h>
> #include <sys/types.h>
> 
> #define PAGE_OFFSET 0xC0000000
> 
> static void _error(const char *msg)
> {
>   int errcode = errno;
> 
>   fprintf(stderr, "ERROR:\n--> %s [%s]\n", msg, strerror(errcode));
>   exit(EXIT_FAILURE);
> }
> 
> int main(void)
> {
>   int pid;
>   struct rlimit rl;
>   int status;
> 
>   printf("Trying to cause ELF core dump...\n");
> 
>   rl.rlim_cur = rl.rlim_max = 0x10000000;
> 
>   if(setrlimit(RLIMIT_CORE, &rl) < 0)
> 	_error("setrlim error!");
>   if((pid = fork()) < 0)
> 	_error("fork error!");
>   else if(pid == 0) {
> 	*((long*) PAGE_OFFSET ) = 0; /* trying to dereference kernel start address */
> 	_exit(EXIT_SUCCESS);
>   }
> 
>   if(waitpid(pid, &status, 0) < 0)
> 	_error("waitpid error!");
>   if(WCOREDUMP(status))
> 	printf("All is ok. We receive SIGSEGV and core dump has occured.\n");
>   else
> 	printf("All is bad. We don't receive SIGSEGV and core dump hasn't
> occured. (WHY?!)\n"); /* here I just get SIGCHLD, this means that
> child process have made it's work success... */
> 
>   exit(EXIT_SUCCESS);
> }
> ---
> 
> [asgard@midgard]$ uname -a
> Linux midgard 2.6.21-rc7-mm2 #5 SMP Wed May 2 04:15:09 MSD 2007 i686 GNU/Linux
> 
> [asgard@midgard]$ ./a.out
> Trying to cause ELF core dump...
> All is bad. We don't receive SIGSEGV and core dump hasn't occured. (WHY?!)
> 
> ---
> 
> [asgard@midgard]$ uname -a
> Linux midgard 2.6.21-rc7 #5 SMP Wed May 2 02:11:50 MSD 2007 i686 GNU/Linux
> 
> [asgard@midgard]$ ./a.out
> Trying to cause ELF core dump...
> All is ok. We receive SIGSEGV and core dump has occured.
> 

Thanks for the report.  I can reproduce it.

Bisection shows that x86_64-mm-paravirt-initial-pagetable.patch caused
this.

I didn't check whether the patch actually permits us to read kernel
memory.  Probably it does.  Probably we'd prefer that it didn't ;)





  reply	other threads:[~2007-05-02  7:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-02  3:26 [RFC BUG?] dereference PAGE_OFFSET address (rc7-mm2) Dan Kruchinin
2007-05-02  7:51 ` Andrew Morton [this message]
2007-05-02  8:46   ` Bill Irwin
2007-05-02 10:06     ` Bill Irwin
2007-05-02 16:28       ` Jeremy Fitzhardinge
2007-05-02 16:32         ` Bill Irwin
2007-05-02 16:51           ` Andi Kleen
2007-05-02 17:16           ` Eric W. Biederman
2007-05-02 17:52             ` Bill Irwin
2007-05-02 19:13               ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070502005140.b94500ff.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@suse.de \
    --cc=bill.irwin@oracle.com \
    --cc=dubalom@gmail.com \
    --cc=jeremy@xensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox