public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tao Ma <tao.ma@oracle.com>
To: Amerigo Wang <xiyou.wangcong@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [Patch BUGFIX] kcore: fix its wrong size on x86_64
Date: Mon, 15 Jun 2009 13:59:08 +0800	[thread overview]
Message-ID: <4A35E32C.30609@oracle.com> (raw)
In-Reply-To: <20090615021457.GA3388@cr0.nay.redhat.com>

Hi Amerigo,
	Just patched my kernel and tested.
	The bad news is that although the number is changed, but it isn't right 
either.

Here is the output.
[root@test3 ~]# ls -l /proc/kcore
-r-------- 1 root root 131941393240064 Jun 15 13:39 /proc/kcore

But your patch does change something. I just try your commands in 
another box which show the right value after reboot. And the result is:

[root@test8 ~]# ls -l /proc/kcore
-r-------- 1 root root 5301604352 Jun 15 13:35 /proc/kcore
[root@test8 ~]# readelf -l /proc/kcore

Elf file type is CORE (Core file)
Entry point 0x0
There are 6 program headers, starting at offset 64

Program Headers:
   Type           Offset             VirtAddr           PhysAddr
                  FileSiz            MemSiz              Flags  Align
   NOTE           0x0000000000000190 0x0000000000000000 0x0000000000000000
                  0x00000000000008bc 0x0000000000000000         0
   LOAD           0x000077ffff601000 0xffffffffff600000 0x0000000000000000
                  0x0000000000800000 0x0000000000800000  RWE    1000
   LOAD           0x000077ffa0001000 0xffffffffa0000000 0x0000000000000000
                  0x000000005f000000 0x000000005f000000  RWE    1000
   LOAD           0x000077ff8200a000 0xffffffff82009000 0x0000000000000000
                  0x00000000006ceb50 0x00000000006ceb50  RWE    1000
   LOAD           0x00003a0000001000 0xffffc20000000000 0x0000000000000000
                  0x00001fffffffffff 0x00001fffffffffff  RWE    1000
   LOAD           0x0000000000001000 0xffff880000000000 0x0000000000000000
                  0x000000013c000000 0x000000013c000000  RWE    1000
[root@test8 ~]# ls -l /proc/kcore
-r-------- 1 root root 131941393240064 Jun 15 13:35 /proc/kcore

So you see, the second "ls -l" will show the wrong value.

Regards,
Tao

Amerigo Wang wrote:
> On Fri, Jun 12, 2009 at 09:20:50PM -0700, Eric W. Biederman wrote:
>> Amerigo Wang <xiyou.wangcong@gmail.com> writes:
>>
>>> Fix wrong /proc/kcore size on x86_64.
>> How does that change anything?
> 
> Please check the description below.
> 
>>> x86_64 uses __va() macro to caculate the virtual address passed to kclist_add()
>>> but decodes it with its own macro kc_vadd_to_offset(). This is wrong.
>>>
>>> Also, according to Documentation/x86/x86_64/mm.txt, kc_vaddr_to_offset()
>>> is wrong too.
>>>
>>> So just remove them, use the generic macro.
>>>
>>> BTW, the man page for /proc/kcore is wrong, its size can be more than
>>> the physical memory size, because it also contains memory area of
>>> vmalloc(), vsyscall etc...
>> The set of offsets that are usable sure.
> 
> We have generic kc_vaddr_to_offset() etc. in fs/proc/kcore.c.
> 
> 
>> However the size from stat is:
>>          proc_root_kcore->size = (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
>>
>> Which can not be different than the physical memory size.
> 
> I never say this is not different, of course they are same, but what Tao
> reported is the wrong size after a read operation, please try the following:
> 
> #ls -l /proc/kcore
> #readelf -l /proc/kcore
> #ls -l /proc/kcore
> 
> You will find the *second* 'ls -l /proc/kcore' reports a size much more
> than the physical mem size.
> 
> And you will notice the difference of it after this patch applied.
> 
> 

  reply	other threads:[~2009-06-15  5:59 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05  4:03 /proc/kcore has a unreasonable size(281474974617600) in x86_64 2.6.30-rc8 Tao Ma
2009-06-05  5:38 ` Andrew Morton
2009-06-05  6:59   ` Tao Ma
2009-06-05  7:56     ` Amerigo Wang
2009-06-05  8:57       ` Tao Ma
2009-06-05  9:09         ` Américo Wang
2009-06-05  9:14           ` Andrew Morton
2009-06-05  9:30             ` Tao Ma
2009-06-05  9:51               ` Amerigo Wang
2009-06-05 14:26                 ` Tao Ma
2009-06-05 17:50                   ` Yinghai Lu
2009-06-06 14:37                     ` Tao Ma
2009-06-06 22:21                       ` Yinghai Lu
2009-06-08  1:52                         ` Amerigo Wang
2009-06-08  6:02                           ` Tao Ma
2009-06-08  6:41                             ` Américo Wang
2009-06-08  8:00                               ` Tao Ma
2009-06-09  0:43                                 ` Américo Wang
2009-06-09  4:10                                   ` Eric W. Biederman
2009-06-11  5:09                                     ` Amerigo Wang
2009-06-11 14:12                                       ` Eric W. Biederman
2009-06-12  7:54                                         ` Tao Ma
2009-06-13  4:09                                         ` [Patch BUGFIX] kcore: fix its wrong size on x86_64 Amerigo Wang
2009-06-13  4:20                                           ` Eric W. Biederman
2009-06-15  2:14                                             ` Amerigo Wang
2009-06-15  5:59                                               ` Tao Ma [this message]
2009-06-15  7:00                                                 ` Amerigo Wang
2009-06-15  8:34                                                   ` Tao Ma
2009-06-15  9:00                                                     ` Amerigo Wang
2009-06-15 10:10                                                     ` Eric W. Biederman
2009-06-15 22:10                                                       ` TaoMa
2009-06-15 19:48                                                         ` Eric W. Biederman
2009-06-15 17:01                                                           ` Tao Ma
2009-06-15 10:08                                           ` Eric W. Biederman
2009-06-16 15:29                                             ` Américo Wang
2009-06-16 19:27                                               ` Eric W. Biederman
2009-06-18  3:00                                                 ` Amerigo Wang
2009-06-18  3:37                                                   ` Eric W. Biederman
2009-06-18  4:40                                                     ` Amerigo Wang
2009-06-18  5:41                                                       ` Eric W. Biederman
2009-06-22  8:54                                                         ` [Patch] kcore: remove its pointless size Amerigo Wang
2009-06-30 10:08                                                           ` [RESEND Patch] " Amerigo Wang
2009-07-01 21:47                                                             ` Andrew Morton
2009-07-01 23:25                                                               ` Eric W. Biederman
2009-07-02  0:12                                                                 ` Andrew Morton
2009-07-02  0:41                                                                   ` KAMEZAWA Hiroyuki
2009-07-17 22:29                                                                     ` Andrew Morton
2009-07-21  2:09                                                                       ` KAMEZAWA Hiroyuki
2009-07-21  8:46                                                                         ` KAMEZAWA Hiroyuki
2009-07-21  9:36                                                                       ` [RFC][PATCH 0/3] kcore: clean up and update ram information properly KAMEZAWA Hiroyuki
2009-07-21  9:38                                                                         ` [RFC][PATCH 1/3] kcore: use usual list ops in kclist KAMEZAWA Hiroyuki
2009-07-21  9:39                                                                         ` [RFC][PATCH 2/3] kcore: add kclist type information KAMEZAWA Hiroyuki
2009-07-21  9:41                                                                         ` [RFC][PATCH 3/3] kcore: rebuild RAM information based on io resource information KAMEZAWA Hiroyuki
2009-07-21 11:29                                                                         ` [RFC][PATCH 0/3] kcore: clean up and update ram information properly Andi Kleen
2009-07-22  0:27                                                                           ` KAMEZAWA Hiroyuki
2009-07-02  9:28                                                               ` [RESEND Patch] kcore: remove its pointless size Amerigo Wang
2009-06-05  5:49 ` /proc/kcore has a unreasonable size(281474974617600) in x86_64 2.6.30-rc8 Amerigo Wang
2009-06-05  6:07   ` Tao Ma
2009-06-05  6:43     ` Amerigo Wang
2009-06-05  6:56       ` Tao Ma
2009-06-05  8:00         ` Amerigo Wang
2009-06-05  9:01           ` Tao Ma
2009-06-05  9:20             ` Amerigo Wang

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=4A35E32C.30609@oracle.com \
    --to=tao.ma@oracle.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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