ubsan-implement-__ubsan_handle_alignment_assumption.patch removed from -mm tree
The patch titled
Subject: ubsan: implement __ubsan_handle_alignment_assumption
has been removed from the -mm tree. Its filename was
ubsan-implement-__ubsan_handle_alignment_assumption.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Nathan Chancellor <[email protected]>
Subject: ubsan: implement __ubsan_handle_alignment_assumption
When building ARCH=mips 32r2el_defconfig with CONFIG_UBSAN_ALIGNMENT:
ld.lld: error: undefined symbol: __ubsan_handle_alignment_assumption
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
referenced by slab.h:557 (
include/linux/slab.h:557)
main.o:(do_initcalls) in archiveinit/built-in.a
referenced by slab.h:448 (include/linux/slab.h:448)
do_mounts_rd.o:(rd_load_image) in archiveinit/built-in.a
referenced by slab.h:448 (include/linux/slab.h:448)
do_mounts_rd.o:(identify_ramdisk_image) in archiveinit/built-in.a
referenced 1579 more times
Implement this for the kernel based on LLVM's handleAlignmentAssumptionImpl because the kernel is not linked against the compiler runtime.
---
lib/ubsan.c | 31 +++++++++++++++++++++++++++++++ lib/ubsan.h | 6 ++++++ 2 files changed, 37 insertions(+)
lib/ubsan.c renamed from lib/ubsan.c~ubsan-implement-__ubsan_handle_alignment_assumption +31 -0
@@ -427,3 +427,34 @@ void __ubsan_handle_load_invalid_value(vubsan_epilogue (); }EXPORT_SYMBOL (__ubsan_handle_load_invalid_value); + +void __ubsan_handle_alignment_assumption (void *_data,unsigned long ptr, +unsigned long align, +unsigned long offset); +void __ubsan_handle_alignment_assumption (void *_data,unsigned long ptr, +unsigned long align, +unsigned long offset) +{ +struct alignment_assumption_data *data = _data; +unsigned long real_ptr; + +if (suppress_report (&data->location)) +return ; + +ubsan_prologue (&data->location,"alignment-assumption" ); + +if (offset) +pr_err ("assumption of %lu byte alignment (with offset of %lu byte) for pointer of type %s failed" , + align, offset, data->type->type_name); +else +pr_err ("assumption of %lu byte alignment for pointer of type %s failed" , + align, data->type->type_name); + + real_ptr = ptr - offset; +pr_err ("%saddress is %lu aligned, misalignment offset is %lu bytes" , + offset ?"offset " :"" ,BIT (real_ptr ?__ffs (real_ptr) :0 ), + real_ptr & (align -1 )); + +ubsan_epilogue (); +} +EXPORT_SYMBOL (__ubsan_handle_alignment_assumption);
lib/ubsan.h renamed from lib/ubsan.h~ubsan-implement-__ubsan_handle_alignment_assumption +6 -0
@@ -78,6 +78,12 @@ struct invalid_value_data {struct type_descriptor *type; }; +struct alignment_assumption_data { +struct source_location location; +struct source_location assumption_location; +struct type_descriptor *type; +}; +#if defined(CONFIG_ARCH_SUPPORTS_INT128 )typedef __int128 s_max ;typedef unsigned __int128 u_max ;
_
Patches currently in -mm which might be from [email protected] are