Commit 9acd5b8b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 1c99e3e9 86a9b125
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 {
	/*
+5 −4
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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");