Function report |
Source Code:mm\mprotect.c |
Create Date:2022-07-28 14:52:24 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:pkey==-1 when doing a legacy mprotect()
Proto:static int do_mprotect_pkey(unsigned long start, size_t len, unsigned long prot, int pkey)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| unsigned long | start | |
| size_t | len | |
| unsigned long | prot | |
| int | pkey |
| 492 | grows = prot & (mprotect flag: extend change to start of growsdown vma | mprotect flag: extend change to end of growsup vma ) |
| 493 | rier = personality & READ_IMPLIES_EXEC && prot & page can be read |
| 498 | prot &= ~(mprotect flag: extend change to start of growsdown vma | mprotect flag: extend change to end of growsup vma ) |
| 499 | If grows == (mprotect flag: extend change to start of growsdown vma | mprotect flag: extend change to end of growsup vma ) Then Return -EINVAL |
| 504 | If Not len Then Return 0 |
| 510 | If Not This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have* already been masked out.* Returns true if the prot flags are valid Then Return -EINVAL |
| 515 | If lock for writing Then Return -EINTR |
| 523 | If pkey != -1 && Not mm_pkey_is_allocated(mm, pkey) Then Go to out |
| 532 | If Our start address within vm_mm. >= end Then Go to out |
| 536 | If Not (Flags, see mm.h. & general info on the segment ) Then Go to out |
| 538 | Else |
| 539 | If Our start address within vm_mm. > start Then Go to out |
| 544 | If Not (Flags, see mm.h. & VM_GROWSUP) Then Go to out |
| 548 | If start > Our start address within vm_mm. Then prev = vma |
| 551 | cycle |
| 559 | If rier && Flags, see mm.h. & VM_MAYEXEC Then prot |= page can be executed |
| 570 | new_vma_pkey = arch_override_mprotect_pkey(vma, prot, pkey) |
| 572 | newflags |= Flags, see mm.h. & ~mask_off_old_flags |
| 575 | If newflags & ~(newflags >> 4) & ( currently active flags | VM_WRITE | VM_EXEC) Then |
| 580 | error = security_file_mprotect(vma, reqprot, prot) |
| 592 | If nstart < The first byte after our end addresswithin vm_mm. Then nstart = The first byte after our end addresswithin vm_mm. |
| 598 | If Not vma || Our start address within vm_mm. != nstart Then |
| 604 | out : |
| 606 | Return error |
| Name | Describe |
|---|---|
| SYSCALL_DEFINE3 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |