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