From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4333A385E01A; Wed, 25 Mar 2020 09:28:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4333A385E01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585128509; bh=Ms+nqJwkH0KDp6llxvqHOSl/Tp3Wm+Zra7ixm8CkZ5A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aP/HZIvdihOiJleUI7MgymciZ/1Wr0ENO7pGG//RziX6j2XiWMb59WdcbEGYbc9md VvUXUCntdL3EW1dL03a92eXegEPqtzs2VOSp1kY7KMVOxKlf0IQ3vYIImcRPuVeaBQ acVegxpnvOYpVcGqZfDd71AnUZI3TyTfCc53hOco= From: "marxin at gcc dot 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: Wed, 25 Mar 2020 09:28:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status everconfirmed cf_reconfirmed_on target_milestone assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2020 09:28:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94307 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2020-03-25 Target Milestone|--- |11.0 Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot g= nu.org --- Comment #2 from Martin Li=C5=A1ka --- (In reply to Kees Cook from comment #0) > Instead of unconditionally calling __builtin_trap() for > -fsanitize-undefined-trap-on-error it would help the Linux kernel's use of > UBSAN to have a way to specify the trap function. With that, Linux can use > its own internal exception handling routines and avoid various confused > states: Sure, that's definitely possible. >=20 > https://lore.kernel.org/linux-next/20200324164433.qusyu5h7ykx3f2bu@treble/ >=20 > For example something like -fsanitize-undefined-trap-function=3D__ubsan_t= rap > and "__ubsan_trap" can then be defined by the kernel itself. Using the > standard handler routines (__ubsan_handle_*) are too heavy duty for some > builds, so a regular trap is needed for the kernel, but this allows us to > provide a "continue anyway" option as well. I would rather add something like -fsanitize-undefined-handler=3D[runtime,trap,handler] where - runtime would call current __ubsan_handle_* - trap would result in ud2 - handler - can be call to __ubsan_trap Where I can imagine it will call 2 versions (__ubsan_trap and __ubsan_trap_no_return). That will depend on -fsanitize-recovery=3D.. I can do a patch for GCC 11.=