summaryrefslogtreecommitdiff
path: root/userland/libc/ubsan.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-10-22 19:50:38 +0200
committerAnton Kling <anton@kling.gg>2023-10-22 19:50:38 +0200
commit4e09bca9e34c226b6d7e34b4fa11248405fd988e (patch)
tree80f156b7940d9d19971395f335530170c69516c7 /userland/libc/ubsan.c
Move everything into a new repo.
Diffstat (limited to 'userland/libc/ubsan.c')
-rw-r--r--userland/libc/ubsan.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/userland/libc/ubsan.c b/userland/libc/ubsan.c
new file mode 100644
index 0000000..9ac9879
--- /dev/null
+++ b/userland/libc/ubsan.c
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <ubsan.h>
+
+void ubsan_log(const char *cause, struct source_location source) {
+ printf("UBSAN\n");
+ printf("%s: %s : %d\n", cause, source.file_name, source.line);
+ for (;;)
+ ;
+}
+
+void __ubsan_handle_shift_out_of_bounds(struct ShiftOutOfBoundsData *data,
+ unsigned long lhs, unsigned long rhs) {
+ (void)lhs;
+ (void)rhs;
+ ubsan_log("handle_shift_out_of_bounds", data->location);
+}
+
+void __ubsan_handle_add_overflow(struct OverflowData *data, unsigned long lhs,
+ unsigned long rhs) {
+ (void)lhs;
+ (void)rhs;
+ ubsan_log("handle_add_overflow", data->location);
+}
+
+void __ubsan_handle_sub_overflow(struct OverflowData *data, unsigned long lhs,
+ unsigned long rhs) {
+ (void)lhs;
+ (void)rhs;
+ ubsan_log("handle_sub_overflow", data->location);
+}
+
+void __ubsan_handle_negate_overflow(struct OverflowData *data, unsigned long lhs,
+ unsigned long rhs) {
+ (void)lhs;
+ (void)rhs;
+ ubsan_log("handle_negate_overflow", data->location);
+}
+
+void __ubsan_handle_mul_overflow(struct OverflowData *data, unsigned long lhs,
+ unsigned long rhs) {
+ (void)lhs;
+ (void)rhs;
+ ubsan_log("handle_mul_overflow", data->location);
+}
+
+void __ubsan_handle_out_of_bounds(struct OutOfBoundsData *data, void *index) {
+ (void)index;
+ ubsan_log("handle_out_of_bounds", data->location);
+}