hardening fixes for v6.17-rc4

- 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)
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRSPkdeREjth1dHnSE2KwveOeQkuwUCaLOvqAAKCRA2KwveOeQk
 u1KAAP0VBugVq0bY12ZGl+UPCQo64Ry9ekssZaLNow73tEv4iAEA4VCdkgrN/p/T
 Nb8nYy7skfmbp6T43cm5lqldO6S7KAo=
 =xoX+
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-08-31 08:56:45 -07:00
commit 9acd5b8beb
3 changed files with 10 additions and 8 deletions

View File

@ -2,8 +2,9 @@
#ifndef __ASM_STACKTRACE_H
#define __ASM_STACKTRACE_H
#include <asm/ptrace.h>
#include <linux/llist.h>
#include <asm/ptrace.h>
#include <asm/sections.h>
struct stackframe {
/*

View File

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

View File

@ -333,18 +333,18 @@ EXPORT_SYMBOL(__ubsan_handle_implicit_conversion);
void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
{
struct overflow_data *data = _data;
char rhs_val_str[VALUE_LENGTH];
char lhs_val_str[VALUE_LENGTH];
if (suppress_report(&data->location))
return;
ubsan_prologue(&data->location, "division-overflow");
val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs);
val_to_string(lhs_val_str, sizeof(lhs_val_str), data->type, lhs);
if (type_is_signed(data->type) && get_signed_val(data->type, rhs) == -1)
pr_err("division of %s by -1 cannot be represented in type %s\n",
rhs_val_str, data->type->type_name);
lhs_val_str, data->type->type_name);
else
pr_err("division by zero\n");