* GCC-4.3.3 sillyness
@ 2009-01-30 7:44 Manuel Lauss
2009-01-30 8:23 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Manuel Lauss @ 2009-01-30 7:44 UTC (permalink / raw)
To: linux-mips
Hello,
Can't build kernel because gcc-4.3.3 comes up with this gem:
CC arch/mips/kernel/traps.o
cc1: warnings being treated as errors
/linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler':
/linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments
The fastest fix is the patch below, but I don't know whether it is
the right thing to do.
Thanks!
Manuel Lauss
---
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 7378b91..70ddf83 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -78,7 +78,7 @@ all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64)
# machines may also. Since BFD is incredibly buggy with respect to
# crossformat linking we rely on the elf2ecoff tool for format conversion.
#
-cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -Wno-format
cflags-y += -msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
MODFLAGS += -mlong-calls
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: GCC-4.3.3 sillyness 2009-01-30 7:44 GCC-4.3.3 sillyness Manuel Lauss @ 2009-01-30 8:23 ` Geert Uytterhoeven 2009-01-30 8:55 ` Manuel Lauss 2009-01-30 14:03 ` Ralf Baechle 2009-01-31 7:59 ` [SOLVED] " Manuel Lauss 2 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2009-01-30 8:23 UTC (permalink / raw) To: Manuel Lauss; +Cc: linux-mips On Fri, 30 Jan 2009, Manuel Lauss wrote: > CC arch/mips/kernel/traps.o > cc1: warnings being treated as errors > /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': > /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments > > The fastest fix is the patch below, but I don't know whether it is > the right thing to do. > > --- > > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > index 7378b91..70ddf83 100644 > --- a/arch/mips/Makefile > +++ b/arch/mips/Makefile > @@ -78,7 +78,7 @@ all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) > # machines may also. Since BFD is incredibly buggy with respect to > # crossformat linking we rely on the elf2ecoff tool for format conversion. > # > -cflags-y += -G 0 -mno-abicalls -fno-pic -pipe > +cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -Wno-format > cflags-y += -msoft-float > LDFLAGS_vmlinux += -G 0 -static -n -nostdlib > MODFLAGS += -mlong-calls No, you don't want to disable printf()-style format checking. diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index f6083c6..16f499c 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -1596,7 +1596,7 @@ void __cpuinit set_uncached_handler(unsigned long offset, void *addr, ebase += (read_c0_ebase() & 0x3ffff000); if (!addr) - panic(panic_null_cerr); + panic("%s", panic_null_cerr); memcpy((void *)(uncached_ebase + offset), addr, size); } Hwoever, I'm a bit surprised gcc isn't smart enough to notice the string is fixed and safe. Perhaps because panic_null_cerr is not const? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: GCC-4.3.3 sillyness 2009-01-30 8:23 ` Geert Uytterhoeven @ 2009-01-30 8:55 ` Manuel Lauss 0 siblings, 0 replies; 8+ messages in thread From: Manuel Lauss @ 2009-01-30 8:55 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: linux-mips Hi Geert, On Fri, Jan 30, 2009 at 09:23:38AM +0100, Geert Uytterhoeven wrote: > On Fri, 30 Jan 2009, Manuel Lauss wrote: > > CC arch/mips/kernel/traps.o > > cc1: warnings being treated as errors > > /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': > > /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments > > > > The fastest fix is the patch below, but I don't know whether it is > > the right thing to do. > > > > --- > > > > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > > index 7378b91..70ddf83 100644 > > --- a/arch/mips/Makefile > > +++ b/arch/mips/Makefile > > @@ -78,7 +78,7 @@ all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) > > # machines may also. Since BFD is incredibly buggy with respect to > > # crossformat linking we rely on the elf2ecoff tool for format conversion. > > # > > -cflags-y += -G 0 -mno-abicalls -fno-pic -pipe > > +cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -Wno-format > > cflags-y += -msoft-float > > LDFLAGS_vmlinux += -G 0 -static -n -nostdlib > > MODFLAGS += -mlong-calls > > No, you don't want to disable printf()-style format checking. > > diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c > index f6083c6..16f499c 100644 > --- a/arch/mips/kernel/traps.c > +++ b/arch/mips/kernel/traps.c > @@ -1596,7 +1596,7 @@ void __cpuinit set_uncached_handler(unsigned long offset, void *addr, > ebase += (read_c0_ebase() & 0x3ffff000); > > if (!addr) > - panic(panic_null_cerr); > + panic("%s", panic_null_cerr); > > memcpy((void *)(uncached_ebase + offset), addr, size); > } > > Hwoever, I'm a bit surprised gcc isn't smart enough to notice the string is > fixed and safe. Perhaps because panic_null_cerr is not const? There's a similar one in cpu-probe.c which doesn't bother it at all, probably because the call to panic() has 2 arguments instead of one. I say it's a gcc bug ;-) Thanks! Manuel Lauss ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GCC-4.3.3 sillyness 2009-01-30 7:44 GCC-4.3.3 sillyness Manuel Lauss 2009-01-30 8:23 ` Geert Uytterhoeven @ 2009-01-30 14:03 ` Ralf Baechle 2009-01-30 16:56 ` Manuel Lauss 2009-01-31 7:59 ` [SOLVED] " Manuel Lauss 2 siblings, 1 reply; 8+ messages in thread From: Ralf Baechle @ 2009-01-30 14:03 UTC (permalink / raw) To: Manuel Lauss; +Cc: linux-mips On Fri, Jan 30, 2009 at 08:44:07AM +0100, Manuel Lauss wrote: > Can't build kernel because gcc-4.3.3 comes up with this gem: > > CC arch/mips/kernel/traps.o > cc1: warnings being treated as errors > /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': > /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments > > The fastest fix is the patch below, but I don't know whether it is > the right thing to do. Is this new with 4.3.3? I've not ran into this problem with 4.3.2 so far. Or it could be configuration dependent ... This seems a gcc bug so could you extract a test case and file a gcc bug report? Ralf ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GCC-4.3.3 sillyness 2009-01-30 14:03 ` Ralf Baechle @ 2009-01-30 16:56 ` Manuel Lauss 0 siblings, 0 replies; 8+ messages in thread From: Manuel Lauss @ 2009-01-30 16:56 UTC (permalink / raw) To: Ralf Baechle; +Cc: linux-mips On Fri, 30 Jan 2009 14:03:09 +0000 Ralf Baechle <ralf@linux-mips.org> wrote: > On Fri, Jan 30, 2009 at 08:44:07AM +0100, Manuel Lauss wrote: > > > Can't build kernel because gcc-4.3.3 comes up with this gem: > > > > CC arch/mips/kernel/traps.o > > cc1: warnings being treated as errors > > /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': > > /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments > > > > The fastest fix is the patch below, but I don't know whether it is > > the right thing to do. > > Is this new with 4.3.3? I've not ran into this problem with 4.3.2 so far. > Or it could be configuration dependent ... So far I see this only with 4.3.3 on various archs. > This seems a gcc bug so could you extract a test case and file a gcc bug > report? Done. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39044 -- ml. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [SOLVED] Re: GCC-4.3.3 sillyness 2009-01-30 7:44 GCC-4.3.3 sillyness Manuel Lauss 2009-01-30 8:23 ` Geert Uytterhoeven 2009-01-30 14:03 ` Ralf Baechle @ 2009-01-31 7:59 ` Manuel Lauss 2009-02-25 5:13 ` Kumba 2 siblings, 1 reply; 8+ messages in thread From: Manuel Lauss @ 2009-01-31 7:59 UTC (permalink / raw) To: Ralf Baechle, Geert Uytterhoeven; +Cc: linux-mips On Fri, 30 Jan 2009 08:44:07 +0100 Manuel Lauss <mano@roarinelk.homelinux.net> wrote: > Hello, > > Can't build kernel because gcc-4.3.3 comes up with this gem: > > CC arch/mips/kernel/traps.o > cc1: warnings being treated as errors > /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': > /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments Turns out Gentoo applied a patch (from Debian) which unconditionally enables -Wformat-security (which is responsible for the warning). Sorry for the noise! Manuel Lauss ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [SOLVED] Re: GCC-4.3.3 sillyness 2009-01-31 7:59 ` [SOLVED] " Manuel Lauss @ 2009-02-25 5:13 ` Kumba 2009-02-26 2:48 ` Kumba 0 siblings, 1 reply; 8+ messages in thread From: Kumba @ 2009-02-25 5:13 UTC (permalink / raw) To: Manuel Lauss; +Cc: Ralf Baechle, Geert Uytterhoeven, linux-mips [-- Attachment #1: Type: text/plain, Size: 1250 bytes --] Manuel Lauss wrote: > On Fri, 30 Jan 2009 08:44:07 +0100 > Manuel Lauss <mano@roarinelk.homelinux.net> wrote: > >> Hello, >> >> Can't build kernel because gcc-4.3.3 comes up with this gem: >> >> CC arch/mips/kernel/traps.o >> cc1: warnings being treated as errors >> /linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler': >> /linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string literal and no format arguments > > Turns out Gentoo applied a patch (from Debian) which unconditionally > enables -Wformat-security (which is responsible for the warning). Yeah, I did some digging and it looks like we added a patch called "10_all_gcc-default-format-security.patch" into our gcc-4.3.3 ebuild. The patch claims it was ripped from Debian; can any Debian devs comment on whether you guys still use this patch and what the idea behind it is? I'm not sure if I'll find any discussion on our end as to why it's included without finding Mike (vapier) around. -- Joshua Kinard Gentoo/MIPS kumba@gentoo.org "The past tempts us, the present confuses us, the future frightens us. And our lives slip away, moment by moment, lost in that vast, terrible in-between." --Emperor Turhan, Centauri Republic [-- Attachment #2: 10_all_gcc-default-format-security.patch --] [-- Type: text/plain, Size: 1663 bytes --] ripped from Debian # DP: Turn on -Wformat -Wformat-security by default for C, C++, ObjC, ObjC++. --- gcc/c-common.c +++ gcc/c-common.c @@ -277,7 +277,7 @@ /* Warn about format/argument anomalies in calls to formatted I/O functions (*printf, *scanf, strftime, strfmon, etc.). */ -int warn_format; +int warn_format = 1; /* Warn about using __null (as NULL in C++) as sentinel. For code compiled with GCC this doesn't matter as __null is guaranteed to have the right --- gcc/c.opt +++ gcc/c.opt @@ -228,7 +228,7 @@ Warn about format strings that contain NUL bytes Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) Warning +C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning Warn about possible security problems with format functions Wformat-y2k --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -2802,6 +2802,9 @@ @option{-Wformat-nonliteral}, @option{-Wformat-security}, and @option{-Wformat=2} are available, but are not included in @option{-Wall}. +NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++. +To disable, use @option{-Wformat=0}. + @item -Wformat-y2k @opindex Wformat-y2k @opindex Wno-format-y2k @@ -2849,6 +2852,11 @@ in future warnings may be added to @option{-Wformat-security} that are not included in @option{-Wformat-nonliteral}.) +NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++. +To disable, use @option{-Wno-format-security}, or disable all format warnings +with @option{-Wformat=0}. To make format security warnings fatal, specify +@option{-Werror=format-security}. + @item -Wformat=2 @opindex Wformat=2 @opindex Wno-format=2 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [SOLVED] Re: GCC-4.3.3 sillyness 2009-02-25 5:13 ` Kumba @ 2009-02-26 2:48 ` Kumba 0 siblings, 0 replies; 8+ messages in thread From: Kumba @ 2009-02-26 2:48 UTC (permalink / raw) To: Manuel Lauss; +Cc: Ralf Baechle, Geert Uytterhoeven, linux-mips Kumba wrote: > > Yeah, I did some digging and it looks like we added a patch called > "10_all_gcc-default-format-security.patch" into our gcc-4.3.3 ebuild. > The patch claims it was ripped from Debian; can any Debian devs comment > on whether you guys still use this patch and what the idea behind it > is? I'm not sure if I'll find any discussion on our end as to why it's > included without finding Mike (vapier) around. Looks like Gentoo and Debian aren't alone. This was discussed on lkml because other mainstream distros are enabling it as a default as well, so the proposed solution is to just disable the format check in the kernel: http://lkml.org/lkml/2009/2/4/259 -- Joshua Kinard Gentoo/MIPS kumba@gentoo.org "The past tempts us, the present confuses us, the future frightens us. And our lives slip away, moment by moment, lost in that vast, terrible in-between." --Emperor Turhan, Centauri Republic ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-02-26 2:49 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-01-30 7:44 GCC-4.3.3 sillyness Manuel Lauss 2009-01-30 8:23 ` Geert Uytterhoeven 2009-01-30 8:55 ` Manuel Lauss 2009-01-30 14:03 ` Ralf Baechle 2009-01-30 16:56 ` Manuel Lauss 2009-01-31 7:59 ` [SOLVED] " Manuel Lauss 2009-02-25 5:13 ` Kumba 2009-02-26 2:48 ` Kumba
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.