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


Groups > linux.kernel > #1265207 > unrolled thread

[PATCH] video: constify geode ops structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2015-11-08 22:50 +0100
Last post2015-11-10 23:50 +0100
Articles 7 on this page of 27 — 8 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] video: constify geode ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2015-11-08 22:50 +0100
    Re: [PATCH] video: constify geode ops structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-08 23:20 +0100
      Re: [PATCH] video: constify geode ops structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-08 23:30 +0100
        Re: [PATCH] video: constify geode ops structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-09 06:50 +0100
          Re: [PATCH] video: constify geode ops structures Joe Perches <joe@perches.com> - 2015-11-09 07:10 +0100
          Re: [PATCH] video: constify geode ops structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-09 07:50 +0100
            Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-09 14:40 +0100
              Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-09 19:20 +0100
                Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Joe Perches <joe@perches.com> - 2015-11-09 19:20 +0100
          Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-09 15:00 +0100
            Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-09 16:00 +0100
              Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-09 17:40 +0100
              Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Emese Revfy <re.emese@gmail.com> - 2015-11-09 18:10 +0100
                Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-09 18:50 +0100
                  Re: [kernel-hardening] Re: [PATCH] video: constify geode ops structures Kees Cook <keescook@chromium.org> - 2015-11-09 22:30 +0100
                    Re: [kernel-hardening] Re: [PATCH] video: constify geode ops  structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-09 23:00 +0100
                      Re: [kernel-hardening] Re: [PATCH] video: constify geode ops structures Kees Cook <keescook@chromium.org> - 2015-11-10 00:40 +0100
                        Re: [kernel-hardening] Re: [PATCH] video: constify geode ops structures "PaX Team" <pageexec@freemail.hu> - 2015-11-10 02:40 +0100
          Re: [PATCH] video: constify geode ops structures Julia Lawall <julia.lawall@lip6.fr> - 2015-11-10 16:50 +0100
      Re: [PATCH] video: constify geode ops structures Kees Cook <keescook@chromium.org> - 2015-11-09 22:30 +0100
        Re: [PATCH] video: constify geode ops structures Christoph Hellwig <hch@infradead.org> - 2015-11-10 07:40 +0100
          Re: [PATCH] video: constify geode ops structures Kees Cook <keescook@chromium.org> - 2015-11-10 21:40 +0100
            Re: [PATCH] video: constify geode ops structures Joe Perches <joe@perches.com> - 2015-11-10 21:50 +0100
              Re: [PATCH] video: constify geode ops structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-10 23:10 +0100
                Re: [PATCH] video: constify geode ops structures Joe Perches <joe@perches.com> - 2015-11-10 23:20 +0100
                  Re: [PATCH] video: constify geode ops structures Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-10 23:40 +0100
                    Re: [PATCH] video: constify geode ops structures Joe Perches <joe@perches.com> - 2015-11-10 23:50 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1266276

FromChristoph Hellwig <hch@infradead.org>
Date2015-11-10 07:40 +0100
Message-ID<qtaKZ-1sI-13@gated-at.bofh.it>
In reply to#1266033
On Mon, Nov 09, 2015 at 01:20:12PM -0800, Kees Cook wrote:
> Just to remind everyone: while we certainly want to clean these up in
> the code where possible, we still want to make the constification
> plugin part of the regular builds. We want to provide a
> secure-by-default build, even when vendors are adding their own
> out-of-tree code when producing Linux-based products. So, we'll always
> want to have the plugin as a back-stop for out-of-tree code, or places
> where const was accidentally missed upstream.

Who is 'we'?  While a plugin like this that warns would be very ueful
I strongly disagree with bloating the kernel tree with any infrastructure
primarily aimed at out of tree code.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266772

FromKees Cook <keescook@chromium.org>
Date2015-11-10 21:40 +0100
Message-ID<qtnRU-1s0-25@gated-at.bofh.it>
In reply to#1266276
On Mon, Nov 9, 2015 at 10:38 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, Nov 09, 2015 at 01:20:12PM -0800, Kees Cook wrote:
>> Just to remind everyone: while we certainly want to clean these up in
>> the code where possible, we still want to make the constification
>> plugin part of the regular builds. We want to provide a
>> secure-by-default build, even when vendors are adding their own
>> out-of-tree code when producing Linux-based products. So, we'll always
>> want to have the plugin as a back-stop for out-of-tree code, or places
>> where const was accidentally missed upstream.
>
> Who is 'we'?  While a plugin like this that warns would be very ueful

I understand "we" here to mean people interested in the proactive
defense of the Linux kernel, and by extension the Linux kernel
community as a whole. :)

> I strongly disagree with bloating the kernel tree with any infrastructure
> primarily aimed at out of tree code.

It's not "primarily aimed at out of tree code", that is simply an
additional side-effect (though the need must be recognized: a billion
android devices, and none of them are running a stock kernel). What it
gets us is _coverage_. We can't make everything work just by static
analyzers and checkpatch.pl runs (meaning the "backstop" comment
above).

Additionally, having the plugin infrastructure gets us the ability to
do things that aren't presently possible (see the thread on the
initify plugin, which can't be done in source alone).

-Kees

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

[toc] | [prev] | [next] | [standalone]


#1266780

FromJoe Perches <joe@perches.com>
Date2015-11-10 21:50 +0100
Message-ID<qto1A-1vO-23@gated-at.bofh.it>
In reply to#1266772
On Tue, 2015-11-10 at 12:34 -0800, Kees Cook wrote:
> We can't make everything work just by static
> analyzers and checkpatch.pl runs (meaning the "backstop" comment
> above).
> 
> Additionally, having the plugin infrastructure gets us the ability to
> do things that aren't presently possible (see the thread on the
> initify plugin, which can't be done in source alone).

#define __do_const __attribute__((do_const))
...
#ifndef __do_const
#define __do_const
#endif

I think it's always better for the reader to know that a
const struct declaration is used over a non-const struct
when the compiler, via plug-in extension, could convert
the declaration to const.

Is there a warning/info message produced by gcc and the
plug-in when a non-const declaration is converted to
const because of this attribute?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266813

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-11-10 23:10 +0100
Message-ID<qtph1-2up-19@gated-at.bofh.it>
In reply to#1266780
On Tue, Nov 10, 2015 at 12:49:29PM -0800, Joe Perches wrote:
> Is there a warning/info message produced by gcc and the
> plug-in when a non-const declaration is converted to
> const because of this attribute?

I'm not sure I understand the question.  What would the warning say?

We'll hopefully automatically make over 3000 structs const.  I
understand warning that people should make structs const when possible
but I don't understand why we would want to remove auto consting?

Putting __do_const in the .h file is basically the same as marking
every struct of that type as const in the .c file.  The errors are
caught at compile time.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266818

FromJoe Perches <joe@perches.com>
Date2015-11-10 23:20 +0100
Message-ID<qtpqG-2y4-11@gated-at.bofh.it>
In reply to#1266813
On Wed, 2015-11-11 at 01:02 +0300, Dan Carpenter wrote:
> On Tue, Nov 10, 2015 at 12:49:29PM -0800, Joe Perches wrote:
> > Is there a warning/info message produced by gcc and the
> > plug-in when a non-const declaration is converted to
> > const because of this attribute?
> 
> I'm not sure I understand the question.  What would the warning say?

Perhaps something like:

declaration of struct <foo> converted to const by __attribute__((do_const))

> We'll hopefully automatically make over 3000 structs const.  I
> understand warning that people should make structs const when possible
> but I don't understand why we would want to remove auto consting?

I'm not suggesting removing the attribute.
It seems sensible enough.

I just think the plug-in should at least optionally
note the instances when non-const declarations are
converted to const.

> Putting __do_const in the .h file is basically the same as marking
> every struct of that type as const in the .c file.

Not for a reader of the code that doesn't first
inspect the header files.

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

[toc] | [prev] | [next] | [standalone]


#1266828

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-11-10 23:40 +0100
Message-ID<qtpK2-2FJ-33@gated-at.bofh.it>
In reply to#1266818
On Tue, Nov 10, 2015 at 02:17:12PM -0800, Joe Perches wrote:
> On Wed, 2015-11-11 at 01:02 +0300, Dan Carpenter wrote:
> > On Tue, Nov 10, 2015 at 12:49:29PM -0800, Joe Perches wrote:
> > > Is there a warning/info message produced by gcc and the
> > > plug-in when a non-const declaration is converted to
> > > const because of this attribute?
> > 
> > I'm not sure I understand the question.  What would the warning say?
> 
> Perhaps something like:
> 
> declaration of struct <foo> converted to const by __attribute__((do_const))

No one will ever think to turn on that output.  By the time they think
of turning it on, it means they have already figured out the issue.

regards,
dan carpenter

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

[toc] | [prev] | [next] | [standalone]


#1266837

FromJoe Perches <joe@perches.com>
Date2015-11-10 23:50 +0100
Message-ID<qtpTI-2Jl-27@gated-at.bofh.it>
In reply to#1266828
On Wed, 2015-11-11 at 01:34 +0300, Dan Carpenter wrote:
> On Tue, Nov 10, 2015 at 02:17:12PM -0800, Joe Perches wrote:
> > On Wed, 2015-11-11 at 01:02 +0300, Dan Carpenter wrote:
> > > On Tue, Nov 10, 2015 at 12:49:29PM -0800, Joe Perches wrote:
> > > > Is there a warning/info message produced by gcc and the
> > > > plug-in when a non-const declaration is converted to
> > > > const because of this attribute?
> > > 
> > > I'm not sure I understand the question.  What would the warning
> > > say?
> > 
> > Perhaps something like:
> > 
> > declaration of struct <foo> converted to const by
> > __attribute__((do_const))
> 
> No one will ever think to turn on that output.  By the time they think
> of turning it on, it means they have already figured out the issue.

Dubious assertion.

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

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web