Understanding fault pages by starting execution of shell processes

Source: Internet
Author: User

Loading the shell process through process 2, in detail execve, this article, the last shell program to start executing the linear address is 128MB, due to Free_page_tables, has released the 32nd-bit page directory entry. Therefore, a fault is generated. The program executes the following code:

Do_no_page

void Do_no_page (unsigned long error_code,unsigned long address)//address to 128mb{int nr[4];unsigned long tmp;unsigned Long Page;int block,i;address &= 0xfffff000;tmp = address-current->start_code;//tmp is 0if (!current-> Executable | | TMP >= Current->end_data) {get_empty_page (address); return;} if (Share_page (TMP)) return;if (!) ( page = Get_free_page ()))//Gets a page of memory oom ();/* Remember that 1 block is used for header */block = 1 + tmp/block_size;///bin/sh The 1th node is the file header, which starts executing the code on the second node for (i=0; i<4; block++,i++) Nr[i] = Bmap (current->executable,block);//The code that gets executed is the block number bread _page (PAGE,CURRENT->EXECUTABLE->I_DEV,NR);//The executable code is placed on the page to which pages are pointing ... if (Put_page (page,address)) return; Free_page (page); Oom ();
Put_page we've already talked about that in the 32nd-bit page The catalog entry points to a page table, where the first item in the page table points to the page where the executable code resides. Due to the exception, the program returns a program that performs a linear address (CS:EIP) of 128MB (the address that just generated the page fault) and, after paging, maps to the final physical address to begin executing its own program.

Understanding a missing pages exception by starting execution of the shell process

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.