Giter Site home page Giter Site logo

Can't access user address about drgn HOT 5 OPEN

hao-lee avatar hao-lee commented on August 22, 2024
Can't access user address

from drgn.

Comments (5)

osandov avatar osandov commented on August 22, 2024

access_process_vm can only read pages that are actually resident in memory. The reads that fail are likely for pages that have either been swapped out or haven't even been populated yet.

If you want to read the memory of a process on a live system, try reading from /proc/$pid/mem. I believe that will fault in pages as needed.

from drgn.

hao-lee avatar hao-lee commented on August 22, 2024

@osandov

access_process_vm can only read pages that are actually resident in memory. The reads that fail are likely for pages that have either been swapped out or haven't even been populated yet.

If you want to read the memory of a process on a live system, try reading from /proc/$pid/mem. I believe that will fault in pages as needed.

Thanks for reply. But my system doesn't have swap and the kernel source says Rss: is the size of resident memory.

fs/proc/task_mmu.c:819:         SEQ_PUT_DEC("Rss:            ", mss->resident);

I think 1942012 kB are all resident pages. I also use /proc/pid/pagemap to verify the count of present pages in this vma range. It seems drgn indeed can't access many memory addresses even the page is present and can be access by crash command.

from drgn.

osandov avatar osandov commented on August 22, 2024

Huh, that does sound like a bug. I wasn't able to reproduce this on x86-64. What architecture and kernel version are you running?

from drgn.

hao-lee avatar hao-lee commented on August 22, 2024

Huh, that does sound like a bug. I wasn't able to reproduce this on x86-64. What architecture and kernel version are you running?

kernel version: 4.18.0-193.6.3.el8_2
arch: x86_64
CPU: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz

I've tested multiple machines, and they all seem to have this issue, particularly when the process involves heavy memory usage. For example, I'm using drgn to scan a process with an Rss of 90G, but it can only access a small fraction of the memory pages. How can I assist in analyzing this problem?

from drgn.

osandov avatar osandov commented on August 22, 2024

Could you please run this script on one of these processes and share the output: https://gist.github.com/osandov/12d524c7c5cebfda2593b29e0b564234

Pass it the PID and optionally which address range to check (or leave off the addresses to check the entire process address space). So for your initial report, it'd look like:

sudo drgn ./test_access_remote_vm.py 2023533 0x700000000 0x8003b7000

from drgn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.