Skip to content

Commit 9acd5b8

Browse files
committed
Merge tag 'hardening-v6.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: - ARM: stacktrace: include asm/sections.h in asm/stacktrace.h (Arnd Bergmann) - ubsan: Fix incorrect hand-side used in handle (Junhui Pei) - hardening: Require clang 20.1.0 for __counted_by (Nathan Chancellor) * tag 'hardening-v6.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: hardening: Require clang 20.1.0 for __counted_by ARM: stacktrace: include asm/sections.h in asm/stacktrace.h ubsan: Fix incorrect hand-side used in handle
2 parents 1c99e3e + 86a9b12 commit 9acd5b8

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

arch/arm/include/asm/stacktrace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
#ifndef __ASM_STACKTRACE_H
33
#define __ASM_STACKTRACE_H
44

5-
#include <asm/ptrace.h>
65
#include <linux/llist.h>
6+
#include <asm/ptrace.h>
7+
#include <asm/sections.h>
78

89
struct stackframe {
910
/*

init/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ config CC_HAS_NO_PROFILE_FN_ATTR
117117

118118
config CC_HAS_COUNTED_BY
119119
bool
120-
# clang needs to be at least 19.1.3 to avoid __bdos miscalculations
121-
# https://github.com/llvm/llvm-project/pull/110497
122-
# https://github.com/llvm/llvm-project/pull/112636
123-
default y if CC_IS_CLANG && CLANG_VERSION >= 190103
120+
# clang needs to be at least 20.1.0 to avoid potential crashes
121+
# when building structures that contain __counted_by
122+
# https://github.com/ClangBuiltLinux/linux/issues/2114
123+
# https://github.com/llvm/llvm-project/commit/160fb1121cdf703c3ef5e61fb26c5659eb581489
124+
default y if CC_IS_CLANG && CLANG_VERSION >= 200100
124125
# supported since gcc 15.1.0
125126
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896
126127
default y if CC_IS_GCC && GCC_VERSION >= 150100

lib/ubsan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,18 @@ EXPORT_SYMBOL(__ubsan_handle_implicit_conversion);
333333
void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
334334
{
335335
struct overflow_data *data = _data;
336-
char rhs_val_str[VALUE_LENGTH];
336+
char lhs_val_str[VALUE_LENGTH];
337337

338338
if (suppress_report(&data->location))
339339
return;
340340

341341
ubsan_prologue(&data->location, "division-overflow");
342342

343-
val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs);
343+
val_to_string(lhs_val_str, sizeof(lhs_val_str), data->type, lhs);
344344

345345
if (type_is_signed(data->type) && get_signed_val(data->type, rhs) == -1)
346346
pr_err("division of %s by -1 cannot be represented in type %s\n",
347-
rhs_val_str, data->type->type_name);
347+
lhs_val_str, data->type->type_name);
348348
else
349349
pr_err("division by zero\n");
350350

0 commit comments

Comments
 (0)