public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/94307] Provide a way to declare the *SAN exception handler -fsanitize-undefined-trap-on-error Date: Tue, 31 Mar 2020 07:45:28 +0000 [thread overview] Message-ID: <bug-94307-4-ZAWGkbzQ1E@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94307-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94307 --- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Kees Cook from comment #5) > Hi! I recently learned that Clang has -fsanitizer-minimal-runtime that is > very close to what I was expecting to use: > > https://bugs.llvm.org/show_bug.cgi?id=45295 Looking at the implementation, you'll still have to implement ~50 entry points: #define HANDLER_RECOVER(name, msg) \ INTERFACE void __ubsan_handle_##name##_minimal() { \ if (!report_this_error(__builtin_return_address(0))) return; \ message("ubsan: " msg "\n"); \ } #define HANDLER_NORECOVER(name, msg) \ INTERFACE void __ubsan_handle_##name##_minimal_abort() { \ message("ubsan: " msg "\n"); \ abort_with_message("ubsan: " msg); \ } #define HANDLER(name, msg) \ HANDLER_RECOVER(name, msg) \ HANDLER_NORECOVER(name, msg) HANDLER(type_mismatch, "type-mismatch") HANDLER(alignment_assumption, "alignment-assumption") HANDLER(add_overflow, "add-overflow") HANDLER(sub_overflow, "sub-overflow") HANDLER(mul_overflow, "mul-overflow") HANDLER(negate_overflow, "negate-overflow") HANDLER(divrem_overflow, "divrem-overflow") HANDLER(shift_out_of_bounds, "shift-out-of-bounds") HANDLER(out_of_bounds, "out-of-bounds") HANDLER_RECOVER(builtin_unreachable, "builtin-unreachable") HANDLER_RECOVER(missing_return, "missing-return") HANDLER(vla_bound_not_positive, "vla-bound-not-positive") HANDLER(float_cast_overflow, "float-cast-overflow") HANDLER(load_invalid_value, "load-invalid-value") HANDLER(invalid_builtin, "invalid-builtin") HANDLER(function_type_mismatch, "function-type-mismatch") HANDLER(implicit_conversion, "implicit-conversion") HANDLER(nonnull_arg, "nonnull-arg") HANDLER(nonnull_return, "nonnull-return") HANDLER(nullability_arg, "nullability-arg") HANDLER(nullability_return, "nullability-return") HANDLER(pointer_overflow, "pointer-overflow") HANDLER(cfi_check_fail, "cfi-check-fail") > > That is close to what you're already suggesting. Would it be possible to do > the same thing? That way the kernel can have just one "not the full debug > details" handler. Well, it can be possible to implement the same. But I would like to see first a kernel discussion to happen. You can prepare a patch that will utilize clang and their -fsanitizer-minimal-runtime and sent it to Kernel mailing list. Would it be possible? > > Thanks for looking at this!
next prev parent reply other threads:[~2020-03-31 7:45 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-24 18:17 [Bug sanitizer/94307] New: " kees at outflux dot net 2020-03-25 7:35 ` [Bug sanitizer/94307] " rguenth at gcc dot gnu.org 2020-03-25 9:28 ` marxin at gcc dot gnu.org 2020-03-25 9:28 ` marxin at gcc dot gnu.org 2020-03-25 9:37 ` jakub at gcc dot gnu.org 2020-03-31 5:02 ` kees at outflux dot net 2020-03-31 7:45 ` marxin at gcc dot gnu.org [this message] 2020-04-06 11:23 ` marxin at gcc dot gnu.org 2020-04-20 9:31 ` marxin at gcc dot gnu.org 2020-05-15 11:32 ` marxin at gcc dot gnu.org 2020-07-28 10:24 ` marxin at gcc dot gnu.org 2021-04-27 11:38 ` jakub at gcc dot gnu.org 2021-07-28 7:04 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94307-4-ZAWGkbzQ1E@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).