From 390e22a8c68c5653f360866009f06be2d23aade8 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 18 Mar 2022 12:56:10 -0700 Subject: [PATCH] Add ASAN guards to some asm data structures --- libc/log/countbranch_data.S | 2 ++ libc/log/countexpr_data.S | 2 ++ libc/nt/master.sh | 2 +- libc/runtime/init.S | 4 ++++ libc/testlib/bench.S | 2 ++ libc/testlib/blocktronics.S | 3 ++- libc/testlib/combo.S | 2 ++ libc/testlib/fixture.S | 2 ++ libc/testlib/hyperion.S | 3 ++- libc/testlib/moby.S | 3 ++- libc/testlib/testcase.S | 2 ++ libc/time/kmonthname.S | 2 ++ libc/time/kmonthnameshort.S | 2 ++ libc/time/kweekdayname.S | 2 ++ libc/time/kweekdaynameshort.S | 2 ++ 15 files changed, 31 insertions(+), 4 deletions(-) diff --git a/libc/log/countbranch_data.S b/libc/log/countbranch_data.S index 31d781b21..0d6aa76d9 100644 --- a/libc/log/countbranch_data.S +++ b/libc/log/countbranch_data.S @@ -22,6 +22,7 @@ .section .sort.data.countbranch.1,"a",@progbits .align 8 + .underrun .globl countbranch_data countbranch_data: .previous @@ -31,4 +32,5 @@ countbranch_data: .rept 5 .quad -1 .endr + .overrun .previous diff --git a/libc/log/countexpr_data.S b/libc/log/countexpr_data.S index c8b15d566..2a80d41de 100644 --- a/libc/log/countexpr_data.S +++ b/libc/log/countexpr_data.S @@ -24,10 +24,12 @@ .section .sort.data.countexpr.1,"a",@progbits .align 8 .globl countexpr_data + .underrun countexpr_data: .previous .section .sort.data.countexpr.3,"a",@progbits .align 8 .quad 0 + .overrun .previous diff --git a/libc/nt/master.sh b/libc/nt/master.sh index 1f0a9593e..d77d8942f 100755 --- a/libc/nt/master.sh +++ b/libc/nt/master.sh @@ -1,4 +1,4 @@ -/usr/bin/env echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ +/usr/bin/env echo ' -*-mode:sh;indent-tabs-mode:nil;tab-width:8;coding:utf-8-*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ diff --git a/libc/runtime/init.S b/libc/runtime/init.S index ecfacb76f..4c675b285 100644 --- a/libc/runtime/init.S +++ b/libc/runtime/init.S @@ -84,6 +84,7 @@ _woot: leave .globl __init_rodata_start,__init_rodata_end .hidden __init_rodata_start,__init_rodata_end .align __SIZEOF_POINTER__ + .underrun __init_rodata_start: .previous/* ... @@ -92,6 +93,7 @@ __init_rodata_start: */.section .initroepilogue,"a",@progbits __init_rodata_end: .byte 0x90 + .overrun .previous // Decentralized section for unpacked data structures. @@ -107,6 +109,7 @@ __init_rodata_end: .globl __init_bss_start,__init_bss_end .hidden __init_bss_start,__init_bss_end .align __SIZEOF_POINTER__ + .underrun __init_bss_start: .previous/* ... @@ -115,6 +118,7 @@ __init_bss_start: */.section .piro.bss.init.3,"aw",@nobits __init_bss_end: .byte 0 + .overrun .previous // Special area for Windows NT support code. diff --git a/libc/testlib/bench.S b/libc/testlib/bench.S index 9eb92fded..8aaca6710 100644 --- a/libc/testlib/bench.S +++ b/libc/testlib/bench.S @@ -29,6 +29,7 @@ .hidden __bench_start,__bench_end .byte 0 .align __SIZEOF_POINTER__ + .underrun __bench_start: .previous/* ... @@ -37,4 +38,5 @@ __bench_start: */.section .piro.relo.sort.bench.3,"aw",@nobits __bench_end: .quad 0 + .overrun .previous diff --git a/libc/testlib/blocktronics.S b/libc/testlib/blocktronics.S index da8283602..2bbf3ee6c 100644 --- a/libc/testlib/blocktronics.S +++ b/libc/testlib/blocktronics.S @@ -20,11 +20,12 @@ .rodata // Nontrivial NUL-terminated string test vector. - .align 1 + .underrun kBlocktronics: 0: .incbin "libc/testlib/blocktronics.txt" 1: .byte 0 .endobj kBlocktronics,globl + .overrun .align 8 kBlocktronicsSize: diff --git a/libc/testlib/combo.S b/libc/testlib/combo.S index 6bd8d96ac..c78adbd6b 100644 --- a/libc/testlib/combo.S +++ b/libc/testlib/combo.S @@ -28,6 +28,7 @@ .hidden __combo_start,__combo_end .byte 0 .align __SIZEOF_POINTER__ + .underrun __combo_start: .previous/* ... @@ -36,4 +37,5 @@ __combo_start: */.section .piro.relo.sort.combo.3,"aw",@nobits __combo_end: .quad 0 + .overrun .previous diff --git a/libc/testlib/fixture.S b/libc/testlib/fixture.S index e19557ffb..68ba56c38 100644 --- a/libc/testlib/fixture.S +++ b/libc/testlib/fixture.S @@ -28,6 +28,7 @@ .hidden __fixture_start,__fixture_end .byte 0 .align __SIZEOF_POINTER__ + .underrun __fixture_start: .previous/* ... @@ -36,4 +37,5 @@ __fixture_start: */.section .piro.relo.sort.fixture.3,"aw",@nobits __fixture_end: .quad 0 + .overrun .previous diff --git a/libc/testlib/hyperion.S b/libc/testlib/hyperion.S index 1da7ec3b4..4e2b1c42e 100644 --- a/libc/testlib/hyperion.S +++ b/libc/testlib/hyperion.S @@ -20,11 +20,12 @@ .rodata // Nontrivial NUL-terminated string test vector. - .align 1 + .underrun kHyperion: 0: .incbin "libc/testlib/hyperion.txt" 1: .byte 0 .endobj kHyperion,globl + .overrun .align 8 kHyperionSize: diff --git a/libc/testlib/moby.S b/libc/testlib/moby.S index c1120154e..62d04645e 100644 --- a/libc/testlib/moby.S +++ b/libc/testlib/moby.S @@ -20,11 +20,12 @@ .rodata // Nontrivial NUL-terminated string test vector. - .align 1 + .underrun kMoby: 0: .incbin "libc/testlib/moby.txt" 1: .byte 0 .endobj kMoby,globl + .overrun .align 8 kMobySize: diff --git a/libc/testlib/testcase.S b/libc/testlib/testcase.S index fdfc08f0a..b74bc0a90 100644 --- a/libc/testlib/testcase.S +++ b/libc/testlib/testcase.S @@ -28,6 +28,7 @@ .hidden __testcase_start,__testcase_end .byte 0 .align __SIZEOF_POINTER__ + .underrun __testcase_start: .previous/* ... @@ -36,4 +37,5 @@ __testcase_start: */.section .piro.relo.sort.testcase.3,"aw",@nobits __testcase_end: .quad 0 + .overrun .previous diff --git a/libc/time/kmonthname.S b/libc/time/kmonthname.S index e37f267df..e9a4984d0 100644 --- a/libc/time/kmonthname.S +++ b/libc/time/kmonthname.S @@ -11,6 +11,7 @@ // extern const char kMonthName[12][10]; .section .rodata,"a",@progbits + .underrun kMonthName: .ascin "January",10 .ascin "February",10 @@ -25,4 +26,5 @@ kMonthName: .ascin "November",10 .ascin "December",10 .endobj kMonthName,globl + .overrun .previous diff --git a/libc/time/kmonthnameshort.S b/libc/time/kmonthnameshort.S index c616f15cb..4f1874086 100644 --- a/libc/time/kmonthnameshort.S +++ b/libc/time/kmonthnameshort.S @@ -16,6 +16,7 @@ // - Double-NUL Terminated String // - extern const char kMonthNameShort[]; .section .rodata,"a",@progbits + .underrun kMonthNameShort: .ascin "Jan",4 .ascin "Feb",4 @@ -31,4 +32,5 @@ kMonthNameShort: .ascin "Dec",4 .byte 0 .endobj kMonthNameShort,globl + .overrun .previous diff --git a/libc/time/kweekdayname.S b/libc/time/kweekdayname.S index 1cfc29250..0fa2d967c 100644 --- a/libc/time/kweekdayname.S +++ b/libc/time/kweekdayname.S @@ -11,6 +11,7 @@ // extern const char kWeekdayName[7][10]; .section .rodata,"a",@progbits + .underrun kWeekdayName: .ascin "Sunday",10 .ascin "Monday",10 @@ -20,4 +21,5 @@ kWeekdayName: .ascin "Friday",10 .ascin "Saturday",10 .endobj kWeekdayName,globl + .overrun .previous diff --git a/libc/time/kweekdaynameshort.S b/libc/time/kweekdaynameshort.S index a7b7677d4..14a37b1bd 100644 --- a/libc/time/kweekdaynameshort.S +++ b/libc/time/kweekdaynameshort.S @@ -16,6 +16,7 @@ // - Double-NUL Terminated String // - extern const char kWeekdayNameShort[]; .section .rodata,"a",@progbits + .underrun kWeekdayNameShort: .asciz "Sun" .asciz "Mon" @@ -26,4 +27,5 @@ kWeekdayNameShort: .asciz "Sat" .byte 0 .endobj kWeekdayNameShort,globl + .overrun .previous