Re: [PATCH] powerpc/hw_breakpoint: move instruction stepping out of hw_breakpoint_handler()

2019-07-06 Thread Christophe Leroy
Le 03/07/2019 à 08:20, Ravi Bangoria a écrit : On 6/28/19 9:25 PM, Christophe Leroy wrote: On 8xx, breakpoints stop after executing the instruction, so stepping/emulation is not needed. Move it into a sub-function and remove the #ifdefs. Signed-off-by: Christophe Leroy --- Reviewed-by:

Re: [v3 2/7] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-06 Thread Nicholas Piggin
Santosh Sivaraj's on July 6, 2019 7:26 am: > From: Balbir Singh > > The code currently assumes PAGE_SHIFT as the shift value of > the pfn, This comment doesn't really make sense on its own. Linux pfns are always units of page shift, so if it's not that then it's not a pfn. I think you want the

[v4 0/6] powerpc: implement machine check safe memcpy

2019-07-06 Thread Santosh Sivaraj
During a memcpy from a pmem device, if a machine check exception is generated we end up in a panic. In case of fsdax read, this should only result in a -EIO. Avoid MCE by implementing memcpy_mcsafe. Before this patch series: ``` bash-4.4# mount -o dax /dev/pmem0 /mnt/pmem/ [ 7621.714094] Disablin

[v4 1/6] powerpc/mce: Make machine_check_ue_event() static

2019-07-06 Thread Santosh Sivaraj
From: Reza Arbab The function doesn't get used outside this file, so make it static. Signed-off-by: Reza Arbab Signed-off-by: Santosh Sivaraj Reviewed-by: Nicholas Piggin --- arch/powerpc/kernel/mce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel

[v4 2/6] powerpc/mce: Bug fixes for MCE handling in kernel space

2019-07-06 Thread Santosh Sivaraj
From: Balbir Singh The code currently assumes PAGE_SHIFT as the shift value of the pfn, this works correctly (mostly) for user space pages, but the correct thing to do is 1. Extract the shift value returned via the pte-walk API's 2. Use the shift value to access the instruction address. Note, t

[v4 3/6] powerpc/memcpy: Add memcpy_mcsafe for pmem

2019-07-06 Thread Santosh Sivaraj
From: Balbir Singh The pmem infrastructure uses memcpy_mcsafe in the pmem layer so as to convert machine check exceptions into a return value on failure in case a machine check exception is encountered during the memcpy. The return value is the number of bytes remaining to be copied. This patch

[v4 4/6] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-06 Thread Santosh Sivaraj
If we take a UE on one of the instructions with a fixup entry, set nip to continue exucution at the fixup entry. Stop processing the event further or print it. Based-on-patch-by: Reza Arbab Cc: Reza Arbab Cc: Mahesh Salgaonkar Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h

[v4 5/6] powerpc: add machine check safe copy_to_user

2019-07-06 Thread Santosh Sivaraj
Use memcpy_mcsafe() implementation to define copy_to_user_mcsafe() Signed-off-by: Santosh Sivaraj --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/uaccess.h | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig in

[v4 6/6] powerpc/64s: save r13 in MCE handler (simulator workaroud)

2019-07-06 Thread Santosh Sivaraj
From: Reza Arbab Testing my memcpy_mcsafe() work in progress with an injected UE, I get an error like this immediately after the function returns: BUG: Unable to handle kernel data access at 0x7fff84dec8f8 Faulting instruction address: 0xc008009c00b0 Oops: Kernel access of bad area, sig: 11

Re: [v3 4/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-07-06 Thread Nicholas Piggin
Santosh Sivaraj's on July 6, 2019 7:26 am: > If we take a UE on one of the instructions with a fixup entry, set nip > to continue exucution at the fixup entry. Stop processing the event > further or print it. Minor nit, but can you instead a field in the mce data structure that describes the prope

Re: [v3 7/7] powerpc/64s: save r13 in MCE handler (simulator workaroud)

2019-07-06 Thread Nicholas Piggin
Santosh Sivaraj's on July 6, 2019 7:26 am: > From: Reza Arbab > > Testing my memcpy_mcsafe() work in progress with an injected UE, I get > an error like this immediately after the function returns: > > BUG: Unable to handle kernel data access at 0x7fff84dec8f8 > Faulting instruction address: 0xc

Re: [v3 5/7] powerpc/memcpy_mcsafe: return remaining bytes

2019-07-06 Thread Nicholas Piggin
Christophe Leroy's on July 6, 2019 4:16 pm: > > > Le 05/07/2019 à 23:26, Santosh Sivaraj a écrit : >> memcpy_mcsafe currently return -EFAULT on a machine check exception, change >> it to return the remaining bytes that needs to be copied, so that machine >> check safe copy_to_user can maintain th

Re: [v4 5/6] powerpc: add machine check safe copy_to_user

2019-07-06 Thread Christophe Leroy
Le 06/07/2019 à 11:46, Santosh Sivaraj a écrit : Use memcpy_mcsafe() implementation to define copy_to_user_mcsafe() Signed-off-by: Santosh Sivaraj --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/uaccess.h | 14 ++ 2 files changed, 15 insertions(+) di

Re: [PATCH 18/39] docs: admin-guide: add kdump documentation into it

2019-07-06 Thread Mauro Carvalho Chehab
Em Fri, 5 Jul 2019 13:59:04 +0800 Dave Young escreveu: > On 07/05/19 at 11:43am, Alex Shi wrote: > > > > > > 在 2019/6/28 下午8:30, Mauro Carvalho Chehab 写道: > > > The Kdump documentation describes procedures with admins use > > > in order to solve issues on their systems. > > > > > > Signed-of

[PATCH v9 01/10] namei: obey trailing magic-link DAC permissions

2019-07-06 Thread Aleksa Sarai
The ability for userspace to "re-open" file descriptors through /proc/self/fd has been a very useful tool for all sorts of usecases (container runtimes are one common example). However, the current interface for doing this has resulted in some pretty subtle security holes. Userspace can re-open a f

[PATCH v9 00/10] namei: openat2(2) path resolution restrictions

2019-07-06 Thread Aleksa Sarai
Patch changelog: v9: * Replace resolveat(2) with openat2(2). [Linus] * Output a warning to dmesg if may_open_magiclink() is violated. * Add an openat2(O_CREAT) testcase. v8: * Default to O_CLOEXEC to match other new fd-creation syscalls (users can always disable O_CLOEXEC

[PATCH v9 03/10] open: O_EMPTYPATH: procfs-less file descriptor re-opening

2019-07-06 Thread Aleksa Sarai
Userspace has made use of /proc/self/fd very liberally to allow for descriptors to be re-opened. There are a wide variety of uses for this feature, but it has always required constructing a pathname and could not be done without procfs mounted. The obvious solution for this is to extend openat(2) t

[PATCH v9 02/10] procfs: switch magic-link modes to be more sane

2019-07-06 Thread Aleksa Sarai
Now that magic-link modes are obeyed for file re-opening purposes, some of the pre-existing magic-link modes need to be adjusted to be more semantically correct. The most blatant example of this is /proc/self/exe, which had a mode of a+rwx even though tautologically the file could never be opened

[PATCH v9 08/10] open: openat2(2) syscall

2019-07-06 Thread Aleksa Sarai
The most obvious syscall to add support for the new LOOKUP_* scoping flags would be openat(2). However, there are a few reasons to not do this: * The new LOOKUP_* flags are intended to be security features, and openat(2) will silently ignore all unknown flags. This means that users would ne

[PATCH v9 06/10] namei: LOOKUP_IN_ROOT: chroot-like path resolution

2019-07-06 Thread Aleksa Sarai
The primary motivation for the need for this flag is container runtimes which have to interact with malicious root filesystems in the host namespaces. One of the first requirements for a container runtime to be secure against a malicious rootfs is that they correctly scope symlinks (that is, they s

[PATCH v9 04/10] namei: split out nd->dfd handling to dirfd_path_init

2019-07-06 Thread Aleksa Sarai
Previously, path_init's handling of *at(dfd, ...) was only done once, but with LOOKUP_BENEATH (and LOOKUP_IN_ROOT) we have to parse the initial nd->path at different times (before or after absolute path handling) depending on whether we have been asked to scope resolution within a root. Signed-off

[PATCH v9 10/10] selftests: add openat2(2) selftests

2019-07-06 Thread Aleksa Sarai
Test all of the various openat2(2) flags, as well as how file descriptor re-opening works. A small stress-test of a symlink-rename attack is included to show that the protections against ".."-based attacks are sufficient. In addition, the memfd selftest is fixed to no longer depend on the now-disa

[PATCH v9 09/10] kselftest: save-and-restore errno to allow for %m formatting

2019-07-06 Thread Aleksa Sarai
Previously, using "%m" in a ksft_* format string can result in strange output because the errno value wasn't saved before calling other libc functions. The solution is to simply save and restore the errno before we format the user-supplied format string. Signed-off-by: Aleksa Sarai --- tools/tes

[PATCH v9 07/10] namei: aggressively check for nd->root escape on ".." resolution

2019-07-06 Thread Aleksa Sarai
This patch allows for LOOKUP_BENEATH and LOOKUP_IN_ROOT to safely permit ".." resolution (in the case of LOOKUP_BENEATH the resolution will still fail if ".." resolution would resolve a path outside of the root -- while LOOKUP_IN_ROOT will chroot(2)-style scope it). magic-link jumps are still disal

[PATCH v9 05/10] namei: O_BENEATH-style path resolution flags

2019-07-06 Thread Aleksa Sarai
Add the following flags to allow various restrictions on path resolution (these affect the *entire* resolution, rather than just the final path component -- as is the case with most other AT_* flags). The primary justification for these flags is to allow for programs to be far more strict about ho

[PATCH v2] tpm: tpm_ibm_vtpm: Fix unallocated banks

2019-07-06 Thread Nayna Jain
The nr_allocated_banks and allocated banks are initialized as part of tpm_chip_register. Currently, this is done as part of auto startup function. However, some drivers, like the ibm vtpm driver, do not run auto startup during initialization. This results in uninitialized memory issue and causes a

Re: [PATCH] tpm: fixes uninitialized allocated banks for IBM vtpm driver

2019-07-06 Thread Nayna
On 07/05/2019 01:50 PM, Jarkko Sakkinen wrote: On Fri, 2019-07-05 at 11:32 -0400, Nayna wrote: I am not sure of the purpose of tpm_stop_chip(), so I have left it as it is. Jarkko, what do you think about the change ? Stefan right. Your does not work, or will randomly work or not work dependi