Re: [PATCH RFC rebase 0/9] powerpc barrier_nospec

2018-03-16 Thread Greg Kroah-Hartman
On Thu, Mar 15, 2018 at 08:15:49PM +0100, Michal Suchanek wrote: > Yes, it is good idea to add some commit messages. Always a good idea :) Also, any reason you are not tagging these for the stable release(s)? thanks, greg k-h

Re: [PATCH V4 1/3] powerpc/mm: Add support for handling > 512TB address in SLB miss

2018-03-16 Thread Michael Ellerman
Hi Aneesh, Some comments ... "Aneesh Kumar K.V" writes: > For address above 512TB we allocate additional mmu context. To make it all > easy address above 512TB is handled with IR/DR=1 and with stack frame setup. > > We do the additional context allocation in SLB

Re: build warning in drivers/macintosh/rack-meter.c

2018-03-16 Thread Stephen Rothwell
Hi Aaro, On Fri, 16 Mar 2018 11:37:47 +0200 Aaro Koskinen wrote: > > I can send a fix for this and test on Xserve. Excellent. (I should send emails about more old warnings :-)) -- Cheers, Stephen Rothwell pgpZq9olF2Lag.pgp Description: OpenPGP digital signature

[RFC PATCH 0/4] more sreset debugging improvements

2018-03-16 Thread Nicholas Piggin
This code seems to never end. This series attempts to make sreset debugging more robust, particularly I'm looking at taking exceptions from CPUs within OPAL. This is starting to work to a degree now (with some skiboot patches I'll post in a minute). At least we can examine registers of the CPU

[RFC PATCH 1/4] powerpc/64s: return more carefully from sreset NMI

2018-03-16 Thread Nicholas Piggin
System Reset, being an NMI, must return more carefully than other interrupts. It has traditionally returned via the nromal return from exception path, but that has a number of problems. - r13 does not get restored if returning to kernel. This is for interrupts which may cause a context switch,

[RFC PATCH 2/4] powerpc/64s: sreset panic if there is no debugger or crash dump handlers

2018-03-16 Thread Nicholas Piggin
system_reset_exception does most of its own crash handling now, invoking the debugger or crash dumps if they are registered. If not, then it goes through to die() to print stack traces, and then is supposed to panic (according to comments). However after die() prints oopses, it does its own

[RFC PATCH 3/4] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors

2018-03-16 Thread Nicholas Piggin
opal_nvram_write currently just assumes success if it encounters an error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO on other errors instead. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2

[RFC PATCH 4/4] powerpc/xmon: Detect if OPAL was interrupted and mark unrecoverable

2018-03-16 Thread Nicholas Piggin
xmon can be entered via sreset NMI (from a management sreset, or an NMI IPI), which can interrupt OPAL. xmon will then issue OPAL calls to read and write the console, which re-enter OPAL and will destroy the OPAL stack. So xmon must not attempt to recover in this case. Signed-off-by: Nicholas

Re: build warning in drivers/macintosh/rack-meter.c

2018-03-16 Thread Michael Ellerman
Stephen Rothwell writes: > Hi all, > > These warnings have beeen around for a while now; > > drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length > equal to number of elements without multiplication by element size > [-Wmemset-elt-size] >

Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()

2018-03-16 Thread Michael Ellerman
Dan Carpenter writes: > On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: >> SF Markus Elfring writes: >> > From: Markus Elfring >> > Date: Sun, 11 Mar 2018 09:03:42 +0100 >> > >> > Add

Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()

2018-03-16 Thread Michael Ellerman
Joe Perches writes: > On Thu, 2018-03-15 at 14:57 +0300, Dan Carpenter wrote: >> On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: >> > SF Markus Elfring writes: >> > > From: Markus Elfring >> >

[PATCH v4] mm, pkey: treat pkey-0 special

2018-03-16 Thread Ram Pai
Applications need the ability to associate an address-range with some key and latter revert to its initial default key. Pkey-0 comes close to providing this function but falls short, because the current implementation disallows applications to explicitly associate pkey-0 to the address range.

Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry

2018-03-16 Thread Nicholas Piggin
On Fri, 16 Mar 2018 10:15:49 +0100 Michal Suchánek wrote: > Hello, > > On Fri, 16 Mar 2018 15:18:23 +1000 > Nicholas Piggin wrote: > > > On Thu, 15 Mar 2018 20:15:52 +0100 > > Michal Suchanek wrote: > > > > > On powerpc syscall

Re: [PATCH v4] mm, pkey: treat pkey-0 special

2018-03-16 Thread Balbir Singh
On Fri, Mar 16, 2018 at 9:33 PM, Ram Pai wrote: > Applications need the ability to associate an address-range with some > key and latter revert to its initial default key. Pkey-0 comes close to > providing this function but falls short, because the current > implementation

[PATCH 01/19] xmon: Use __printf markup to silence compiler

2018-03-16 Thread Mathieu Malaterre
Update also the other prototype declaration in asm/xmon.h. Silence warnings (triggered at W=1) by adding relevant __printf attribute. Move #define at bottom of the file to prevent conflict with gcc attribute. CC arch/powerpc/xmon/nonstdio.o arch/powerpc/xmon/nonstdio.c: In function

Re: [PATCH 2/2, powerpc/powernv] powerpc/powernv: Tweak PCI_DEV_FLAGS_QUIET_PCI_REALIGN on/off during boot

2018-03-16 Thread kbuild test robot
Hi Desnes, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16-rc5 next-20180316] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux

Re: [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code

2018-03-16 Thread Michal Suchánek
On Thu, 15 Mar 2018 17:36:00 -0300 Murilo Opsfelder Araujo wrote: > On 03/14/2018 07:40 PM, Mauricio Faria de Oliveira wrote: > > From: Michael Ellerman > > > > rfi_flush_enable() includes a check to see if we're already > > enabled (or

Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry

2018-03-16 Thread Michal Suchánek
Hello, On Fri, 16 Mar 2018 15:18:23 +1000 Nicholas Piggin wrote: > On Thu, 15 Mar 2018 20:15:52 +0100 > Michal Suchanek wrote: > > > On powerpc syscall entry is done in assembly so patch in an explicit > > barrier_nospec. > > Same comment as Linus for

Re: [PATCH RFC rebase 0/9] powerpc barrier_nospec

2018-03-16 Thread Michal Suchánek
On Fri, 16 Mar 2018 09:08:10 +0100 Greg Kroah-Hartman wrote: > On Thu, Mar 15, 2018 at 08:15:49PM +0100, Michal Suchanek wrote: > > Yes, it is good idea to add some commit messages. > > Always a good idea :) > > Also, any reason you are not tagging these for the

Re: build warning in drivers/macintosh/rack-meter.c

2018-03-16 Thread Aaro Koskinen
Hi, On Fri, Mar 16, 2018 at 04:46:14PM +1100, Stephen Rothwell wrote: > These warnings have beeen around for a while now; > > drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length > equal to number of elements without multiplication by element size > [-Wmemset-elt-size] >

Re: [PATCH] cxl: Add new kernel traces

2018-03-16 Thread Frederic Barrat
Le 13/03/2018 à 10:30, Christophe Lombard a écrit : This patch adds new kernel traces in the current in-kernel 'library' which can be called by other drivers to help interacting with an IBM XSL on a POWER9 system. If some kernel traces exist in the 'normal path' to handle a page or a segment

Re: [PATCH 2/3] rfi-flush: Make it possible to call setup_rfi_flush() again

2018-03-16 Thread Mauricio Faria de Oliveira
Michael, On 03/16/2018 11:18 AM, Michael Ellerman wrote: I still think the correct, informative messages are a good way to go:) Yeah I agree. We probably want to do both, print what's available at boot, and print what's actually patched when the patching happens. Nice. Not sure you had a

Re: [RESEND PATCH] Input: joystick/analog - Use get_cycles() on PPC

2018-03-16 Thread Michael Ellerman
Dmitry Torokhov writes: > On Wed, Mar 14, 2018 at 10:17:52PM +1100, Michael Ellerman wrote: >> The analog joystick driver spits a warning at us: >> >> drivers/input/joystick/analog.c:176:2: warning: #warning Precise timer >> not defined for this architecture. >>

Re: [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code

2018-03-16 Thread Mauricio Faria de Oliveira
Hi Murilo and Michal, On 03/16/2018 05:52 AM, Michal Suchánek wrote: Do we need to take into account if no_rfi_flush == true? I think it makes sense you are able to override that using debugfs. It's interface used for diagnostics and testing. If this was in sysfs it would be a different

Re: [mm] b33ddf50eb: INFO:trying_to_register_non-static_key

2018-03-16 Thread Laurent Dufour
four/Speculative-page-faults/20180316-151833 > > > in testcase: boot > > on test machine: qemu-system-x86_64 -enable-kvm -cpu host -smp 2 -m 4G > > caused below changes (please refer t

Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry

2018-03-16 Thread Linus Torvalds
On Fri, Mar 16, 2018 at 2:15 AM, Michal Suchánek wrote: > > As far as I understand barriers they separate code before the barrier > and code after the barrier. Almost certainly not. Even if you were to do an expensive serialization before the branch, the branch will still

[PATCH 1/1] PCI set flag PCI_SCAN_ALL_PCIE_DEVS for P.A. Semi boards

2018-03-16 Thread Christian Zigotzky
Bjorn Helgaas created a patch for making PCI_SCAN_ALL_PCIE_DEVS work for Root Ports as well as Downstream. Previously PCI_SCAN_ALL_PCIE_DEVS (set by quirks or the "pci=pcie_scan_all" kernel parameter) only affected Switch Downstream Ports, not Root Ports. The problem is, that we have to add

Re: [PATCH 04/21] powerpc: Mark both tmp variables as unused

2018-03-16 Thread Michael Ellerman
Christophe LEROY writes: > Le 25/02/2018 à 18:22, Mathieu Malaterre a écrit : >> Since the value of `tmp` is never intended to be read, declare both `tmp` >> variables as unused. Fix warning (treated as error in W=1): > > What about using fault_in_pages_readable()

[PATCH 19/19] ppc64: Handle %p format in DUMPPTR() function-like macro

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’: ../arch/powerpc/xmon/xmon.c:2339:9: error: '#' flag used with ‘%p’ gnu_printf format [-Werror=format=] printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \ ^

Re: [RFC PATCH 2/2] powerpc: Only support DYNAMIC_FTRACE not static

2018-03-16 Thread Steven Rostedt
On Sat, 17 Mar 2018 00:46:33 +1100 Michael Ellerman wrote: > We've had dynamic ftrace support for over 9 years since Steve first > wrote it, all the distros use dynamic, and static is basically > untested these days, so drop support for static ftrace. > > Signed-off-by:

[RFC PATCH 1/2] ftrace: Allow arches to opt-out of static ftrace

2018-03-16 Thread Michael Ellerman
There is a small but non-zero amount of code required by arches to suppory non-dynamic (static) ftrace, and more importantly there is the added work of testing both configurations. There are also almost no down sides to dynamic ftrace once it's well tested, other than a small increase in

[PATCH 16/19] ppc64: Change %d into %lu

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/spu-dis.o ../arch/powerpc/xmon/spu-dis.c: In function ‘print_insn_spu’: ../arch/powerpc/xmon/spu-dis.c:137:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=] printf("$%d", ^

Re: [PATCH 2/3] rfi-flush: Make it possible to call setup_rfi_flush() again

2018-03-16 Thread Michael Ellerman
Mauricio Faria de Oliveira writes: > On 03/13/2018 03:36 PM, Michal Suchánek wrote: >> On Tue, 13 Mar 2018 15:13:11 -0300 >> Mauricio Faria de Oliveira wrote: >> >>> On 03/13/2018 02:59 PM, Michal Suchánek wrote: Maybe it would

Re: [RFC PATCH 1/2] ftrace: Allow arches to opt-out of static ftrace

2018-03-16 Thread Steven Rostedt
On Sat, 17 Mar 2018 00:46:32 +1100 Michael Ellerman wrote: > There is a small but non-zero amount of code required by arches to > suppory non-dynamic (static) ftrace, and more importantly there is the > added work of testing both configurations. > > There are also almost no

Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()

2018-03-16 Thread Dan Carpenter
On Fri, Mar 16, 2018 at 09:26:53PM +1100, Michael Ellerman wrote: > Dan Carpenter writes: > > On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: > >> SF Markus Elfring writes: > >> > From: Markus Elfring

[PATCH 0/1] PCI set flag PCI_SCAN_ALL_PCIE_DEVS for P.A. Semi boards

2018-03-16 Thread Christian Zigotzky
On 02 December 2017 at 00:27PM, Bjorn Helgaas wrote: > On Fri, Dec 01, 2017 at 11:08:46PM +0100, Christian Zigotzky wrote: >> On 30.11.2017 23:42, Bjorn Helgaas wrote: >>> >>> 00:11.0 claims to be a PCIe Root Port leading to [bus 05-06]. That >>> means there's a Link (presumably this A-Link II

Re: [PATCH RFC rebase 2/9] powerpc: Use barrier_nospec in copy_from_user

2018-03-16 Thread Michael Ellerman
Linus Torvalds writes: > On Thu, Mar 15, 2018 at 12:15 PM, Michal Suchanek wrote: >> This is based on x86 patch doing the same. >> >> Signed-off-by: Michal Suchanek >> --- >> --- a/arch/powerpc/include/asm/uaccess.h >> +++

[RFC PATCH 2/2] powerpc: Only support DYNAMIC_FTRACE not static

2018-03-16 Thread Michael Ellerman
We've had dynamic ftrace support for over 9 years since Steve first wrote it, all the distros use dynamic, and static is basically untested these days, so drop support for static ftrace. Signed-off-by: Michael Ellerman --- arch/powerpc/Kconfig | 1

Re: dtc warnings

2018-03-16 Thread Michael Ellerman
Stephen Rothwell writes: > Hi all, > > > I get the following from a powerpc_ppc44x defconfig build in current > linux-next: > > arch/powerpc/boot/ebony.dtb: Warning (pci_bridge): /plb/pci@20ec0: > missing bus-range for PCI bridge > arch/powerpc/boot/ebony.dtb: Warning

Re: [PATCH 03/14] powerpc/64s: allocate lppacas individually

2018-03-16 Thread Michael Ellerman
Nicholas Piggin writes: > On Tue, 13 Mar 2018 23:41:46 +1100 > Michael Ellerman wrote: >> Nicholas Piggin writes: >> > diff --git a/arch/powerpc/platforms/pseries/kexec.c >> > b/arch/powerpc/platforms/pseries/kexec.c >> > index

[PATCH 18/19] ppc64: change %ld into %d

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘prregs’: ../arch/powerpc/xmon/xmon.c:1665:17: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Werror=format=] printf("R%.2ld = "REG" R%.2ld = "REG"\n", ^

Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry

2018-03-16 Thread Michael Ellerman
Hi Michal, Thanks for working on this series in the absence of any documentation. Michal Suchánek writes: > On Fri, 16 Mar 2018 15:18:23 +1000 > Nicholas Piggin wrote: > >> On Thu, 15 Mar 2018 20:15:52 +0100 >> Michal Suchanek wrote: >>

[PATCH] drivers: macintosh: rack-meter: really fix bogus memsets

2018-03-16 Thread Aaro Koskinen
We should zero an array using sizeof instead of number of elements. Fixes the following compiler (GCC 7.3.0) warnings: drivers/macintosh/rack-meter.c: In function 'rackmeter_do_pause': drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without

Re: [PATCH v4] mm, pkey: treat pkey-0 special

2018-03-16 Thread Ram Pai
On Fri, Mar 16, 2018 at 10:02:22PM +1100, Balbir Singh wrote: > On Fri, Mar 16, 2018 at 9:33 PM, Ram Pai wrote: > > Applications need the ability to associate an address-range with some > > key and latter revert to its initial default key. Pkey-0 comes close to > > providing

[PATCH v6 03/12] PKCS#7: Introduce pkcs7_get_digest()

2018-03-16 Thread Thiago Jung Bauermann
IMA will need to access the digest of the PKCS7 message (as calculated by the kernel) before the signature is verified, so introduce pkcs7_get_digest() for that purpose. Also, modify pkcs7_digest() to detect when the digest was already calculated so that it doesn't have to do redundant work.

[PATCH v6 08/12] ima: Export func_tokens

2018-03-16 Thread Thiago Jung Bauermann
ima_read_modsig() will need it so that it can show an error message. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h| 2 ++ security/integrity/ima/ima_policy.c | 12 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff

[PATCH v6 11/12] ima: Implement support for module-style appended signatures

2018-03-16 Thread Thiago Jung Bauermann
This patch actually implements the appraise_type=imasig|modsig option, allowing IMA to read and verify modsig signatures. In case both are present in the same file, IMA will first check whether the key used by the xattr signature is present in the kernel keyring. If not, it will try the appended

Re: [PATCH v12 07/22] selftests/vm: fixed bugs in pkey_disable_clear()

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > --- a/tools/testing/selftests/vm/protection_keys.c > +++ b/tools/testing/selftests/vm/protection_keys.c > @@ -461,7 +461,7 @@ void pkey_disable_clear(int pkey, int flags) > pkey, pkey, pkey_rights); > pkey_assert(pkey_rights >=

Re: [PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > #define PAGE_SIZE (0x1UL << 16) > -static inline int cpu_has_pku(void) > +static inline bool is_pkey_supported(void) > { > - return 1; > + /* > + * No simple way to determine this. > + * lets try allocating a key and see if it succeeds.

Re: [PATCH v12 20/22] selftests/vm: testcases must restore pkey-permissions

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > Generally the signal handler restores the state of the pkey register > before returning. However there are times when the read/write operation > can legitamely fail without invoking the signal handler. Eg: A > sys_read() operaton to a write-protected page

[PATCH v6 07/12] integrity: Select CONFIG_KEYS instead of depending on it

2018-03-16 Thread Thiago Jung Bauermann
This avoids a dependency cycle in CONFIG_IMA_APPRAISE_MODSIG (introduced by a later patch in this series): it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann

[PATCH v6 09/12] ima: Add modsig appraise_type option for module-style appended signatures

2018-03-16 Thread Thiago Jung Bauermann
This patch introduces the modsig keyword to the IMA policy syntax to specify that a given hook should expect the file to have the IMA signature appended to it. Here is how it can be used in a rule: appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig|modsig With this rule, IMA will accept

Re: [PATCH v12 05/22] selftests/vm: generic function to handle shadow key register

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > +static inline u32 pkey_to_shift(int pkey) > +{ > + return pkey * PKEY_BITS_PER_PKEY; > +} pkey_bit_position(), perhaps? > +static inline pkey_reg_t reset_bits(int pkey, pkey_reg_t bits) > +{ > + u32 shift = pkey_to_shift(pkey); > + > + return

Re: [PATCH v12 10/22] selftests/vm: introduce two arch independent abstraction

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > open_hugepage_file() <- opens the huge page file > get_start_key() <-- provides the first non-reserved key. > Looks reasonable. Reviewed-by: Dave Hansen

Re: [PATCH v12 12/22] selftests/vm: generic cleanup

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > cleanup the code to satisfy coding styles. > > cc: Dave Hansen > cc: Florian Weimer > Signed-off-by: Ram Pai > --- > tools/testing/selftests/vm/protection_keys.c | 81 >

Re: [PATCH v12 14/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > diff --git a/tools/testing/selftests/vm/protection_keys.c > b/tools/testing/selftests/vm/protection_keys.c > index c4c73e6..e82bd88 100644 > --- a/tools/testing/selftests/vm/protection_keys.c > +++ b/tools/testing/selftests/vm/protection_keys.c > @@ -586,7

Re: [PATCH v12 18/22] selftests/vm: associate key on a mapped page and detect write violation

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > detect write-violation on a page to which write-disabled > key is associated much after the page is mapped. The more tests the merrier. Acked-by: Dave Hansen

Re: [PATCH v12 19/22] selftests/vm: detect write violation on a mapped access-denied-key page

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > detect write-violation on a page to which access-disabled > key is associated much after the page is mapped. Acked-by: Dave Hansen

[PATCH v6 05/12] integrity: Introduce integrity_keyring_from_id()

2018-03-16 Thread Thiago Jung Bauermann
IMA will need to obtain the keyring used to verify file signatures so that it can verify the module-style signature appended to files. Signed-off-by: Thiago Jung Bauermann --- security/integrity/digsig.c| 28 +---

Re: [PATCH v12 06/22] selftests/vm: fix the wrong assert in pkey_disable_set()

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > If the flag is 0, no bits will be set. Hence we cant expect > the resulting bitmap to have a higher value than what it > was earlier. > > cc: Dave Hansen > cc: Florian Weimer > Signed-off-by: Ram Pai

Re: [PATCH v12 09/22] selftests/vm: fix alloc_random_pkey() to make it really random

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > alloc_random_pkey() was allocating the same pkey every time. > Not all pkeys were geting tested. fixed it. ... > @@ -602,13 +603,15 @@ int alloc_random_pkey(void) > int alloced_pkeys[NR_PKEYS]; > int nr_alloced = 0; > int random_index; > +

Re: [PATCH v12 13/22] selftests/vm: powerpc implementation for generic abstraction

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > static inline u32 pkey_to_shift(int pkey) > { > +#if defined(__i386__) || defined(__x86_64__) /* arch */ > return pkey * PKEY_BITS_PER_PKEY; > +#elif __powerpc64__ /* arch */ > + return (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; > +#endif /*

Re: [PATCH v12 16/22] selftests/vm: fix an assertion in test_pkey_alloc_exhaust()

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > +static inline int arch_reserved_keys(void) > +{ > +#if defined(__i386__) || defined(__x86_64__) /* arch */ > + return NR_RESERVED_PKEYS; > +#elif __powerpc64__ /* arch */ > + if (sysconf(_SC_PAGESIZE) == 4096) > + return

Re: [PATCH v12 21/22] selftests/vm: sub-page allocator

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: ... > @@ -888,6 +917,7 @@ void setup_hugetlbfs(void) > void *(*pkey_malloc[])(long size, int prot, u16 pkey) = { > > malloc_pkey_with_mprotect, > + malloc_pkey_with_mprotect_subpage, > malloc_pkey_anon_huge, > malloc_pkey_hugetlb >

[PATCH v6 00/12] Appended signatures support for IMA appraisal

2018-03-16 Thread Thiago Jung Bauermann
Hello, The main highlight in this version is that it's not necessary to appraise the file before storing its measurement anymore. This is possible due to a new approach that Mimi suggested: we decide whether the modsig should be used or not at the time it is read from the file, while before we

[PATCH v6 10/12] ima: Add functions to read and verify a modsig signature

2018-03-16 Thread Thiago Jung Bauermann
This is the code needed by IMA-appraise to work with modsig signatures. It will be used by the next two patches. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/Kconfig | 3 + security/integrity/ima/ima.h| 41

[PATCH v6 02/12] PKCS#7: Introduce pkcs7_get_message_sig() and verify_pkcs7_message_sig()

2018-03-16 Thread Thiago Jung Bauermann
IMA will need to know the key that signed a given PKCS#7 message, so add pkcs7_get_message_sig(). It will also need to verify an already parsed PKCS#7 message. For this purpose, add verify_pkcs7_message_sig() which takes a struct pkcs7_message for verification instead of the raw bytes that

Re: dtc warnings

2018-03-16 Thread Stephen Rothwell
Hi Michael, On Sat, 17 Mar 2018 01:13:36 +1100 Michael Ellerman wrote: > > Stephen Rothwell writes: > > > I get the following from a powerpc_ppc44x defconfig build in current > > linux-next: > > > > arch/powerpc/boot/ebony.dtb: Warning (pci_bridge):

Re: [PATCH v6 00/12] Appended signatures support for IMA appraisal

2018-03-16 Thread Thiago Jung Bauermann
Thiago Jung Bauermann writes: > Now the modsig is only ignored if it references a signature that is not > present in IMA's keyring (or if there's a parsing error, obviously). If the The above should read "Now the modsig is only ignored if it references a *key* that

Re: [PATCH v12 04/22] selftests/vm: typecast the pkey register

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > -static inline unsigned int _rdpkey_reg(int line) > +static inline pkey_reg_t _rdpkey_reg(int line) > { > - unsigned int pkey_reg = __rdpkey_reg(); > + pkey_reg_t pkey_reg = __rdpkey_reg(); > > - dprintf4("rdpkey_reg(line=%d) pkey_reg: %x

Re: [PATCH v12 08/22] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > When a key is freed, the key is no more effective. > Clear the bits corresponding to the pkey in the shadow > register. Otherwise it will carry some spurious bits > which can trigger false-positive asserts. ... > diff --git

Re: [PATCH v12 11/22] selftests/vm: pkey register should match shadow pkey

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > expected_pkey_fault() is comparing the contents of pkey > register with 0. This may not be true all the time. There > could be bits set by default by the architecture > which can never be changed. Hence compare the value against > shadow pkey register,

[PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

2018-03-16 Thread Mark Greer
When building a uImage or zImage using ppc6xx_defconfig and some other defconfigs, the following error occurs: BOOTCC arch/powerpc/boot/fdt.o In file included from arch/powerpc/boot/fdt.c:51:0: ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'

[PATCH v6 01/12] MODSIGN: Export module signature definitions

2018-03-16 Thread Thiago Jung Bauermann
IMA will use the module_signature format for append signatures, so export the relevant definitions and factor out the code which verifies that the appended signature trailer is valid. Also, create a CONFIG_MODULE_SIG_FORMAT option so that IMA can select it and be able to use validate_module_sig()

[PATCH v6 04/12] ima: Introduce is_ima_sig()

2018-03-16 Thread Thiago Jung Bauermann
With the introduction of another IMA signature type (modsig), some places will need to check for both of them. It is cleaner to do that if there's a helper function to tell whether an xattr_value represents an IMA signature. Suggested-by: Mimi Zohar Signed-off-by:

[PATCH v6 06/12] integrity: Introduce asymmetric_sig_has_known_key()

2018-03-16 Thread Thiago Jung Bauermann
IMA will only look for a modsig if the xattr sig references a key which is not in the expected kernel keyring. To that end, introduce asymmetric_sig_has_known_key(). The logic of extracting the key used in the xattr sig is factored out from asymmetric_verify() so that it can be used by the new

[PATCH v6 12/12] ima: Write modsig to the measurement list

2018-03-16 Thread Thiago Jung Bauermann
Define new "d-sig" template field which holds the digest that is expected to match the one contained in the modsig. Also add modsig support to the "sig" template field, allowing the the contents of the modsig to be included in the measurement list. Suggested-by: Mimi Zohar

Re: [PATCH v12 02/22] selftests/vm: rename all references to pkru to a generic name

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > int pkey_set(int pkey, unsigned long rights, unsigned long flags) > { > u32 mask = (PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE); > - u32 old_pkru = __rdpkru(); > - u32 new_pkru; > + u32 old_pkey_reg = __rdpkey_reg(); > + u32

Re: [PATCH v12 17/22] selftests/vm: associate key on a mapped page and detect access violation

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > detect access-violation on a page to which access-disabled > key is associated much after the page is mapped. Looks fine to me. Did this actually find a bug for you? Acked-by: Dave Hansen

Re: [PATCH v12 22/22] selftests/vm: Fix deadlock in protection_keys.c

2018-03-16 Thread Dave Hansen
On 02/21/2018 05:55 PM, Ram Pai wrote: > From: Thiago Jung Bauermann > > The sig_chld() handler calls dprintf2() taking care of setting > dprint_in_signal so that sigsafe_printf() won't call printf(). > Unfortunately, this precaution is is negated by dprintf_level(),

[PATCH 02/19] ppc32: change %x into %lx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘memdiffs’: ../arch/powerpc/xmon/xmon.c:2866:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘unsigned char *’ [-Werror=format=] printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,

[PATCH 03/19] ppc32: Change %.16x into %p

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o arch/powerpc/xmon/xmon.c: In function ‘memdiffs’: arch/powerpc/xmon/xmon.c:2863:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘unsigned char *’ [-Werror=format=] printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,

[PATCH 00/19] Start using __printf attribute (single commit series)

2018-03-16 Thread Mathieu Malaterre
This series is part of my warning fixes branch. When preparing the patch, I figured that sending it as single patch would make the reviewing task fairly difficult. I decided to split it into fake commits and group them by warning types to make reviewing much easier. Obviously this series is not

[PATCH 04/19] ppc32: change %lx into %p

2018-03-16 Thread Mathieu Malaterre
also remove extra fp->link since no formatter associated. CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘excprint’: ../arch/powerpc/xmon/xmon.c:1607:31: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘struct pt_regs *’

[PATCH 05/19] ppc32: change %lx into %tx (ptrdiff_t)

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o arch/powerpc/xmon/xmon.c: In function ‘xmon_core’: arch/powerpc/xmon/xmon.c:630:36: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Werror=format=] printf("Stopped at breakpoint %lx (", BP_NUM(bp));

[PATCH 06/19] ppc64: change %lx into %llx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_by_size’: ../arch/powerpc/xmon/xmon.c:2570:16: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=] printf("%0*lx", size

[PATCH 07/19] ppc64: change %ld into %d

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘excprint’: ../arch/powerpc/xmon/xmon.c:1629:25: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘pid_t {aka int}’ [-Werror=format=] printf("pid = %ld, comm = %s\n",

[PATCH 09/19] ppc64: change %016lx into %p

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘show_pte’: ../arch/powerpc/xmon/xmon.c:3016:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘pgd_t * {aka struct *}’ [-Werror=format=] printf("pgd @ 0x%016lx\n", pgdir);

[PATCH 10/19] ppc64: change %lx into %p

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘excprint’: ../arch/powerpc/xmon/xmon.c:1625:26: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘struct paca_struct *’ [-Werror=format=] printf(" paca= 0x%lx\t softe:

[PATCH 08/19] ppc64: change %x into %lx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘cpu_cmd’: ../arch/powerpc/xmon/xmon.c:1168:18: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=] printf("cpu 0x%x isn't in xmon\n", cpu);

[PATCH 11/19] ppc64: change %lx into %x

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’: ../arch/powerpc/xmon/xmon.c:2380:43: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u32 {aka unsigned int}’ [-Werror=format=] printf(" slb_cache[%d]:

[PATCH 14/19] ppc64: change %p into %llx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_fields’: ../arch/powerpc/xmon/xmon.c:3827:10: error: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘long long unsigned int’ [-Werror=format=] printf(" %-*s = "format"\n",

[PATCH 12/19] ppc64: change %lx into %llx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’: ../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=] printf(" %-*s =

[PATCH 15/19] ppc64: change %d into %ld

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_ls’: ../arch/powerpc/xmon/xmon.c:3896:50: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=] printf("*** Error: accessing spu info for spu %d\n",

[PATCH 13/19] ppc64: change %llx into %lx

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’: ../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=] printf(" %-*s =

[PATCH 17/19] ppc64: change %d into %llu

2018-03-16 Thread Mathieu Malaterre
CC arch/powerpc/xmon/xmon.o ../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_fields’: ../arch/powerpc/xmon/xmon.c:3827:10: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=] printf(" %-*s = "format"\n",