What is between the stack and the kernel?
Hi,
What is between the stack and the kernel? We all already know the kernel space starts at 0xC000_0000. We also already know the stack space starts at 0xBFFF_FFFC and grows upwards. According to Self-Service Linux: Determining Problems and Finding Solutions (Mark Wilding, Prentice Hall), Code:
08048000-08049000 r-xp 00000000 03:08 293559 /u/dbehman/book/working/foo The book says so too. That's OK. It means the stack space starts at 0xBFFF_FFFC. But in my linux server, the outputs is a little different. Code:
0042c000-00447000 r-xp 00000000 fd:00 16679845 /lib/ld-2.5.so Code:
08048000-08049000 r-xp 00000000 03:01 3377 /root/work/stack_space It starts at 0xbfe2d000 in my linux server. And it starts at 0xbfb5a000 in my linux laptop PC. What is between bfe2d000-c0000000 in my linux server? and between bfb5a000-c0000000 in my linux laptop PC? Each of them are 1912832 Byte and 4874240 Byte. 1912832 Byte = 1868 KB 4874240 Byte = 4760 KB I don't think they are small amounts of spaces. Thank you. |
The actual memory allocation these days is a good bit more flexible than that, and in any case you seem to be taking about the x86 family of microprocessors. We can in fact be more general than that.
"The Linux kernel" is an always-resident piece of software, what IBM called a "System Control Program (SCP)," which in many ways is actually a better term. It's the programming, always present in memory, which dictates the moment-by-moment operation of the system, including the handling of interrupts and the organized dispatching of user-level work among one or more CPUs or cores. "The (Kernel) Stack" is a protected area of memory, available only to kernel code, which is used for subroutine-calls and other purposes, just like a stack is used in any user-land program. The difference is that it's only available to the kernel, therefore it is trustworthy for the kernel's needs. |
Apologies for an uneducated question here but does ASLR come into it? I was under the impression this would change the address of things like the Kernel stack (ideally at least)?
|
As far as I am aware, ASLR does nothing to the layout of memory in kernel space, since user applications can't get there to begin with.
In user-space, the idea is just a fancy-pants way of describing the notion of adding a few random padding-bytes here and there, and I actually don't think that it does much good since the pointers are still there. |
All times are GMT -5. The time now is 05:10 AM. |