lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5j+6Rf-z2U8LdZK-hqPSXFphX0aUSrbYwFXriGwsdcZweQ@mail.gmail.com>
Date:	Fri, 26 Jun 2015 10:47:12 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Fengguang Wu <fengguang.wu@...el.com>,
	Bryan Wu <cooloney@...il.com>,
	Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
	Sakari Ailus <sakari.ailus@....fi>,
	Richard Purdie <rpurdie@...ys.net>,
	Linux LED Subsystem <linux-leds@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Christopher Li <sparse@...isli.org>
Subject: Re: [PATCH v3] led/led-class: Handle LEDs with the same name

On Fri, Jun 26, 2015 at 2:19 AM, Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
> On Tue, Jun 9, 2015 at 12:55 AM, Kees Cook <keescook@...omium.org> wrote:
>>> commit 95420c349194d1b570270ba1b1567d85461761c3
>>> Author:     Kees Cook <keescook@...omium.org>
>>> AuthorDate: Mon Sep 16 11:15:54 2013 -0700
>>> Commit:     Kees Cook <keescook@...omium.org>
>>> CommitDate: Wed Mar 4 14:07:18 2015 -0800
>>>
>>>     Make all format string problems fail the build
>>>
>>>     In an effort to stop format strings from leaking into various callers,
>>>     have gcc stop the build when this gets detected.
>>>
>>>     Signed-off-by: Kees Cook <keescook@...omium.org>
>>>
>>> diff --git a/Makefile b/Makefile
>>> index e6a9b1b..b7684d2 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -402,7 +402,6 @@ KBUILD_CPPFLAGS := -D__KERNEL__
>>>  KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>>>                    -fno-strict-aliasing -fno-common \
>>>                    -Werror-implicit-function-declaration \
>>> -                  -Wno-format-security \
>>>                    -std=gnu89
>>>
>>>  KBUILD_AFLAGS_KERNEL :=
>>> @@ -752,6 +751,11 @@ endif
>>>  NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
>>>  CHECKFLAGS     += $(NOSTDINC_FLAGS)
>>>
>>> +# Enable format-security when it can stop the build, otherwise disable.
>>> +KBUILD_CFLAGS  += $(call cc-option,\
>>> +                       -Wformat -Wformat-security -Werror=format-security,\
>>> +                       -Wno-format-security)
>>> +
>>>  # warn about C99 declaration after statement
>>>  KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
>>>
>>
>> The trouble is that gcc still has a terrible time with false positives
>> on these warnings. It doesn't know to silence const char strings. For
>> example:
>>
>> const char * version = "SomeThing driver v1.3\n";
>
> While the contents of the string are const, the pointer isn't...
>
>> ...
>> printk(version);
>
> ... hence gcc cannot be sure version hasn't been changed to point
> to something different.
>
>> We don't care about this, since the string is not dynamic, but gcc
>> still warns. My intention is that when gcc fixes this bug, then I'd
>> upstream this patch. Right now I have to carry a patch to silence
>> false positives. :(
>
> Does it help if you change it to:
>
>     const char * const version = "SomeThing driver v1.3\n";

Nope. :(

Here's what I use when examining gcc's behavior:

https://gist.github.com/kees/e561143ba0bd0ca163bc

-Kees

>
> ???
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-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



-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ