All of lore.kernel.org
 help / color / mirror / Atom feed
* /proc/kcore reads 0's for vmap_block
@ 2022-10-26 23:15 Stephen Brennan
  2022-10-27  8:54 ` Baoquan He
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Brennan @ 2022-10-26 23:15 UTC (permalink / raw)
  To: Andrew Morton, linux-mm

Hi all,

The /proc/kcore interface uses vread() to read memory addresses which
are in the vmalloc region, and it seems that vread() doesn't support
vmap_areas which are associated with a vmap_block. As far as I can tell,
those have vmap_area.vm == NULL, and get skipped during vread()'s
iteration. So the end result is that the read simply returns 0's.

This impacts live debuggers like gdb and drgn, which is how I stumbled
upon it[1]. It looks like crash avoids the issue by doing a page table
walk and reading the physical address.

I'm wondering if there's any rationale for this omission from vread():
is it a simple oversight, or was it omitted due to the difficulty? Is
it possible for /proc/kcore to simply take the page faults when it reads
unmapped memory and handle them? (I'm sure that's already discussed or
is obviously infeasible for some reason beyond me.)

Ideally, I'm just looking for a way forward that allows the debugger to
*work* as expected, meaning either that /proc/kcore always reads the
correct data, or that the debugger can know ahead of time that it will
need to do some processing (like a page table walk) first. 

Thanks,
Stephen

[1]: https://github.com/osandov/drgn/issues/217


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-31  7:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 23:15 /proc/kcore reads 0's for vmap_block Stephen Brennan
2022-10-27  8:54 ` Baoquan He
2022-10-27 18:07   ` Stephen Brennan
2022-10-28  7:52   ` Uladzislau Rezki
2022-10-31  7:12     ` Baoquan He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.