Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265368
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] video: constify geode ops structures |
| Date | 2015-11-09 06:50 +0100 |
| Message-ID | <qsNv4-2fT-5@gated-at.bofh.it> (permalink) |
| References | <qsG0y-5Ac-15@gated-at.bofh.it> <qsGtz-61G-7@gated-at.bofh.it> <qsGDh-69c-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Sun, Nov 08, 2015 at 10:24:49PM +0000, Julia Lawall wrote: > On Mon, 9 Nov 2015, Dan Carpenter wrote: > > > Cool. So, in grsec they use a GCC plugin to make these const > > automatically since they only contain function pointers. There about > > 100 struct types marked as __no_const. Kees would like to adopt the > > grsec pluggin approach I expect. Do you have an idea how many structs > > only contain function pointers or how many consts we would have to add > > to get the same effect without the plugin? > > My list has 373 type names. In the list there are counts for good > (already const) and bad (not const). The sum of the bad values is 2467. > The list is below. > > julia Fantastic! Thanks. We could autogenerate the list of type names and make checkpatch.pl complain if we declared those types as non const. I ran this command to find which functions grsec marks as __no_const. egrep '(^ struct |^@@|__no_const;)' grsecurity-3.1-4.2.5-201511021814.patch | grep __no_const -B1 | grep -v __no_const | grep -v '^--' | cut -d @ -f 5- | cut -b 9- | cut -d ' ' -f 1 There are 60 structs declared as __no_const. For some structs they declare a no_const version and use it as needed. Like this: typedef struct net_device_ops __no_const net_device_ops_no_const; grep __no_const grsecurity-3.1-4.2.5-201511021814.patch | grep typedef | cut -d ' ' -f 3 There are 32 of those. Then I compared to see if their structs were on your list. For some reason there quite a few one their list which are not on yours. Out of the first 10 about half weren't on your list. cpu_cache_fns, outer_cache_fns, psci_operations, smp_operations, omap_hwmod_soc_ops, smp_ops_t. These are mostly different arches? Also bit_table has in int has well as a function pointers but it is on their list. I'm not sure why. Maybe they are marking structs const that I don't know about. The other trick that they do is they define structs as __do_const if they want them to be const by default, which is pretty neat. This feels like it should be a standard GCC feature. In the meantime we could mark things as __do_const and print a sparse warning if it was declared as not const. I have attached the list of __no_const structs. regards, dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[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
csiph-web