Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501904

Re: [PATCH 01/12] extarray: define helpers for arrays defined in linker scripts

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 01/12] extarray: define helpers for arrays defined in linker scripts
Date 2016-10-17 13:50 +0200
Message-ID <steAx-2Ua-9@gated-at.bofh.it> (permalink)
References (1 earlier) <ssVxT-7xJ-3@gated-at.bofh.it> <stbCF-15W-21@gated-at.bofh.it> <stc5H-1vh-3@gated-at.bofh.it> <stc5H-1vh-5@gated-at.bofh.it> <stehb-2NB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Oct 17, 2016 at 01:27:08PM +0200, Vegard Nossum wrote:
> On 10/17/2016 11:09 AM, Peter Zijlstra wrote:
> >On Mon, Oct 17, 2016 at 11:01:13AM +0200, Jiri Slaby wrote:
> >>On the top of that, it's incorrect C according to the standard.
> >
> >According to the standard non of the kernel has any chance in hell of
> >working, so don't pretend you care about that :-)
> 
> I think that's a bit of a false dilemma. It's obviously true that kernel
> code does not conform to the standards, but that doesn't mean it's not
> something we should strive towards or care about in general. It helps
> static analysis tools, compiler diversity, etc.

Sure, but this, two separately allocated objects their address should
not be compared and therefore... stuff is explicitly relied upon by the
kernel in many places.

We have workarounds in various places, and this patch adds yet another
instance of it.

The workaround is simply confusing the compiler enough to have it not do
the 'optimization'. But we very much still rely on this 'undefined'
behaviour.

I think it makes more sense to explicitly allow it than to obfuscate our
code and run the risk a future compiler will see through our tricks.

I don't see how its different than explicitly disabling the
strict-aliasing muck, explicitly allowing (and 'defining') signed and
pointer overflow, doing all the concurrency stuff on our own (gnu89
emphatically does _not_ have a memory model) etc..

And given GCC7 is still in development, this might be a good time to get
a knob added for our benefit.

Are we 'modifying' the C language, sure, but that ship has sailed long
ago.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/12] external array access helpers Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 17:30 +0200
  [PATCH 07/12] tracing: declare __{start,stop}_ftrace_enum_maps as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 17:30 +0200
  [PATCH 01/12] extarray: define helpers for arrays defined in linker scripts Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 17:30 +0200
    Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-17 09:10 +0200
    Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-17 10:40 +0200
      Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Jiri Slaby <jslaby@suse.cz> - 2016-10-17 11:10 +0200
        Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-17 11:10 +0200
          Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-17 13:30 +0200
            Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-17 13:50 +0200
              Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-18 10:10 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-10-18 23:20 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Richard Biener <rguenther@suse.de> - 2016-10-19 16:30 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-19 16:40 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Richard Biener <rguenther@suse.de> - 2016-10-19 18:00 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-19 18:10 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Richard Biener <rguenther@suse.de> - 2016-10-19 17:10 +0200
                Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Peter Zijlstra <peterz@infradead.org> - 2016-10-19 18:20 +0200
              Re: [PATCH 01/12] extarray: define helpers for arrays defined in  linker scripts Jiri Slaby <jslaby@suse.cz> - 2016-10-19 16:50 +0200
  [PATCH 12/12] dynamic debug: declare table as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 17:30 +0200
  [PATCH 10/12] serial_core: declare __earlycon_table{,_end} as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 18:00 +0200
  [PATCH 08/12] tracing: declare __trace_bprintk_fmt/__tracepoint_str as external arrays Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 18:00 +0200
  [PATCH 09/12] tracing: declare __{start,stop}_syscalls_metadata as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 18:20 +0200
  Re: [PATCH 00/12] external array access helpers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-16 18:20 +0200
    Re: [PATCH 00/12] external array access helpers Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 19:30 +0200
      Re: [PATCH 00/12] external array access helpers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-17 09:10 +0200
    Re: [PATCH 00/12] external array access helpers Jiri Slaby <jslaby@suse.cz> - 2016-10-17 08:30 +0200

csiph-web