Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> So for statics, I think `static const char *` wins due to allowing > merging (although it doesn't matter here). For non-statics, you end up > with extra pointer constants. Those could get removed, but Linux > doesn't > have -fvisibility=hidden and I'm not sure how clever linkers are. > Maybe >

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> So for statics, I think `static const char *` wins due to allowing > merging (although it doesn't matter here). For non-statics, you end up > with extra pointer constants. Those could get removed, but Linux > doesn't > have -fvisibility=hidden and I'm not sure how clever linkers are. > Maybe >

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> Thanks for the explanation.  I don't think we need to worry about > merging these strings, but I'll keep it in mind. > > However, the "folklore" of the kernel was to never do: > char *foo = "bar"; > but instead do: > char foo[] = "bar"; > to save on the extra variable that the

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> Thanks for the explanation.  I don't think we need to worry about > merging these strings, but I'll keep it in mind. > > However, the "folklore" of the kernel was to never do: > char *foo = "bar"; > but instead do: > char foo[] = "bar"; > to save on the extra variable that the

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Greg KH
On Thu, Dec 15, 2016 at 03:51:01PM -0500, Daniel Micay wrote: > > To follow up on this, and after staring at too many outputs of the > > compiler, I think what this really should be is: > > static char const critical_overtemp_path[] = > > "/sbin/critical_overtemp"; > > right? > > > > That way

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Greg KH
On Thu, Dec 15, 2016 at 03:51:01PM -0500, Daniel Micay wrote: > > To follow up on this, and after staring at too many outputs of the > > compiler, I think what this really should be is: > > static char const critical_overtemp_path[] = > > "/sbin/critical_overtemp"; > > right? > > > > That way

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> To follow up on this, and after staring at too many outputs of the > compiler, I think what this really should be is: > static char const critical_overtemp_path[] = > "/sbin/critical_overtemp"; > right? > > That way both the variable, and the data, end up in read-only memory > from what I

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Daniel Micay
> To follow up on this, and after staring at too many outputs of the > compiler, I think what this really should be is: > static char const critical_overtemp_path[] = > "/sbin/critical_overtemp"; > right? > > That way both the variable, and the data, end up in read-only memory > from what I

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Greg KH
On Wed, Dec 14, 2016 at 12:54:44PM -0800, Greg KH wrote: > On Wed, Dec 14, 2016 at 03:29:52PM -0500, Rich Felker wrote: > > On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > > > > > There are a number of usermode helper binaries that are "hard coded" in > > > the kernel today, so mark

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-15 Thread Greg KH
On Wed, Dec 14, 2016 at 12:54:44PM -0800, Greg KH wrote: > On Wed, Dec 14, 2016 at 03:29:52PM -0500, Rich Felker wrote: > > On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > > > > > There are a number of usermode helper binaries that are "hard coded" in > > > the kernel today, so mark

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Greg KH
On Wed, Dec 14, 2016 at 03:29:52PM -0500, Rich Felker wrote: > On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > > > There are a number of usermode helper binaries that are "hard coded" in > > the kernel today, so mark them as "const" to make it harder for someone > > to change where

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Greg KH
On Wed, Dec 14, 2016 at 03:29:52PM -0500, Rich Felker wrote: > On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > > > There are a number of usermode helper binaries that are "hard coded" in > > the kernel today, so mark them as "const" to make it harder for someone > > to change where

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Rich Felker
On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > There are a number of usermode helper binaries that are "hard coded" in > the kernel today, so mark them as "const" to make it harder for someone > to change where the variables point to. You're not preventing change of where they

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Rich Felker
On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > There are a number of usermode helper binaries that are "hard coded" in > the kernel today, so mark them as "const" to make it harder for someone > to change where the variables point to. You're not preventing change of where they

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Greg KH
On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > There are a number of usermode helper binaries that are "hard coded" in > the kernel today, so mark them as "const" to make it harder for someone > to change where the variables point to. > > Signed-off-by: Greg Kroah-Hartman

Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant

2016-12-14 Thread Greg KH
On Wed, Dec 14, 2016 at 10:50:52AM -0800, Greg KH wrote: > > There are a number of usermode helper binaries that are "hard coded" in > the kernel today, so mark them as "const" to make it harder for someone > to change where the variables point to. > > Signed-off-by: Greg Kroah-Hartman > --- >