From: Eric Dumazet <dada1@cosmosbay.com>
To: Andi Kleen <ak@muc.de>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [BUG?] x86_64 : Can not read /dev/kmem ?
Date: Mon, 14 Mar 2005 11:37:19 +0100 [thread overview]
Message-ID: <4235695F.5070203@cosmosbay.com> (raw)
In-Reply-To: <m14qfey3iz.fsf@muc.de>
Hi Andi
I tried to read /dev/kmem on x86_64 (linux-2.6.11) and got no success.
read() or pread() returns EINVAL
I tried mmap() too : mmap() calls succeed, but as soon the user process
dereference memory, we get :
tinfo: Corrupted page table at address 2aaaaaabf800
PGD 8a983067 PUD c7e5a067 PMD 91588067 PTE ffffffff8048a025
Bad pagetable: 000d [1] SMP
CPU 0
Modules linked in: ipt_REJECT
Pid: 10892, comm: tinfo Not tainted 2.6.11
RIP: 0033:[<0000000000100562>] [<0000000000100562>]
RSP: 002b:00007ffffffff790 EFLAGS: 00010217
RAX: 00002aaaaaabf000 RBX: 00002aaaaabbe000 RCX: 00002aaaaac8fc0c
RDX: 0000000000000001 RSI: 0000000000001000 RDI: 0000000000000000
RBP: 00007ffffffff7f8 R08: 0000000000000003 R09: ffffffff8048a000
R10: 0000000000000001 R11: 0000000000000206 R12: 00000000001005b0
R13: 0000000000000001 R14: 00002aaaaadfdfe8 R15: 0000000000100530
FS: 00002aaaaabcb970(0000) GS:ffffffff804866c0(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00002aaaaaabf800 CR3: 0000000090368000 CR4: 00000000000006e0
Process tinfo (pid: 10892, threadinfo ffff8100901b0000, task
ffff8100c7d976c0)
RIP [<0000000000100562>] RSP <00007ffffffff790>
Thank you
Eric Dumazet
----------------------------------------------------------------
# cat tinfo.c
#define _XOPEN_SOURCE 500
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
struct tcp_hashinfo {
struct tcp_ehash_bucket *__tcp_ehash;
struct tcp_bind_hashbucket *__tcp_bhash;
int __tcp_bhash_size;
int __tcp_ehash_size;
} tcp_hashinfo;
#define TCPINFO_ADDR 0xffffffff8048a000 /* tcp_hashinfo */
int main()
{
int fd = open("/dev/kmem", O_RDONLY) ;
if (pread(fd, &tcp_hashinfo, sizeof(tcp_hashinfo), TCPINFO_ADDR) == -1) {
lseek(fd, TCPINFO_ADDR, 0) ;
if (read(fd, &tcp_hashinfo, sizeof(tcp_hashinfo)) == -1) {
perror("Can not read /dev/kmem ?") ;
return 1 ;
}
}
printf("ehash=%p esize=%d bhash=%p bsize=%d\n",
tcp_hashinfo.__tcp_ehash,
tcp_hashinfo.__tcp_ehash_size,
tcp_hashinfo.__tcp_bhash,
tcp_hashinfo.__tcp_bhash_size) ;
return 0 ;
}
next prev parent reply other threads:[~2005-03-14 10:37 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-13 18:20 [patch] x86: fix ESP corruption CPU bug Stas Sergeev
2005-03-13 18:52 ` Grzegorz Kulewski
2005-03-13 19:11 ` Stas Sergeev
2005-03-13 19:37 ` Ondrej Zary
2005-03-13 19:46 ` Stas Sergeev
2005-03-13 20:02 ` Pavel Machek
2005-03-13 20:10 ` Pavel Machek
2005-03-13 20:55 ` Stas Sergeev
2005-03-13 21:13 ` Linus Torvalds
2005-03-13 22:06 ` [patch] x86: fix ESP corruption CPU bug (take 2) Stas Sergeev
2005-03-14 19:29 ` Alan Cox
2005-03-14 19:59 ` Stas Sergeev
2005-03-15 3:34 ` Andrew Morton
2005-03-15 10:48 ` x86: spin_unlock(), spin_unlock_irq() & others are out of line ? Eric Dumazet
2005-03-15 19:44 ` Lee Revell
2005-03-15 19:48 ` [patch] x86: fix ESP corruption CPU bug (take 2) Stas Sergeev
2005-03-13 23:17 ` [patch] x86: fix ESP corruption CPU bug Pavel Machek
2005-03-13 23:54 ` Linus Torvalds
2005-03-14 0:16 ` Linus Torvalds
2005-03-14 4:52 ` Stas Sergeev
2005-03-14 9:34 ` Andi Kleen
2005-03-14 10:37 ` Eric Dumazet [this message]
2005-03-21 19:37 ` [BUG?] x86_64 : Can not read /dev/kmem ? Andi Kleen
2005-03-22 15:24 ` Andi Kleen
2005-03-14 15:21 ` [patch] x86: fix ESP corruption CPU bug Jakob Eriksson
2005-03-14 17:03 ` linux-os
2005-03-14 17:10 ` Pavel Machek
2005-03-14 19:24 ` Brian Gerst
2005-03-14 20:21 ` Stas Sergeev
2005-03-14 18:02 ` Stas Sergeev
2005-03-14 17:29 ` Stas Sergeev
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=4235695F.5070203@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=ak@muc.de \
--cc=linux-kernel@vger.kernel.org \
/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