authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2025-04-11 21:37:01+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-15 21:29:10+02:00
logd80cfa6f41b358440cc0ed021deaa01583a035d7
treeb206f52f1326ddf5fc78dd2cceb6d19d8cbeee5b
parent379f1c9fa0e9f7ec326ab13cc65d93a5101f3414

Compilation: Use trapping UBSan if -fno-ubsan-rt is passed.

This is a mitigation of #23216 meant only for 0.14.x.

1 files changed, 3 insertions(+), 1 deletions(-)

src/Compilation.zig+3-1
...@@ -6053,7 +6053,9 @@ pub fn addCCArgs(...@@ -6053,7 +6053,9 @@ pub fn addCCArgs(
6053 // function was called.6053 // function was called.
6054 try argv.append("-fno-sanitize=function");6054 try argv.append("-fno-sanitize=function");
60556055
6056 if (mod.optimize_mode == .ReleaseSafe) {6056 // If we want to sanitize C, but the ubsan runtime has been turned off,
6057 // we'll switch to just trapping.
6058 if (comp.ubsan_rt_strat == .none or mod.optimize_mode == .ReleaseSafe) {
6057 // It's recommended to use the minimal runtime in production6059 // It's recommended to use the minimal runtime in production
6058 // environments due to the security implications of the full runtime.6060 // environments due to the security implications of the full runtime.
6059 // The minimal runtime doesn't provide much benefit over simply6061 // The minimal runtime doesn't provide much benefit over simply