forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf686ae8
committed
Add workaround to make ubsan and ps_status.c compatible
At least on linux, set_ps_display() breaks /proc/$pid/environ. The sanitizer'shelper library uses /proc/$pid/environ to implement getenv(), as it wants towork independent of libc. When just using undefined and alignment sanitizers,the sanitizer library is only initialized when the first error occurs, bywhich time we've often already called set_ps_display(), preventing thesanitizer libraries from seeing the options.We can work around that by defining __ubsan_default_options, a weak symbollibsanitizer uses to get defaults from the application, and returngetenv("UBSAN_OPTIONS"). But only if main already was reached, so that wedon't end up relying on a not-yet-working getenv().As it's just a function that won't get called when not running a sanitizer, itdoesn't seem necessary to make compilation of the function conditional.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/20220323173537.ll7klrglnp4gn2um@alap3.anarazel.de1 parentaeaaf52 commitf686ae8
1 file changed
+30
-0
lines changedLines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
| |||
59 | 60 |
| |
60 | 61 |
| |
61 | 62 |
| |
| 63 | + | |
| 64 | + | |
62 | 65 |
| |
63 | 66 |
| |
64 | 67 |
| |
| |||
420 | 423 |
| |
421 | 424 |
| |
422 | 425 |
| |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + |
0 commit comments
Comments
(0)