Propantriol
Propantriol

Reputation: 161

Determine address size of process within Linux kernel (x86_64)

I have to work with the address size of 32-bit and 64-bit processes inside the Linux kernel on x86_64. The possibility to treat with this that I'm currently using is checking task-specific flags. But I was wondering if there is an easier way to determine the address size of a process.

So, what's the proper and easiest way to retrieve the address size of a process within the Linux kernel?

Upvotes: 2

Views: 338

Answers (1)

abligh
abligh

Reputation: 25119

Open /proc/self/maps and parse for the [vsyscall] entry. A 64 bit process will have a 64 bit address, e.g.:

ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

A 32 bit process won't. I don't have a 32 bit process on hand to provide an example, but it won't have a 64 bit address.

Upvotes: 1

Related Questions