Replacing sys_execve with the redhat9 kernel module causes system memory depletion.
Source: Internet
Author: User
Replacing sys_execve with the redhat9 kernel module causes system memory depletion-Linux general technology-Linux programming and kernel information. For details, see the following. Write a kernel module on redhat9, replace sys_execve call, load and run the system (/usr/bin/who) command cyclically on four terminals, about 7 hours later, the system will run out of memory and the message "out ofmemory: killed httpd" will be reported.
The following is my code, which seems to be very simple. Why is this?
# Define _ KERNEL __
# Define MODULE
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
// # Include
// # Include
# Include
# Include
# Include
# Include
Void ** sys_calls_table;
# Ifndef HIDDEN_SCT
Extern void * sys_call_table [];
# Endif
# If defined (HIDDEN_SCT)
# Ifdef NO_SYS_CLOSE
Unsigned long sys_close _ = SYS_CLOSE_ADDR;
# Else
Unsigned int sys_close _ = (unsigned long) sys_close;
# Endif
Void ** get_sys_call_table_addr (void)
{
Unsigned long ptr;
Extern int loops_per_jiffy;
Unsigned long * p;
For (ptr = (unsigned long) & loops_per_jiffy; ptr <(unsigned long) & boot_cpu_data; ptr ++ = sizeof (void *))
{
P = (unsigned long *) ptr;
If (p [6] = sys_close _)
{
Return (void **) p;
}
}
Return NULL;
}
# Endif
Static asmlinkage int (* old_sys_execve) (struct pt_regs regs );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service