Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ec5c1150
Commit
ec5c1150
authored
Oct 09, 2021
by
Helge Deller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parisc: Add KFENCE support
Signed-off-by:
Helge Deller
<
deller@gmx.de
>
parent
aeb1e833
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
arch/parisc/Kconfig
arch/parisc/Kconfig
+3
-2
arch/parisc/include/asm/kfence.h
arch/parisc/include/asm/kfence.h
+44
-0
arch/parisc/kernel/traps.c
arch/parisc/kernel/traps.c
+5
-0
No files found.
arch/parisc/Kconfig
View file @
ec5c1150
...
...
@@ -48,6 +48,7 @@ config PARISC
select HAVE_ARCH_HASH
select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_JUMP_LABEL_RELATIVE
select HAVE_ARCH_KFENCE
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_REGS_AND_STACK_ACCESS_API
...
...
@@ -254,11 +255,11 @@ config PARISC_PAGE_SIZE_4KB
config PARISC_PAGE_SIZE_16KB
bool "16KB"
depends on PA8X00 && BROKEN
depends on PA8X00 && BROKEN
&& !KFENCE
config PARISC_PAGE_SIZE_64KB
bool "64KB"
depends on PA8X00 && BROKEN
depends on PA8X00 && BROKEN
&& !KFENCE
endchoice
...
...
arch/parisc/include/asm/kfence.h
0 → 100644
View file @
ec5c1150
/* SPDX-License-Identifier: GPL-2.0 */
/*
* PA-RISC KFENCE support.
*
* Copyright (C) 2021, Helge Deller <deller@gmx.de>
*/
#ifndef _ASM_PARISC_KFENCE_H
#define _ASM_PARISC_KFENCE_H
#include <linux/kfence.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
static
inline
bool
arch_kfence_init_pool
(
void
)
{
return
true
;
}
/* Protect the given page and flush TLB. */
static
inline
bool
kfence_protect_page
(
unsigned
long
addr
,
bool
protect
)
{
pte_t
*
pte
=
virt_to_kpte
(
addr
);
if
(
WARN_ON
(
!
pte
))
return
false
;
/*
* We need to avoid IPIs, as we may get KFENCE allocations or faults
* with interrupts disabled.
*/
if
(
protect
)
set_pte
(
pte
,
__pte
(
pte_val
(
*
pte
)
&
~
_PAGE_PRESENT
));
else
set_pte
(
pte
,
__pte
(
pte_val
(
*
pte
)
|
_PAGE_PRESENT
));
flush_tlb_kernel_range
(
addr
,
addr
+
PAGE_SIZE
);
return
true
;
}
#endif
/* _ASM_PARISC_KFENCE_H */
arch/parisc/kernel/traps.c
View file @
ec5c1150
...
...
@@ -30,6 +30,7 @@
#include <linux/ratelimit.h>
#include <linux/uaccess.h>
#include <linux/kdebug.h>
#include <linux/kfence.h>
#include <asm/assembly.h>
#include <asm/io.h>
...
...
@@ -787,6 +788,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
/* Clean up and return if in exception table. */
if
(
fixup_exception
(
regs
))
return
;
/* Clean up and return if handled by kfence. */
if
(
kfence_handle_page_fault
(
fault_address
,
parisc_acctyp
(
code
,
regs
->
iir
)
==
VM_WRITE
,
regs
))
return
;
pdc_chassis_send_status
(
PDC_CHASSIS_DIRECT_PANIC
);
parisc_terminate
(
"Kernel Fault"
,
regs
,
code
,
fault_address
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment