All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	andrew@lunn.ch, Jason Cooper <jason@lakedaemon.net>,
	rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	gregory.clement@free-electrons.com,
	Bhumika Goyal <bhumirks@gmail.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops
Date: Wed, 4 Jan 2017 13:53:55 -0800	[thread overview]
Message-ID: <CAGXu5jLe6RNa6xrefB--w3M+ECRkMMDZWoyAOp5gA1h6W-1vMA@mail.gmail.com> (raw)
In-Reply-To: <20170104130628.GQ14217@n2100.armlinux.org.uk>

On Wed, Jan 4, 2017 at 5:06 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Wed, Jan 04, 2017 at 01:23:41PM +0100, Julia Lawall wrote:
>> Basically, the strategy of the patch is that one may consider it
>> preferable to duplicate the structure for the different alternatives,
>> rather than use __ro_after_init.  Perhaps if the structure were larger,
>> then __ro_after_init would be a better choice?
>
> It depends on not just the size, but how many members need to be
> modified, and obviously whether there are likely to be more than one
> user of the structure as well.
>
> So I'd say __ro_after_init rarely makes sense for an operations
> structure - the only case I can see is:
>
> - a large structure
> - only a small number of elements need to be modified
> - it is only single-use
>
> which is probably quite rare - this one falls into two out of those
> three.
>
> There's another consideration (imho) too - we may wish, at a later
> date, to make .text and .rodata both read-only from the start of the
> kernel to harden the kernel against possibly init-time exploitation.
> (Think about a buggy built-in driver with emulated hardware - much the
> same problem that Kees is trying to address in one of his recent patch
> sets but with hotplugged hardware while a screen-saver is active.)
> Having function pointers in .rodata rather than the ro-after-init
> section would provide better protection.

Agreed: I'd much prefer things just be const. :) As to my confusing
question, I hadn't looked at how where the pointers to the structure
was being stored, so I was just asking if it, too, could be const,
which it can't, and that's fine here.

-Kees

-- 
Kees Cook
Nexus Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	andrew@lunn.ch, Jason Cooper <jason@lakedaemon.net>,
	rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	gregory.clement@free-electrons.com,
	Bhumika Goyal <bhumirks@gmail.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: [rtc-linux] Re: [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops
Date: Wed, 4 Jan 2017 13:53:55 -0800	[thread overview]
Message-ID: <CAGXu5jLe6RNa6xrefB--w3M+ECRkMMDZWoyAOp5gA1h6W-1vMA@mail.gmail.com> (raw)
In-Reply-To: <20170104130628.GQ14217@n2100.armlinux.org.uk>

On Wed, Jan 4, 2017 at 5:06 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Wed, Jan 04, 2017 at 01:23:41PM +0100, Julia Lawall wrote:
>> Basically, the strategy of the patch is that one may consider it
>> preferable to duplicate the structure for the different alternatives,
>> rather than use __ro_after_init.  Perhaps if the structure were larger,
>> then __ro_after_init would be a better choice?
>
> It depends on not just the size, but how many members need to be
> modified, and obviously whether there are likely to be more than one
> user of the structure as well.
>
> So I'd say __ro_after_init rarely makes sense for an operations
> structure - the only case I can see is:
>
> - a large structure
> - only a small number of elements need to be modified
> - it is only single-use
>
> which is probably quite rare - this one falls into two out of those
> three.
>
> There's another consideration (imho) too - we may wish, at a later
> date, to make .text and .rodata both read-only from the start of the
> kernel to harden the kernel against possibly init-time exploitation.
> (Think about a buggy built-in driver with emulated hardware - much the
> same problem that Kees is trying to address in one of his recent patch
> sets but with hotplugged hardware while a screen-saver is active.)
> Having function pointers in .rodata rather than the ro-after-init
> section would provide better protection.

Agreed: I'd much prefer things just be const. :) As to my confusing
question, I hadn't looked at how where the pointers to the structure
was being stored, so I was just asking if it, too, could be const,
which it can't, and that's fine here.

-Kees

-- 
Kees Cook
Nexus Security

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: keescook@chromium.org (Kees Cook)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops
Date: Wed, 4 Jan 2017 13:53:55 -0800	[thread overview]
Message-ID: <CAGXu5jLe6RNa6xrefB--w3M+ECRkMMDZWoyAOp5gA1h6W-1vMA@mail.gmail.com> (raw)
In-Reply-To: <20170104130628.GQ14217@n2100.armlinux.org.uk>

On Wed, Jan 4, 2017 at 5:06 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Wed, Jan 04, 2017 at 01:23:41PM +0100, Julia Lawall wrote:
>> Basically, the strategy of the patch is that one may consider it
>> preferable to duplicate the structure for the different alternatives,
>> rather than use __ro_after_init.  Perhaps if the structure were larger,
>> then __ro_after_init would be a better choice?
>
> It depends on not just the size, but how many members need to be
> modified, and obviously whether there are likely to be more than one
> user of the structure as well.
>
> So I'd say __ro_after_init rarely makes sense for an operations
> structure - the only case I can see is:
>
> - a large structure
> - only a small number of elements need to be modified
> - it is only single-use
>
> which is probably quite rare - this one falls into two out of those
> three.
>
> There's another consideration (imho) too - we may wish, at a later
> date, to make .text and .rodata both read-only from the start of the
> kernel to harden the kernel against possibly init-time exploitation.
> (Think about a buggy built-in driver with emulated hardware - much the
> same problem that Kees is trying to address in one of his recent patch
> sets but with hotplugged hardware while a screen-saver is active.)
> Having function pointers in .rodata rather than the ro-after-init
> section would provide better protection.

Agreed: I'd much prefer things just be const. :) As to my confusing
question, I hadn't looked at how where the pointers to the structure
was being stored, so I was just asking if it, too, could be const,
which it can't, and that's fine here.

-Kees

-- 
Kees Cook
Nexus Security

  parent reply	other threads:[~2017-01-04 21:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 11:31 [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops Bhumika Goyal
2016-12-26 11:31 ` Bhumika Goyal
2016-12-26 11:31 ` [rtc-linux] " Bhumika Goyal
2017-01-02 14:06 ` Russell King - ARM Linux
2017-01-02 14:06   ` Russell King - ARM Linux
2017-01-02 14:06   ` [rtc-linux] " Russell King - ARM Linux
2017-01-03 21:18   ` Kees Cook
2017-01-03 21:18     ` Kees Cook
2017-01-03 21:18     ` [rtc-linux] " Kees Cook
2017-01-03 21:31     ` Russell King - ARM Linux
2017-01-03 21:31       ` Russell King - ARM Linux
2017-01-03 21:31       ` [rtc-linux] " Russell King - ARM Linux
2017-01-03 21:54       ` Russell King - ARM Linux
2017-01-03 21:54         ` Russell King - ARM Linux
2017-01-03 21:54         ` [rtc-linux] " Russell King - ARM Linux
2017-01-04 10:57         ` Julia Lawall
2017-01-04 10:57           ` Julia Lawall
2017-01-04 10:57           ` [rtc-linux] " Julia Lawall
2017-01-04 11:07           ` Alexandre Belloni
2017-01-04 11:07             ` Alexandre Belloni
2017-01-04 11:07             ` [rtc-linux] " Alexandre Belloni
2017-01-04 11:43             ` Julia Lawall
2017-01-04 11:43               ` Julia Lawall
2017-01-04 11:43               ` [rtc-linux] " Julia Lawall
2017-01-04 12:14               ` Russell King - ARM Linux
2017-01-04 12:14                 ` Russell King - ARM Linux
2017-01-04 12:14                 ` [rtc-linux] " Russell King - ARM Linux
2017-01-04 12:23                 ` Julia Lawall
2017-01-04 12:23                   ` Julia Lawall
2017-01-04 12:23                   ` [rtc-linux] " Julia Lawall
2017-01-04 13:06                   ` Russell King - ARM Linux
2017-01-04 13:06                     ` Russell King - ARM Linux
2017-01-04 13:06                     ` [rtc-linux] " Russell King - ARM Linux
2017-01-04 13:41                     ` Julia Lawall
2017-01-04 13:41                       ` Julia Lawall
2017-01-04 13:41                       ` [rtc-linux] " Julia Lawall
2017-01-04 21:53                     ` Kees Cook [this message]
2017-01-04 21:53                       ` Kees Cook
2017-01-04 21:53                       ` [rtc-linux] " Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGXu5jLe6RNa6xrefB--w3M+ECRkMMDZWoyAOp5gA1h6W-1vMA@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=bhumirks@gmail.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=rtc-linux@googlegroups.com \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.