Skip to contentSkip to conversation

__ubsan_handle_type_mismatch converted to __ubsan_handle_type_mismatch_v1

PATCH In review Sodagudi Prasad 2 participants 4 messages Oct 6, 2017 – Oct 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi All,

Based on below links __ubsan_handle_type_mismatch has been renamed to __ubsan_handle_type_mismatch_v1.

https://github.com/llvm-mirror/compiler-rt/commit/56faee71af1888ba12ab076b3d1f9bbe223493df#diff-21369cc6f3917b27df3ced8de89cf134
https://www.mail-archive.com/[email protected]/msg535130.html

When I tried to compile the kernel with LLVM seen following errors. arch/arm64/kernel/traps.o: In function `dump_backtrace':
kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' arch/arm64/kernel/traps.o: In function `dump_mem':

Can I add __ubsan_handle_type_mismatch_v1 API similar to __ubsan_handle_type_mismatch()(I will send path for review)? If both apis are present, then there will be backward compatibility. Let me know if you have any other suggestions for this issue.

-Thanks, Prasad

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
#1 lore raw
Quoted 17 lines · Sodagudi Prasad

Hi All,

Based on below links __ubsan_handle_type_mismatch has been renamed to  __ubsan_handle_type_mismatch_v1.

https://github.com/llvm-mirror/compiler-rt/commit/56faee71af1888ba12ab076b3d1f9bbe223493df#diff-21369cc6f3917b27df3ced8de89cf134
https://www.mail-archive.com/[email protected]/msg535130.html

When I tried to compile the kernel with LLVM seen following errors. arch/arm64/kernel/traps.o: In function `dump_backtrace':
kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' kernel/arch/arm64/kernel/traps.c:192: undefined reference to __ubsan_handle_type_mismatch_v1' arch/arm64/kernel/traps.o: In function `dump_mem':

Quoted 2 lines

Can I add __ubsan_handle_type_mismatch_v1 API similar to  __ubsan_handle_type_mismatch()(I will send path for review)? If both apis are present, then there will be backward compatibility.  Let me know if you have any other suggestions for this issue.

Sounds good, send the patch please.

Quoted 3 lines

-Thanks, Prasad

#2 lore raw

PATCH 1/1 UBSAN: Add __ubsan_handle_type_mismatch_v1 handler

In LLVM __ubsan_handle_type_mismatch handler is renamed to
__ubsan_handle_type_mismatch_v1. Add support for
__ubsan_handle_type_mismatch_v1 handler to avoid compilation issues with latest llvm tool chain. Also keeping __ubsan_handle_type_mismatch handler for backward compatibility.

---
 lib/ubsan.c | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/ubsan.c +8 -0
index fb0409d..9baf17d 100644
@@ -328,6 +328,14 @@ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
 }
 EXPORT_SYMBOL(__ubsan_handle_type_mismatch);
 
+void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data *data,
+				unsigned long ptr)
+{
+	__ubsan_handle_type_mismatch(data, ptr);
+}
+EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1);
+
+
 void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
 {
 	unsigned long flags;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

Re: [PATCH] UBSAN: Add __ubsan_handle_type_mismatch_v1 handler

Quoted 8 lines · Prasad Sodagudi

In LLVM __ubsan_handle_type_mismatch handler is renamed to
__ubsan_handle_type_mismatch_v1. Add support for
__ubsan_handle_type_mismatch_v1 handler to avoid compilation issues with latest llvm tool chain. Also keeping __ubsan_handle_type_mismatch handler for backward compatibility.

---

NACK. It wasn't *just* the rename, that wouldn't make any sense.
It was renamed because of the change in the ABI, which is not reflected in your patch, so it can't work.

Quoted 23 lines
 lib/ubsan.c | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/ubsan.c +8 -0
index fb0409d..9baf17d 100644
@@ -328,6 +328,14 @@ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
 }
 EXPORT_SYMBOL(__ubsan_handle_type_mismatch);
 
+void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data *data,
+				unsigned long ptr)
+{
+	__ubsan_handle_type_mismatch(data, ptr);
+}
+EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1);
+
+
 void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
 {
 	unsigned long flags;