Steve Best | 1 Feb 18:21 2011
Picon

Re: [PATCH] powerpc/mm: add devmem_is_allowed() for STRICT_DEVMEM checking


On Mon, 2011-01-31 at 13:40 -0600, Scott Wood wrote:
> On Mon, 31 Jan 2011 14:16:00 -0500
> Steve Best <sfbest <at> us.ibm.com> wrote:
> 
> >     Provide devmem_is_allowed() routine to restrict access to kernel
> >     memory from userspace.
> >     Set CONFIG_STRICT_DEVMEM config option to switch on checking.
> > 
> > Signed-off-by: Steve Best <sfbest <at> us.ibm.com>
> > 
> > diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> > index 2d38a50..6805d5d 100644
> > --- a/arch/powerpc/Kconfig.debug
> > +++ b/arch/powerpc/Kconfig.debug
> >  <at>  <at>  -299,4 +299,16  <at>  <at>  config PPC_EARLY_DEBUG_CPM_ADDR
> >  	  platform probing is done, all platforms selected must
> >  	  share the same address.
> >  
> > +config STRICT_DEVMEM
> > +        def_bool y
> > +        prompt "Filter access to /dev/mem"
> > +        ---help---
> > +          This option restricts access to /dev/mem.  If this option is
> > +          disabled, you allow userspace access to all memory, including
> > +          kernel and userspace memory. Accidental memory access is likely
> > +          to be disastrous.
> > +          Memory access is required for experts who want to debug the kernel.
> > +
> > +          If you are unsure, say Y.
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 0/6] powerpc: AMP support for 47x

These patches add Asynchonous MultiProcessing support for the 47x chipset.
This allows independent OS instances to run on separate cores.

V2:
 1. Replace ugly hack in boot wrapper with generic solution

Dave Kleikamp (6):
  powerpc: Move udbg_early_init() after early_init_devtree()
  powerpc/44x: allow override to hard-coded uart address
  powerpc/47x: allow kernel to be loaded in higher physical memory
  powerpc/44x: don't use tlbivax on AMP systems
  powerpc/44x: boot wrapper: allow kernel to load into non-zero address
  powerpc/476: Create a dts files for two 476 AMP instances under ISS

 arch/powerpc/Kconfig                          |    2 +-
 arch/powerpc/boot/Makefile                    |    6 +-
 arch/powerpc/boot/dts/iss476-amp1.dts         |  119 ++++++++++++++++++++++++
 arch/powerpc/boot/dts/iss476-amp2.dts         |  120 +++++++++++++++++++++++++
 arch/powerpc/boot/treeboot-iss4xx.c           |   22 +++++-
 arch/powerpc/boot/wrapper                     |    7 ++
 arch/powerpc/configs/44x/iss476-smp_defconfig |    6 +-
 arch/powerpc/include/asm/mmu.h                |    2 +-
 arch/powerpc/kernel/head_44x.S                |   42 +++++++--
 arch/powerpc/kernel/setup_32.c                |    6 +-
 arch/powerpc/kernel/udbg_16550.c              |   17 +++-
 arch/powerpc/mm/44x_mmu.c                     |   13 ++-
 arch/powerpc/mm/tlb_nohash.c                  |   21 ++++-
 13 files changed, 359 insertions(+), 24 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/iss476-amp1.dts
 create mode 100644 arch/powerpc/boot/dts/iss476-amp2.dts
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 2/6] powerpc/44x: allow override to hard-coded uart address

Allow the early debug uart address to be overridden from the kernel
command line.

I would have preferred use the uart's virtual-reg property, but the device
tree hasn't been unflatted yet, and I don't know a reliable way to find it.

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/kernel/udbg_16550.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index b4b167b..d36021a 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
 <at>  <at>  -219,6 +219,19  <at>  <at>  void udbg_init_pas_realmode(void)
 #ifdef CONFIG_PPC_EARLY_DEBUG_44x
 #include <platforms/44x/44x.h>

+static unsigned long udbg_44x_comport = PPC44x_EARLY_DEBUG_VIRTADDR;
+
+static int __init early_parse_comport(char *p)
+{
+	if (!p || !(*p))
+		return 0;
+
+	udbg_44x_comport = simple_strtoul(p, 0, 16);
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 1/6] powerpc: Move udbg_early_init() after early_init_devtree()

so that it can use information from the device tree.

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/kernel/setup_32.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 1d2fbc9..d1ca976 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
 <at>  <at>  -120,12 +120,12  <at>  <at>  notrace void __init machine_init(unsigned long dt_ptr)
 {
 	lockdep_init();

-	/* Enable early debugging if any specified (see udbg.h) */
-	udbg_early_init();
-
 	/* Do some early initialization based on the flat device tree */
 	early_init_devtree(__va(dt_ptr));

+	/* Enable early debugging if any specified (see udbg.h) */
+	udbg_early_init();
+
 	probe_machine();

 	setup_kdump_trampoline();
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 3/6] powerpc/47x: allow kernel to be loaded in higher physical memory

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/Kconfig                          |    2 +-
 arch/powerpc/configs/44x/iss476-smp_defconfig |    6 ++--
 arch/powerpc/kernel/head_44x.S                |   42 ++++++++++++++++++++-----
 arch/powerpc/mm/44x_mmu.c                     |   13 ++++++--
 4 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 7d69e9b..fa41026 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
 <at>  <at>  -827,7 +827,7  <at>  <at>  config LOWMEM_CAM_NUM

 config RELOCATABLE
 	bool "Build a relocatable kernel (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && FSL_BOOKE
+	depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x)
 	help
 	  This builds a kernel image that is capable of running at the
 	  location the kernel is loaded at (some alignment restrictions may
diff --git a/arch/powerpc/configs/44x/iss476-smp_defconfig b/arch/powerpc/configs/44x/iss476-smp_defconfig
index 92f863a..a6eb6ad 100644
--- a/arch/powerpc/configs/44x/iss476-smp_defconfig
+++ b/arch/powerpc/configs/44x/iss476-smp_defconfig
 <at>  <at>  -3,8 +3,8  <at>  <at>  CONFIG_SMP=y
 CONFIG_EXPERIMENTAL=y
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 6/6] powerpc/476: Create a dts files for two 476 AMP instances under ISS

These are completely independent OS instances, each running on 2 cores.

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/boot/Makefile            |    6 ++-
 arch/powerpc/boot/dts/iss476-amp1.dts |  119 ++++++++++++++++++++++++++++++++
 arch/powerpc/boot/dts/iss476-amp2.dts |  120 +++++++++++++++++++++++++++++++++
 arch/powerpc/boot/wrapper             |    7 ++
 4 files changed, 251 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/iss476-amp1.dts
 create mode 100644 arch/powerpc/boot/dts/iss476-amp2.dts

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 8917816..99dbc39 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
 <at>  <at>  -45,6 +45,8  <at>  <at>  $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
+$(obj)/treeboot-iss476-amp1.o: BOOTCFLAGS += -mcpu=405
+$(obj)/treeboot-iss476-amp2.o: BOOTCFLAGS += -mcpu=405
 $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405

 
 <at>  <at>  -208,7 +210,9  <at>  <at>  image-$(CONFIG_KATMAI)			+= cuImage.katmai
 image-$(CONFIG_WARP)			+= cuImage.warp
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 5/6] powerpc/44x: boot wrapper: allow kernel to load into non-zero address

For AMP, different kernel instances load into separate memory regions.
Read the start of memory from the device tree and limit the memory to what's
specified in the device tree.

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/boot/treeboot-iss4xx.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/treeboot-iss4xx.c b/arch/powerpc/boot/treeboot-iss4xx.c
index fcc4495..868c8b4 100644
--- a/arch/powerpc/boot/treeboot-iss4xx.c
+++ b/arch/powerpc/boot/treeboot-iss4xx.c
 <at>  <at>  -34,9 +34,28  <at>  <at> 

 BSS_STACK(4096);

+static ibm4xx_memstart;
+
 static void iss_4xx_fixups(void)
 {
-	ibm4xx_sdram_fixup_memsize();
+	void *memory;
+	u32 reg[3];
+
+	memory = finddevice("/memory");
+	if (!memory)
(Continue reading)

Dave Kleikamp | 1 Feb 19:48 2011
Picon

[PATCH V2 4/6] powerpc/44x: don't use tlbivax on AMP systems

Since other OS's may be running on the other cores don't use tlbivax

Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
Cc: linuxppc-dev <at> lists.ozlabs.org
---
 arch/powerpc/include/asm/mmu.h |    2 +-
 arch/powerpc/kernel/setup_32.c |    2 ++
 arch/powerpc/mm/tlb_nohash.c   |   21 ++++++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index bb40a06..f3a7c65 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
 <at>  <at>  -80,7 +80,7  <at>  <at>  static inline int mmu_has_feature(unsigned long feature)

 extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup;

-/* MMU initialization (64-bit only fo now) */
+/* MMU initialization */
 extern void early_init_mmu(void);
 extern void early_init_mmu_secondary(void);

diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index d1ca976..e50ead7 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
 <at>  <at>  -126,6 +126,8  <at>  <at>  notrace void __init machine_init(unsigned long dt_ptr)
(Continue reading)

Scott Wood | 1 Feb 19:35 2011

Re: [PATCH] powerpc/mm: add devmem_is_allowed() for STRICT_DEVMEM checking

On Tue, 1 Feb 2011 12:21:45 -0500
Steve Best <sfbest <at> us.ibm.com> wrote:

> 
> On Mon, 2011-01-31 at 13:40 -0600, Scott Wood wrote:
> > I don't see how this is a sane thing to turn on by default (you're not
> > restricting it, BTW -- you're completely disabling it with that
> > implementation of devmem_is_allowed).  It will break anything that
> > uses /dev/mem to access I/O, 
> 
> could you expand on what I/O depends on /dev/mem, so I can take
> that into account?

It could be anything.  You're shutting off, by default, a
longstanding userspace interface, that already has adequate security
protection.

Even x86 doesn't default it to yes (though it does say "if in doubt
say Y"), and when enabled x86 only restricts access to memory, not I/O.

> > possibly including desktoppy stuff like X
> > servers, 
> 
> you are right just found out that X needs to access it. will 
> take that into account
> > as well as lots of stuff that goes on in embedded setups.
> 
> could you explain more about what needs access to /dev/mem in 
> the embedded setups?

(Continue reading)

Scott Wood | 1 Feb 20:13 2011

Re: [PATCH V2 5/6] powerpc/44x: boot wrapper: allow kernel to load into non-zero address

On Tue, 1 Feb 2011 12:48:45 -0600
Dave Kleikamp <shaggy <at> linux.vnet.ibm.com> wrote:

> For AMP, different kernel instances load into separate memory regions.
> Read the start of memory from the device tree and limit the memory to what's
> specified in the device tree.
> 
> Signed-off-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>
> Cc: Benjamin Herrenschmidt <benh <at> kernel.crashing.org>
> Cc: Josh Boyer <jwboyer <at> linux.vnet.ibm.com>
> Cc: linuxppc-dev <at> lists.ozlabs.org
> ---
>  arch/powerpc/boot/treeboot-iss4xx.c |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/boot/treeboot-iss4xx.c b/arch/powerpc/boot/treeboot-iss4xx.c
> index fcc4495..868c8b4 100644
> --- a/arch/powerpc/boot/treeboot-iss4xx.c
> +++ b/arch/powerpc/boot/treeboot-iss4xx.c
>  <at>  <at>  -34,9 +34,28  <at>  <at> 
>  
>  BSS_STACK(4096);
>  
> +static ibm4xx_memstart;

type?

> +static void *iss_4xx_vmlinux_alloc(unsigned long size)
> +{
> +	return ibm4xx_memstart;
(Continue reading)


Gmane