sanitizer caused the trap,
via the encoded data in the trap instruction. Clang on x86
currently encodes the same data in ud1 instructions but the x86
handle_bug() and is_valid_bugaddr() functions currently only look
at ud2s.
Signed-off-by: Gatlin Newhouse
---
MAINTAINERS | 2 ++
On Wed, May 29, 2024 at 09:25:21AM UTC, Marco Elver wrote:
> On Wed, 29 May 2024 at 04:20, Gatlin Newhouse
> wrote:
> [...]
> > if (regs->flags & X86_EFLAGS_IF)
> > raw_local_irq_enable();
> > - if (report_bug(reg
On Wed, May 29, 2024 at 08:30:20PM UTC, Marco Elver wrote:
> On Wed, 29 May 2024 at 20:17, Gatlin Newhouse
> wrote:
> >
> > On Wed, May 29, 2024 at 09:25:21AM UTC, Marco Elver wrote:
> > > On Wed, 29 May 2024 at 04:20, Gatlin Newhouse
> > > wrote:
> &g
On Thu, May 30, 2024 at 01:24:56AM UTC, Andrew Cooper wrote:
> On 29/05/2024 3:20 am, Gatlin Newhouse wrote:
> > diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
> > index a3ec87d198ac..e3fbed9073f8 100644
> > --- a/arch/x86/include/asm/bug.h
> >
sanitizer caused the trap,
via the encoded data in the trap instruction. Clang on x86
currently encodes the same data in ud1 instructions but the x86
handle_bug() and is_valid_bugaddr() functions currently only look
at ud2s.
Signed-off-by: Gatlin Newhouse
---
Changes in v2:
- Name the new
On Mon, Jun 03, 2024 at 06:13:53PM UTC, Thomas Gleixner wrote:
> On Sat, Jun 01 2024 at 03:10, Gatlin Newhouse wrote:
>
> > Bring x86 to parity with arm64, similar to commit 25b84002afb9
> > ("arm64: Support Clang UBSAN trap codes for better reporting").
> &g
with arm64, similar to commit 25b84002afb9
("arm64: Support Clang UBSAN trap codes for better reporting").
Enable the output of UBSAN type information on x86 architectures
compiled with clang when CONFIG_UBSAN_TRAP=y.
Signed-off-by: Gatlin Newhouse
---
Changes in v3:
- Address Thomas
arm64, similar to commit 25b84002afb9
("arm64: Support Clang UBSAN trap codes for better reporting").
Enable the reporting of UBSAN sanitizer detail on x86 architectures
compiled with clang when CONFIG_UBSAN_TRAP=y.
Signed-off-by: Gatlin Newhouse
---
Changes in v4:
- Impleme
ned-off-by: Gatlin Newhouse
---
Changes in v5:
- Added references to the LLVM commits in the commit message from
Kees and Marco's feedback
- Renamed incorrect defines, and removed handle_ubsan_failure()'s
duplicated work per Peter's feedback
Changes in v4:
- Implemen
] https://www.usenix.org/conference/usenixsecurity24/presentation/duta
[2] https://github.com/vusec/safefetch
[3] https://github.com/vusec/safefetch-ae
[4] https://github.com/gatlinnewhouse/linux
Gatlin Newhouse (17):
Add SafeFetch double-fetch protection to the kernel
x86: syscall: support caching
---
init/main.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/init/main.c b/init/main.c
index 225a58279acd..72e55704ce2f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -958,6 +958,10 @@ void start_kernel(void)
trap_init();
mm_core_init();
poking_init();
+#ifdef
---
kernel/fork.c | 17 +
1 file changed, 17 insertions(+)
diff --git a/kernel/fork.c b/kernel/fork.c
index 1ee8eb11f38b..379dcf5626e9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -122,6 +122,12 @@
#include
+#ifdef CONFIG_SAFEFETCH
+#include
+#include
+#include
+#end
---
lib/iov_iter.c | 12
1 file changed, 12 insertions(+)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index f9193f952f49..8997272481c3 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -41,6 +41,10 @@ size_t copy_to_user_iter_nofault(void __user *iter_to,
size_t progress,
---
kernel/exit.c | 16
1 file changed, 16 insertions(+)
diff --git a/kernel/exit.c b/kernel/exit.c
index bb184a67ac73..c712cd11a2c7 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -951,6 +951,22 @@ void __noreturn do_exit(long code)
exit_mm();
+#ifdef CONFIG_SAFEFE
---
lib/bug.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/lib/bug.c b/lib/bug.c
index b1f07459c2ee..d1007c1b3dda 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -155,6 +155,9 @@ static enum bug_trap_type __report_bug(unsigned long
bugaddr, struct pt_regs *re
struct bug_entry
Adds non-caching call to fault_in_readable() for configurations with
SafeFetch enabled and disabled readable pages.
---
mm/gup.c | 4
1 file changed, 4 insertions(+)
diff --git a/mm/gup.c b/mm/gup.c
index 3c39cbbeebef..69d2d110da3f 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2224,7 +2224,11 @@
Include safefetch and support caching strategy in syscalls to protect
against time of check to time of use bugs.
---
arch/x86/entry/syscall_64.c | 76 +
1 file changed, 76 insertions(+)
diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c
inde
---
include/linux/uaccess.h | 30 ++
1 file changed, 30 insertions(+)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 7c06f4795670..d6d80bb9e0fa 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -186,6 +186,26 @@ _inline_copy_fr
Adds caching data structure for every task structure and optionally adds
a statistics structure to each as well.
---
include/linux/sched.h | 11 +++
init/init_task.c | 11 +++
2 files changed, 22 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4
---
lib/Kconfig.debug | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ebe33181b6e6..d4b4214164a5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1040,6 +1040,7 @@ config MEM_ALLOC_PROFILING_DEBUG
source "lib/Kconfig.kasan"
source "lib/Kc
This adds a message indicating a double-fetch bug trigger for testing
the SafeFetch patchset. It add the message right before the fix for
CVE-2016-6516 [1][2] introduced by Scott Bauer [3]. Which can be tested
by first compiling the double-fetch program from [4], and running a shell
script similar
---
kernel/softirq.c | 8
1 file changed, 8 insertions(+)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 513b1945987c..cfed8419b6c5 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -632,6 +632,10 @@ void irq_enter_rcu(void)
*/
void irq_enter(void)
{
+#ifdef SAFEFETCH_D
Also update version string for differentiating testing kernels from
host kernels.
---
Makefile | 3 ++-
mm/Makefile | 1 +
scripts/Makefile.lib | 4
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 7eea2a41c905..6a3bf5849270 100644
-
Add disabled cache get_user function calls to futex functions to disable
using the SafeFetch cache on any fast userspace mutexes.
---
kernel/futex/core.c | 5 +
kernel/futex/futex.h| 4
kernel/futex/pi.c | 5 +
kernel/futex/requeue.c | 5 -
kernel/futex/waitwake.c |
Disable HAVE_ARCH_AUDITSYSCALL and HAVE_ARCH_SOFT_DIRTY. Both options
are untested with SafeFetch enabled as of right now.
---
arch/x86/Kconfig | 5 +++--
init/Kconfig | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 71019b3b54ea.
Adds various caching functions with different sizes alongside a macro to
select the smallest possible caching function to enable caching of user
calls to protect against time-of-check to time-of-use bugs.
---
arch/x86/include/asm/uaccess.h| 211 --
arch/x86/include/
26 matches
Mail list logo