Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1542949
| From | Greg KH <greg@kroah.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant |
| Date | 2016-12-15 19:00 +0100 |
| Message-ID | <sOItX-km-9@gated-at.bofh.it> (permalink) |
| References | <sOmMO-1X4-21@gated-at.bofh.it> <sOmWt-229-5@gated-at.bofh.it> <sOovg-3SD-43@gated-at.bofh.it> <sOoOB-49J-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 them as "const" to make it harder for someone
> > > to change where the variables point to.
> >
> > You're not preventing change of where they point to, but rather
> > preventing modification of the pointed-to data through these
> > pointers...
> >
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > > drivers/macintosh/windfarm_core.c | 2 +-
> > > drivers/net/hamradio/baycom_epp.c | 2 +-
> > > drivers/pnp/pnpbios/core.c | 5 +++--
> > > drivers/staging/greybus/svc_watchdog.c | 4 ++--
> > > drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 +++---
> > > fs/nfsd/nfs4layouts.c | 6 ++++--
> > > security/keys/request_key.c | 7 ++++---
> > > 7 files changed, 18 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
> > > index 465d770ab0bb..1b317cbb73cf 100644
> > > --- a/drivers/macintosh/windfarm_core.c
> > > +++ b/drivers/macintosh/windfarm_core.c
> > > @@ -74,7 +74,7 @@ static inline void wf_notify(int event, void *param)
> > >
> > > static int wf_critical_overtemp(void)
> > > {
> > > - static char * critical_overtemp_path = "/sbin/critical_overtemp";
> > > + static const char * critical_overtemp_path = "/sbin/critical_overtemp";
> >
> > Should be static char *const critical_overtemp_path, or if you prefer
> > static const char *const critical_overtemp_path (since the pointed-to
> > data is not modifiable either). Likewise elsewhere.
>
> argh, ok, I failed here, thanks for that, that's what I get for writing
> code on an airplane...
>
> let me rework this, I also want to make argv and env static too, just
> for good measure.
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 can tell.
But, if I do:
static char const char critical_overtemp_path[] = "/sbin/critical_overtemp";
then sparse complains to me about:
warning: duplicate const
Is that just sparse being dense, or is the latter one really better
here? It seems that both of the above put the data and variable into
the same segment (.rodata).
thanks,
greg k-h
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 0/4] make call_usermodehelper a bit more "safe" Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 19:50 +0100
[PATCH 1/4] kmod: make usermodehelper path a const string Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 20:00 +0100
[PATCH 3/4] Make static usermode helper binaries constant Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 20:00 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 20:20 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Rich Felker <dalias@libc.org> - 2016-12-14 21:40 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Greg KH <greg@kroah.com> - 2016-12-14 22:00 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Greg KH <greg@kroah.com> - 2016-12-15 19:00 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Daniel Micay <danielmicay@gmail.com> - 2016-12-15 22:00 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Greg KH <gregkh@linuxfoundation.org> - 2016-12-15 22:20 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Daniel Micay <danielmicay@gmail.com> - 2016-12-16 01:10 +0100
Re: [kernel-hardening] [PATCH 3/4] Make static usermode helper binaries constant Daniel Micay <danielmicay@gmail.com> - 2016-12-16 01:30 +0100
[RFC 4/4] Introduce CONFIG_READONLY_USERMODEHELPER Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 20:00 +0100
Re: [RFC 4/4] Introduce CONFIG_READONLY_USERMODEHELPER Kees Cook <keescook@chromium.org> - 2016-12-14 21:40 +0100
Re: [RFC 4/4] Introduce CONFIG_READONLY_USERMODEHELPER Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 22:10 +0100
[PATCH 2/4] drbd: rename "usermode_helper" to "drbd_usermode_helper" Greg KH <gregkh@linuxfoundation.org> - 2016-12-14 20:00 +0100
Re: [kernel-hardening] [RFC 0/4] make call_usermodehelper a bit more "safe" Mark Rutland <mark.rutland@arm.com> - 2016-12-14 20:30 +0100
Re: [kernel-hardening] [RFC 0/4] make call_usermodehelper a bit more "safe" Kees Cook <keescook@chromium.org> - 2016-12-14 21:20 +0100
Re: [kernel-hardening] [RFC 0/4] make call_usermodehelper a bit more "safe" "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-14 22:30 +0100
Re: [kernel-hardening] [RFC 0/4] make call_usermodehelper a bit more "safe" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-15 00:20 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" NeilBrown <neilb@suse.com> - 2016-12-16 02:10 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Greg KH <gregkh@linuxfoundation.org> - 2016-12-16 14:00 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Jiri Kosina <jikos@kernel.org> - 2016-12-19 14:40 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Greg KH <gregkh@linuxfoundation.org> - 2016-12-20 10:30 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Jiri Kosina <jikos@kernel.org> - 2016-12-20 11:30 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Jiri Kosina <jikos@kernel.org> - 2016-12-20 11:40 +0100
Re: [RFC 0/4] make call_usermodehelper a bit more "safe" Greg KH <gregkh@linuxfoundation.org> - 2016-12-20 11:50 +0100
csiph-web