Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux 5.13.13
- Loading branch information
Showing
129 changed files
with
1,190 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include <asm/kup.h> | ||
|
||
void __init setup_kuap(bool disabled) | ||
{ | ||
pr_info("Activating Kernel Userspace Access Protection\n"); | ||
|
||
if (disabled) | ||
pr_warn("KUAP cannot be disabled yet on 6xx when compiled in\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,11 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include <asm/kup.h> | ||
#include <asm/reg.h> | ||
#include <asm/task_size_32.h> | ||
#include <asm/mmu.h> | ||
|
||
#define KUEP_UPDATE_TWO_USER_SEGMENTS(n) do { \ | ||
if (TASK_SIZE > ((n) << 28)) \ | ||
mtsr(val1, (n) << 28); \ | ||
if (TASK_SIZE > (((n) + 1) << 28)) \ | ||
mtsr(val2, ((n) + 1) << 28); \ | ||
val1 = (val1 + 0x222) & 0xf0ffffff; \ | ||
val2 = (val2 + 0x222) & 0xf0ffffff; \ | ||
} while (0) | ||
|
||
static __always_inline void kuep_update(u32 val) | ||
void __init setup_kuep(bool disabled) | ||
{ | ||
int val1 = val; | ||
int val2 = (val + 0x111) & 0xf0ffffff; | ||
|
||
KUEP_UPDATE_TWO_USER_SEGMENTS(0); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(2); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(4); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(6); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(8); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(10); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(12); | ||
KUEP_UPDATE_TWO_USER_SEGMENTS(14); | ||
} | ||
pr_info("Activating Kernel Userspace Execution Prevention\n"); | ||
|
||
void kuep_lock(void) | ||
{ | ||
kuep_update(mfsr(0) | SR_NX); | ||
} | ||
|
||
void kuep_unlock(void) | ||
{ | ||
kuep_update(mfsr(0) & ~SR_NX); | ||
if (disabled) | ||
pr_warn("KUEP cannot be disabled yet on 6xx when compiled in\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.