Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314221 > unrolled thread
| Started by | Bryan O'Donoghue <pure.logic@nexus-software.ie> |
|---|---|
| First post | 2016-01-21 15:20 +0100 |
| Last post | 2016-01-22 13:20 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86/intel/quark: Remove lock bit around kernel IMR Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-01-21 15:20 +0100
Re: [PATCH] x86/intel/quark: Remove lock bit around kernel IMR Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-01-21 19:50 +0100
Re: [PATCH] x86/intel/quark: Remove lock bit around kernel IMR Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-01-22 12:10 +0100
Re: [PATCH] x86/intel/quark: Remove lock bit around kernel IMR Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-01-22 13:20 +0100
| From | Bryan O'Donoghue <pure.logic@nexus-software.ie> |
|---|---|
| Date | 2016-01-21 15:20 +0100 |
| Subject | [PATCH] x86/intel/quark: Remove lock bit around kernel IMR |
| Message-ID | <qTofE-6n5-7@gated-at.bofh.it> |
Currently when setting up an IMR around the kernel .text area we lock that
IMR, preventing further modification. While superficially this appears to
be the right thing to do, in fact this doesn't account for a legitimate
change in the memory map such as when running through kexec. In such a
scenario a second kernel can have a different size and location to it's
predecessor and can view some of the memory occupied by its predecessor as
legitimately usable RAM. This RAM can then be allocated to DMA agents
within the system and trigger an IMR violation.
The solution to this situation is to keep the kernel .text section IMR lock
bit false. This means that a subsequent kernel will boot and can tear-down
an existing IMR, while still setting up an IMR around its own .text
section.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Reported-by: Andriy Shevchenko <andriy.shevchenko@intel.com>
---
arch/x86/platform/intel-quark/imr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/platform/intel-quark/imr.c b/arch/x86/platform/intel-quark/imr.c
index c1bdafa..1c43639 100644
--- a/arch/x86/platform/intel-quark/imr.c
+++ b/arch/x86/platform/intel-quark/imr.c
@@ -591,7 +591,7 @@ static void __init imr_fixup_memmap(struct imr_device *idev)
* from the beginning of the .text secton to the end of the
* .rodata section as one physically contiguous block.
*/
- ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, true);
+ ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, false);
if (ret < 0) {
pr_err("unable to setup IMR for kernel: (%p - %p)\n",
&_text, &__end_rodata);
--
2.5.0
[toc] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2016-01-21 19:50 +0100 |
| Message-ID | <qTssX-M0-19@gated-at.bofh.it> |
| In reply to | #1314221 |
On Thu, Jan 21, 2016 at 4:05 PM, Bryan O'Donoghue
<pure.logic@nexus-software.ie> wrote:
> Currently when setting up an IMR around the kernel .text area we lock that
> IMR, preventing further modification. While superficially this appears to
> be the right thing to do, in fact this doesn't account for a legitimate
> change in the memory map such as when running through kexec. In such a
> scenario a second kernel can have a different size and location to it's
> predecessor and can view some of the memory occupied by its predecessor as
> legitimately usable RAM. This RAM can then be allocated to DMA agents
> within the system and trigger an IMR violation.
>
> The solution to this situation is to keep the kernel .text section IMR lock
> bit false. This means that a subsequent kernel will boot and can tear-down
> an existing IMR, while still setting up an IMR around its own .text
> section.
>
Like I said you privately it would be nice to have a knob how to behave.
My idea is to provide kernel command line imr= and supply imr=lock
when user wants to boot kernel locked.
Optionally: add a warning if imr=lock and kernel build with kexec that
might bring issues
Optionally: add a kernel config option to boot always in locked mode
(should depend on !KEXEC)
> Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
> Reported-by: Andriy Shevchenko <andriy.shevchenko@intel.com>
> ---
> arch/x86/platform/intel-quark/imr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/platform/intel-quark/imr.c b/arch/x86/platform/intel-quark/imr.c
> index c1bdafa..1c43639 100644
> --- a/arch/x86/platform/intel-quark/imr.c
> +++ b/arch/x86/platform/intel-quark/imr.c
> @@ -591,7 +591,7 @@ static void __init imr_fixup_memmap(struct imr_device *idev)
> * from the beginning of the .text secton to the end of the
> * .rodata section as one physically contiguous block.
> */
> - ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, true);
> + ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, false);
> if (ret < 0) {
> pr_err("unable to setup IMR for kernel: (%p - %p)\n",
> &_text, &__end_rodata);
> --
> 2.5.0
>
--
With Best Regards,
Andy Shevchenko
[toc] | [prev] | [next] | [standalone]
| From | Bryan O'Donoghue <pure.logic@nexus-software.ie> |
|---|---|
| Date | 2016-01-22 12:10 +0100 |
| Message-ID | <qTHLk-3dT-33@gated-at.bofh.it> |
| In reply to | #1314417 |
On Thu, 2016-01-21 at 20:44 +0200, Andy Shevchenko wrote: > On Thu, Jan 21, 2016 at 4:05 PM, Bryan O'Donoghue > <pure.logic@nexus-software.ie> wrote: > > Currently when setting up an IMR around the kernel .text area we > > lock that > > IMR, preventing further modification. While superficially this > > appears to > > be the right thing to do, in fact this doesn't account for a > > legitimate > > change in the memory map such as when running through kexec. In > > such a > > scenario a second kernel can have a different size and location to > > it's > > predecessor and can view some of the memory occupied by its > > predecessor as > > legitimately usable RAM. This RAM can then be allocated to DMA > > agents > > within the system and trigger an IMR violation. > > > > The solution to this situation is to keep the kernel .text section > > IMR lock > > bit false. This means that a subsequent kernel will boot and can > > tear-down > > an existing IMR, while still setting up an IMR around its own .text > > section. > > > > Like I said you privately it would be nice to have a knob how to > behave. Ok - that can work. The default ought to be !locked and we can parametrize a different behaviour. > My idea is to provide kernel command line imr= and supply imr=lock > when user wants to boot kernel locked. Agreed. > > Optionally: add a warning if imr=lock and kernel build with kexec > that > might bring issues This makes sense. > Optionally: add a kernel config option to boot always in locked mode > (should depend on !KEXEC) Meh. You can still force the state you want with the parameter though. I reckon we should skip this change for now. --- bod
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2016-01-22 13:20 +0100 |
| Message-ID | <qTIR4-3TR-29@gated-at.bofh.it> |
| In reply to | #1314896 |
On Fri, Jan 22, 2016 at 1:08 PM, Bryan O'Donoghue <pure.logic@nexus-software.ie> wrote: > On Thu, 2016-01-21 at 20:44 +0200, Andy Shevchenko wrote: >> On Thu, Jan 21, 2016 at 4:05 PM, Bryan O'Donoghue >> <pure.logic@nexus-software.ie> wrote: [] >> > The solution to this situation is to keep the kernel .text section >> > IMR lock >> > bit false. This means that a subsequent kernel will boot and can >> > tear-down >> > an existing IMR, while still setting up an IMR around its own .text >> > section. >> > >> >> Like I said you privately it would be nice to have a knob how to >> behave. > > Ok - that can work. The default ought to be !locked and we can > parametrize a different behaviour. > > >> My idea is to provide kernel command line imr= and supply imr=lock >> when user wants to boot kernel locked. > > Agreed. > >> >> Optionally: add a warning if imr=lock and kernel build with kexec >> that >> might bring issues > > This makes sense. > >> Optionally: add a kernel config option to boot always in locked mode >> (should depend on !KEXEC) > > Meh. You can still force the state you want with the parameter though. > I reckon we should skip this change for now. OK! P.S. Please, use my @linux.intel.com address in the tags. -- With Best Regards, Andy Shevchenko
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web