In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to make the Linux process run in a fixed heap". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to make the Linux process run on a fixed heap.
We know that the address of the program is different every time it runs, and the reason why linux has such a design may be for security reasons, which is not conducive to hackers' attacks.
Let's look at a simple program:
# include
# include
Int main (int argc, char* argv [])
{
Int first = 0
Int * p = malloc (1024)
Printf ("paired% p\ n", p)
Return 0
}
Obviously, the address of the program is different every time!
Is there any way to make the same program run at the same address every time?
When you see here, you may ask why you let the program run at the same address every time. Does this not go against the original intention of OS design? Yes, this does go against the original intention of the linux kernel design. However, it is inevitable that strange requirements will not be encountered in the actual project. For example, some app needs to be run on the specified address due to historical reasons, so you need to turn off the randomization of the address space. For example, if you encounter a random address crash problem, you can also use this method to debug.
To cut the crap, let's take a look at the way address space is randomized and turned off.
Echo 0 > / proc/sys/kernel/randomize_va_space
Or
Sudo sysctl-w kernel.randomize_va_space=0
After turning it off, let's take a look at the test results of the program:
At this point, I believe you have a deeper understanding of "how to make the Linux process run on the fixed heap". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.