summaryrefslogtreecommitdiff
path: root/debian/patches/testsuite-hardening-format.diff
blob: 8c0d9b184d0e3f6381c4fb3744c9eb0159b27201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#! /bin/sh -e

# All lines beginning with `# DPATCH:' are a description of the patch.
# DP: Description: use -Wno-format on tests that cannot be adjusted other ways.
# DP: Author: Kees Cook <kees@ubuntu.com>
# DP: Ubuntu: https://bugs.launchpad.net/bugs/344502

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p1 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

---
 src/gcc/testsuite/c-c++-common/torture/vector-compare-1.c  |    1 +
 src/gcc/testsuite/g++.dg/abi/pragma-pack1.C                |    2 ++
 src/gcc/testsuite/g++.dg/abi/regparm1.C                    |    1 +
 src/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C           |    1 +
 src/gcc/testsuite/g++.dg/torture/pr51436.C                 |    1 +
 src/gcc/testsuite/g++.old-deja/g++.law/weak.C              |    2 +-
 src/gcc/testsuite/g++.old-deja/g++.other/std1.C            |    1 +
 src/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x   |    5 +++++
 src/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x    |    5 +++++
 src/gcc/testsuite/gcc.dg/charset/builtin2.c                |    2 +-
 src/gcc/testsuite/gcc.dg/format/format.exp                 |    2 +-
 src/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c                   |    2 +-
 src/gcc/testsuite/gcc.dg/lto/20090218-2_0.c                |    2 ++
 src/gcc/testsuite/gcc.dg/pr30473.c                         |    2 +-
 src/gcc/testsuite/gcc.dg/pr38902.c                         |    2 +-
 src/gcc/testsuite/gcc.dg/pr59418.c                         |    2 +-
 src/gcc/testsuite/gcc.dg/torture/tls/tls-test.c            |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c      |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c  |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c       |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c   |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c     |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c      |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c  |    2 +-
 src/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c              |    2 +-
 src/gcc/testsuite/objc.dg/torture/strings/const-str-3.m    |    2 +-
 28 files changed, 40 insertions(+), 18 deletions(-)

Index: b/src/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x
@@ -0,0 +1,5 @@
+# Implement "/* { dg-options "-U_FORITFY_SOURCE" } */", due to
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20567
+
+set additional_flags "-U_FORTIFY_SOURCE"
+return 0
Index: b/src/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x
@@ -0,0 +1,5 @@
+# Implement "/* { dg-options "-U_FORITFY_SOURCE" } */", due to
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20567
+
+set additional_flags "-U_FORTIFY_SOURCE"
+return 0
Index: b/src/gcc/testsuite/gcc.dg/charset/builtin2.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/charset/builtin2.c
+++ b/src/gcc/testsuite/gcc.dg/charset/builtin2.c
@@ -3,7 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-require-iconv "IBM1047" } */
-/* { dg-options "-O2 -fexec-charset=IBM1047" } */
+/* { dg-options "-O2 -fexec-charset=IBM1047 -Wno-format" } */
 /* { dg-final { scan-assembler-not "printf" } } */
 /* { dg-final { scan-assembler-not "fprintf" } } */
 /* { dg-final { scan-assembler-not "sprintf" } } */
Index: b/src/gcc/testsuite/gcc.dg/format/format.exp
===================================================================
--- a/src/gcc/testsuite/gcc.dg/format/format.exp
+++ b/src/gcc/testsuite/gcc.dg/format/format.exp
@@ -26,7 +26,7 @@ load_lib gcc-dg.exp
 load_lib torture-options.exp
 
 torture-init
-set-torture-options [list { } { -DWIDE } ]
+set-torture-options [list { -Wformat=0 } { -DWIDE -Wformat=0 } ]
 
 dg-init
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" ""
Index: b/src/gcc/testsuite/gcc.dg/pr30473.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/pr30473.c
+++ b/src/gcc/testsuite/gcc.dg/pr30473.c
@@ -1,7 +1,7 @@
 /* PR middle-end/30473 */
 /* Make sure this doesn't ICE.  */
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -Wno-format" } */
 
 extern int sprintf (char *, const char *, ...);
 
Index: b/src/gcc/testsuite/gcc.dg/pr38902.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/pr38902.c
+++ b/src/gcc/testsuite/gcc.dg/pr38902.c
@@ -1,6 +1,6 @@
 /* PR target/38902 */
 /* { dg-do run } */
-/* { dg-options "-O2 -fstack-protector" } */
+/* { dg-options "-O2 -fstack-protector -Wno-format" } */
 /* { dg-require-effective-target fstack_protector } */
 
 #ifdef DEBUG
Index: b/src/gcc/testsuite/gcc.dg/pr59418.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/pr59418.c
+++ b/src/gcc/testsuite/gcc.dg/pr59418.c
@@ -2,7 +2,7 @@
 /* Reported by Ryan Mansfield <rmansfield@qnx.com> */
 
 /* { dg-do compile } */
-/* { dg-options "-Os -g" } */
+/* { dg-options "-Os -g -Wno-format-zero-length" } */
 /* { dg-options "-march=armv7-a+fp -mfloat-abi=hard -Os -g" { target { arm*-*-* && { ! arm_thumb1 } } } } */
 
 extern int printf (const char *__format, ...);
Index: b/src/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
+++ b/src/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details"  } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details -Wformat=0"  } */
 
 struct bovid
 {
Index: b/src/gcc/testsuite/gcc.dg/lto/20090218-2_0.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/lto/20090218-2_0.c
+++ b/src/gcc/testsuite/gcc.dg/lto/20090218-2_0.c
@@ -1,3 +1,5 @@
+/* { dg-lto-options "-Wno-nonnull" } */
+
 void set_mem_alias_set ();
 void emit_push_insn () {
   set_mem_alias_set ();
Index: b/src/gcc/testsuite/c-c++-common/torture/vector-compare-1.c
===================================================================
--- a/src/gcc/testsuite/c-c++-common/torture/vector-compare-1.c
+++ b/src/gcc/testsuite/c-c++-common/torture/vector-compare-1.c
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-options "-Wformat=0" } */
 #define vector(elcount, type)  \
 __attribute__((vector_size((elcount)*sizeof(type)))) type
 
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 #include <stdarg.h>
 
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 #include <stdarg.h>
 
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 extern int printf (const char *, ...);
 volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via;
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 extern int __printf_chk (int, const char *, ...);
 volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via;
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 typedef struct { int i; } FILE;
 FILE *fp;
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 typedef struct { int i; } FILE;
 FILE *fp;
Index: b/src/gcc/testsuite/gcc.dg/torture/tls/tls-test.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/torture/tls/tls-test.c
+++ b/src/gcc/testsuite/gcc.dg/torture/tls/tls-test.c
@@ -1,7 +1,7 @@
 /* { dg-do run }  */
 /* { dg-require-effective-target tls  }  */
 /* { dg-require-effective-target pthread } */
-/* { dg-options "-pthread" } */
+/* { dg-options "-pthread -Wformat=0" } */
 
 #include <pthread.h>
 extern int printf (char *,...);
Index: b/src/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
===================================================================
--- a/src/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
+++ b/src/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
@@ -2,7 +2,7 @@
 /* Developed by Markus Hitter <mah@jump-ing.de>.  */
 /* { dg-do run } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-/* { dg-options "-fconstant-string-class=Foo" } */
+/* { dg-options "-fconstant-string-class=Foo -Wno-format-security" } */
 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
 
 #include "../../../objc-obj-c++-shared/objc-test-suite-types.h"
Index: b/src/gcc/testsuite/g++.dg/abi/pragma-pack1.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/abi/pragma-pack1.C
+++ b/src/gcc/testsuite/g++.dg/abi/pragma-pack1.C
@@ -1,5 +1,7 @@
 // PR c++/7046
 
+// { dg-options "-Wformat=0" }
+
 extern "C" int printf (const char *, ...);
 
 #pragma pack(4)
Index: b/src/gcc/testsuite/g++.dg/abi/regparm1.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/abi/regparm1.C
+++ b/src/gcc/testsuite/g++.dg/abi/regparm1.C
@@ -1,6 +1,7 @@
 // PR c++/29911 (9381)
 // { dg-do run { target i?86-*-* x86_64-*-* } }
 // { dg-require-effective-target c++11 }
+// { dg-options "-Wformat=0" }
 
 extern "C" int printf(const char *, ...);
 
Index: b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C
+++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C
@@ -1,5 +1,6 @@
 // PR c++/53202
 // { dg-do run { target c++11 } }
+// { dg-options "-Wformat=0" }
 
 #include <tuple>
 
Index: b/src/gcc/testsuite/g++.dg/torture/pr51436.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/torture/pr51436.C
+++ b/src/gcc/testsuite/g++.dg/torture/pr51436.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-Wno-nonnull" } */
 /* { dg-additional-options "-Wno-return-type" } */
 
 typedef __SIZE_TYPE__ size_t;
Index: b/src/gcc/testsuite/g++.old-deja/g++.law/weak.C
===================================================================
--- a/src/gcc/testsuite/g++.old-deja/g++.law/weak.C
+++ b/src/gcc/testsuite/g++.old-deja/g++.law/weak.C
@@ -1,6 +1,6 @@
 // { dg-do link { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } }
 // { dg-require-effective-target static }
-// { dg-options "-static" }
+// { dg-options "-static -Wno-nonnull" }
 // Bug: g++ fails to instantiate operator<<.
 
 // libc-5.4.xx has __IO_putc in its static C library, which can conflict
Index: b/src/gcc/testsuite/g++.old-deja/g++.other/std1.C
===================================================================
--- a/src/gcc/testsuite/g++.old-deja/g++.other/std1.C
+++ b/src/gcc/testsuite/g++.old-deja/g++.other/std1.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-options "-Wno-nonnull" }
 // Origin: Mark Mitchell <mark@codesourcery.com>
 
 extern "C" int memcmp (const void * __s1,
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 #include <stdarg.h>
 
Index: b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fab1" } */
+/* { dg-options "-O2 -fdump-tree-fab1 -Wno-format-zero-length" } */
 
 #include <stdarg.h>