mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
signal/x86: Pass pkey not vma into __bad_area
There is only one caller of __bad_area that passes in PKUERR and thus will generate a siginfo with si_pkey set. Therefore simplify the logic and hoist reading of vma_pkey up into that caller, and just pass *pkey into __bad_area. Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
988bbc7b1a
commit
aba1ecd32c
1 changed files with 8 additions and 12 deletions
|
@ -904,22 +904,16 @@ bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__bad_area(struct pt_regs *regs, unsigned long error_code,
|
__bad_area(struct pt_regs *regs, unsigned long error_code,
|
||||||
unsigned long address, struct vm_area_struct *vma, int si_code)
|
unsigned long address, u32 *pkey, int si_code)
|
||||||
{
|
{
|
||||||
struct mm_struct *mm = current->mm;
|
struct mm_struct *mm = current->mm;
|
||||||
u32 pkey;
|
|
||||||
|
|
||||||
if (vma)
|
|
||||||
pkey = vma_pkey(vma);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Something tried to access memory that isn't in our memory map..
|
* Something tried to access memory that isn't in our memory map..
|
||||||
* Fix it, but check if it's kernel or user first..
|
* Fix it, but check if it's kernel or user first..
|
||||||
*/
|
*/
|
||||||
up_read(&mm->mmap_sem);
|
up_read(&mm->mmap_sem);
|
||||||
|
|
||||||
__bad_area_nosemaphore(regs, error_code, address,
|
__bad_area_nosemaphore(regs, error_code, address, pkey, si_code);
|
||||||
(vma) ? &pkey : NULL, si_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static noinline void
|
static noinline void
|
||||||
|
@ -954,10 +948,12 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
|
||||||
* But, doing it this way allows compiler optimizations
|
* But, doing it this way allows compiler optimizations
|
||||||
* if pkeys are compiled out.
|
* if pkeys are compiled out.
|
||||||
*/
|
*/
|
||||||
if (bad_area_access_from_pkeys(error_code, vma))
|
if (bad_area_access_from_pkeys(error_code, vma)) {
|
||||||
__bad_area(regs, error_code, address, vma, SEGV_PKUERR);
|
u32 pkey = vma_pkey(vma);
|
||||||
else
|
__bad_area(regs, error_code, address, &pkey, SEGV_PKUERR);
|
||||||
__bad_area(regs, error_code, address, vma, SEGV_ACCERR);
|
} else {
|
||||||
|
__bad_area(regs, error_code, address, NULL, SEGV_ACCERR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue