Re: [PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name

2019-12-06 Thread Sourabh Jain
On 12/7/19 12:44 AM, Greg KH wrote: > On Fri, Dec 06, 2019 at 11:57:53PM +0530, Sourabh Jain wrote: >> >> >> On 12/6/19 6:16 PM, Greg KH wrote: >>> On Fri, Dec 06, 2019 at 05:54:30PM +0530, Sourabh Jain wrote: The __compat_only_sysfs_link_entry_to_kobj function creates a symlink to a

[bug] userspace hitting sporadic SIGBUS on xfs (Power9, ppc64le), v4.19 and later

2019-12-06 Thread dftxbs3e
Hello! I am very happy that someone has found this issue. I have been suffering from rather random SIGBUS errors in similar conditions described by the author. I don't have much troubleshooting information to provide, however, I hit the issue regularly so I could investigate during that. How

[PATCH v5 2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VM.

2019-12-06 Thread Ram Pai
Commit edea902c1c1e ("powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests") disabled dma_iommu_ops path, for secure VMs. Disabling dma_iommu_ops path for secure VMs, helped enable dma_direct path. This enabled support for bounce-buffering through SWIOTLB. However it

[PATCH v5 1/2] powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor.

2019-12-06 Thread Ram Pai
H_PUT_TCE_INDIRECT hcall uses a page filled with TCE entries, as one of its parameters. On secure VMs, hypervisor cannot access the contents of this page since it gets encrypted. Hence share the page with the hypervisor, and unshare when done. Signed-off-by: Ram Pai ---

[PATCH v5 0/2] Enable IOMMU support for pseries Secure VMs

2019-12-06 Thread Ram Pai
This patch series enables IOMMU support for pseries Secure VMs. Tested using QEMU command line option: "-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4, iommu_platform=on,disable-modern=off,disable-legacy=on" and "-device virtio-blk-pci,scsi=off,bus=pci.0,

Re: [RFC] Efficiency of the phandle_cache on ppc64/SLOF

2019-12-06 Thread Segher Boessenkool
Hi, On Thu, Dec 05, 2019 at 07:37:24PM -0600, Frank Rowand wrote: > On 12/3/19 12:35 PM, Segher Boessenkool wrote: > > Btw. Some OFs mangle the phandles some way, to make it easier to catch > > people using it as an address (and similarly, mangle ihandles differently, > > so you catch confusion

RE: [PATCH v4 1/2] powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor

2019-12-06 Thread Ram Pai
On Thu, Dec 05, 2019 at 09:26:14AM +1100, Alexey Kardashevskiy wrote: > > > On 05/12/2019 07:42, Ram Pai wrote: .snip... > Do you still think, secure-VM should use H_PUT_TCE and not > H_PUT_TCE_INDIRECT? And normal VM should use H_PUT_TCE_INDIRECT? > Is there any advantage of

RE: [PATCH 09/14] powerpc/vas: Update CSB and notify process for fault CRBs

2019-12-06 Thread Haren Myneni
>  > +static void notify_process(pid_t pid, u64 fault_addr)> +{> + int rc;> + struct kernel_siginfo info;> +> + memset(, 0, sizeof(info));> +> + info.si_signo = SIGSEGV;> + info.si_errno = EFAULT;> + info.si_code = SEGV_MAPERR;> +> + info.si_addr = (void *)fault_addr;> + rcu_read_lock();> + rc =

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-2 tag (topic/kasan-bitops)

2019-12-06 Thread pr-tracker-bot
The pull request you sent on Fri, 06 Dec 2019 23:46:11 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.5-2 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/43a2898631a8beee66c1d64c1e860f43d96b2e91 Thank you! --

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-3 tag

2019-12-06 Thread pr-tracker-bot
The pull request you sent on Fri, 06 Dec 2019 23:46:53 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.5-3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/f89d416a8676fe36de8be0f7c2e1ac6cd51410a8 Thank you! --

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-06 Thread Segher Boessenkool
On Wed, Dec 04, 2019 at 05:32:54AM +0100, Christophe Leroy wrote: > Le 29/11/2019 à 19:46, Segher Boessenkool a écrit : > >The existing call_do_irq isn't C code. It doesn't do anything with r2, > >as far as I can see; __do_irq just gets whatever the caller of call_do_irq > >has. > > > >So I guess

Re: [PATCH v4 6/6] powerpc/fadump: sysfs for fadump memory reservation

2019-12-06 Thread Sourabh Jain
On 12/6/19 6:18 PM, Greg KH wrote: > On Fri, Dec 06, 2019 at 05:54:34PM +0530, Sourabh Jain wrote: >> Add a sys interface to allow querying the memory reserved by FADump for >> saving the crash dump. >> >> Also added Documentation/ABI for the new sysfs file. >> >> Signed-off-by: Sourabh Jain

[PATCH] selftests/powerpc: enable performance alerts when freezing counters on cycles_with_freeze_test selftest

2019-12-06 Thread Desnes A. Nunes do Rosario
From: Gustavo Romero When disabling freezing counters by setting MMCR0 FC bit to 0, the MMCR0 PMAE bit must also be enabled if a Performance Monitor Alert (and the cor- responding Performance Monitor Interrupt) is still desired to be received when an enabled condition or event occurs. This is

Re: [PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject

2019-12-06 Thread Sourabh Jain
On 12/6/19 6:18 PM, Greg KH wrote: > On Fri, Dec 06, 2019 at 05:54:32PM +0530, Sourabh Jain wrote: >> The /sys/firmware/opal/core and /sys/kernel/fadump_release_opalcore sysfs >> files are used to export and release the OPAL memory on PowerNV platform. >> let's organize them into a new kobject

Re: [PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 11:57:53PM +0530, Sourabh Jain wrote: > > > On 12/6/19 6:16 PM, Greg KH wrote: > > On Fri, Dec 06, 2019 at 05:54:30PM +0530, Sourabh Jain wrote: > >> The __compat_only_sysfs_link_entry_to_kobj function creates a symlink to a > >> kobject but doesn't provide an option to

Re: [PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files

2019-12-06 Thread Sourabh Jain
On 12/6/19 6:15 PM, Greg KH wrote: > On Fri, Dec 06, 2019 at 05:54:31PM +0530, Sourabh Jain wrote: >> +static struct kobj_attribute release_attr = __ATTR(release_mem, >> 0200, NULL, >>

Re: [PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name

2019-12-06 Thread Sourabh Jain
On 12/6/19 6:16 PM, Greg KH wrote: > On Fri, Dec 06, 2019 at 05:54:30PM +0530, Sourabh Jain wrote: >> The __compat_only_sysfs_link_entry_to_kobj function creates a symlink to a >> kobject but doesn't provide an option to change the symlink file name. >> >> This patch adds a wrapper function

[PATCH v18 13/13] Documentation: path-lookup: include new LOOKUP flags

2019-12-06 Thread Aleksa Sarai
Now that we have new LOOKUP flags, we should document them in the relevant path-walking documentation. And now that we've settled on a common name for nd_jump_link() style symlinks ("magic links"), use that term where magic-link semantics are described. Signed-off-by: Aleksa Sarai ---

[PATCH v18 12/13] selftests: add openat2(2) selftests

2019-12-06 Thread Aleksa Sarai
Test all of the various openat2(2) flags. A small stress-test of a symlink-rename attack is included to show that the protections against ".."-based attacks are sufficient. The main things these self-tests are enforcing are: * The struct+usize ABI for openat2(2) and copy_struct_from_user() to

[PATCH v18 11/13] open: introduce openat2(2) syscall

2019-12-06 Thread Aleksa Sarai
/* Background. */ For a very long time, extending openat(2) with new features has been incredibly frustrating. This stems from the fact that openat(2) is possibly the most famous counter-example to the mantra "don't silently accept garbage from userspace" -- it doesn't check whether unknown flags

[PATCH v18 10/13] namei: LOOKUP_{IN_ROOT, BENEATH}: permit limited ".." resolution

2019-12-06 Thread Aleksa Sarai
Allow 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 disallowed

[PATCH v18 09/13] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution

2019-12-06 Thread Aleksa Sarai
/* Background. */ Container runtimes or other administrative management processes will often interact with root filesystems while in the host mount namespace, because the cost of doing a chroot(2) on every operation is too prohibitive (especially in Go, which cannot safely use vfork). However, a

[PATCH v18 08/13] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution

2019-12-06 Thread Aleksa Sarai
/* Background. */ There are many circumstances when userspace wants to resolve a path and ensure that it doesn't go outside of a particular root directory during resolution. Obvious examples include archive extraction tools, as well as other security-conscious userspace programs. FreeBSD spun out

[PATCH v18 07/13] namei: LOOKUP_NO_XDEV: block mountpoint crossing

2019-12-06 Thread Aleksa Sarai
/* Background. */ The need to contain path operations within a mountpoint has been a long-standing usecase that userspace has historically implemented manually with liberal usage of stat(). find, rsync, tar and many other programs implement these semantics -- but it'd be much simpler to have a

[PATCH v18 06/13] namei: LOOKUP_NO_MAGICLINKS: block magic-link resolution

2019-12-06 Thread Aleksa Sarai
/* Background. */ There has always been a special class of symlink-like objects in procfs (and a few other pseudo-filesystems) which allow for non-lexical resolution of paths using nd_jump_link(). These "magic-links" do not follow traditional mount namespace boundaries, and have been used

[PATCH v18 05/13] namei: LOOKUP_NO_SYMLINKS: block symlink resolution

2019-12-06 Thread Aleksa Sarai
/* Background. */ Userspace cannot easily resolve a path without resolving symlinks, and would have to manually resolve each path component with O_PATH and O_NOFOLLOW. This is clearly inefficient, and can be fairly easy to screw up (resulting in possible security bugs). Linus has mentioned that

[PATCH v18 04/13] namei: allow set_root() to produce errors

2019-12-06 Thread Aleksa Sarai
For LOOKUP_BENEATH and LOOKUP_IN_ROOT it is necessary to ensure that set_root() is never called, and thus (for hardening purposes) it should return an error rather than permit a breakout from the root. In addition, move all of the repetitive set_root() calls to nd_jump_root(). Signed-off-by:

[PATCH v18 03/13] namei: allow nd_jump_link() to produce errors

2019-12-06 Thread Aleksa Sarai
In preparation for LOOKUP_NO_MAGICLINKS, it's necessary to add the ability for nd_jump_link() to return an error which the corresponding get_link() caller must propogate back up to the VFS. Suggested-by: Al Viro Signed-off-by: Aleksa Sarai --- fs/namei.c | 3 ++-

[PATCH v18 02/13] nsfs: clean-up ns_get_path() signature to return int

2019-12-06 Thread Aleksa Sarai
ns_get_path() and ns_get_path_cb() only ever return either NULL or an ERR_PTR. It is far more idiomatic to simply return an integer, and it makes all of the callers of ns_get_path() more straightforward to read. Fixes: e149ed2b805f ("take the targets of /proc/*/ns/* symlinks to separate fs")

[PATCH v18 01/13] namei: only return -ECHILD from follow_dotdot_rcu()

2019-12-06 Thread Aleksa Sarai
It's over-zealous to return hard errors under RCU-walk here, given that a REF-walk will be triggered for all other cases handling ".." under RCU. The original purpose of this check was to ensure that if a rename occurs such that a directory is moved outside of the bind-mount which the resolution

[PATCH v18 00/13] open: introduce openat2(2) syscall

2019-12-06 Thread Aleksa Sarai
This patchset is being developed here: Patch changelog: v18: * Further fixups from Al Viro: - Don't WARN_ON in complete_walk() check since it can be trivially triggered by userspace. Also, improve the comment so the purpose

[PATCH v16 06/25] powerpc: mm: Add p?d_leaf() definitions

2019-12-06 Thread Steven Price
walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information is provided by the p?d_leaf() functions/macros. For powerpc pmd_large() already exists and does what we

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-2 tag (topic/kasan-bitops)

2019-12-06 Thread Peter Zijlstra
On Fri, Dec 06, 2019 at 11:46:11PM +1100, Michael Ellerman wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Hi Linus, > > Please pull another powerpc update for 5.5. > > As you'll see from the diffstat this is mostly not powerpc code. In order to > do > KASAN instrumentation of

Re: [PATCH v4 6/6] powerpc/fadump: sysfs for fadump memory reservation

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 05:54:34PM +0530, Sourabh Jain wrote: > Add a sys interface to allow querying the memory reserved by FADump for > saving the crash dump. > > Also added Documentation/ABI for the new sysfs file. > > Signed-off-by: Sourabh Jain > --- >

Re: [PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 05:54:32PM +0530, Sourabh Jain wrote: > The /sys/firmware/opal/core and /sys/kernel/fadump_release_opalcore sysfs > files are used to export and release the OPAL memory on PowerNV platform. > let's organize them into a new kobject under /sys/firmware/opal/mpipl/ >

Re: [PATCH v4 1/6] Documentation/ABI: add ABI documentation for /sys/kernel/fadump_*

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 05:54:29PM +0530, Sourabh Jain wrote: > Add missing ABI documentation for existing FADump sysfs files. > > Signed-off-by: Sourabh Jain > --- > Documentation/ABI/testing/sysfs-kernel-fadump_enabled | 7 +++ >

[GIT PULL] Please pull powerpc/linux.git powerpc-5.5-3 tag

2019-12-06 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull some powerpc fixes for 5.5. This is just a regular batch of fixes, it shouldn't interact at all with the other pull request I sent for the KASAN bitops. cheers The following changes since commit

Re: [PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 05:54:30PM +0530, Sourabh Jain wrote: > The __compat_only_sysfs_link_entry_to_kobj function creates a symlink to a > kobject but doesn't provide an option to change the symlink file name. > > This patch adds a wrapper function create_sysfs_symlink_entry_to_kobj that >

[GIT PULL] Please pull powerpc/linux.git powerpc-5.5-2 tag (topic/kasan-bitops)

2019-12-06 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull another powerpc update for 5.5. As you'll see from the diffstat this is mostly not powerpc code. In order to do KASAN instrumentation of bitops we needed to juggle some of the generic bitops headers. Because those changes

Re: [PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files

2019-12-06 Thread Greg KH
On Fri, Dec 06, 2019 at 05:54:31PM +0530, Sourabh Jain wrote: > +static struct kobj_attribute release_attr = __ATTR(release_mem, > 0200, NULL, > fadump_release_memory_store); > -static struct kobj_attribute

[PATCH v4 6/6] powerpc/fadump: sysfs for fadump memory reservation

2019-12-06 Thread Sourabh Jain
Add a sys interface to allow querying the memory reserved by FADump for saving the crash dump. Also added Documentation/ABI for the new sysfs file. Signed-off-by: Sourabh Jain --- Documentation/ABI/testing/sysfs-kernel-fadump| 7 +++ Documentation/powerpc/firmware-assisted-dump.rst |

[PATCH v4 5/6] Documentation/ABI: mark /sys/kernel/fadump_* sysfs files deprecated

2019-12-06 Thread Sourabh Jain
Add a deprecation note in FADump sysfs ABI documentation files and move them from ABI/testing to ABI/obsolete directory. Signed-off-by: Sourabh Jain --- .../ABI/{testing => obsolete}/sysfs-kernel-fadump_enabled | 2 ++ .../{testing => obsolete}/sysfs-kernel-fadump_registered | 2 ++

[PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject

2019-12-06 Thread Sourabh Jain
The /sys/firmware/opal/core and /sys/kernel/fadump_release_opalcore sysfs files are used to export and release the OPAL memory on PowerNV platform. let's organize them into a new kobject under /sys/firmware/opal/mpipl/ directory. A symlink is added to maintain the backward compatibility for

[PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files

2019-12-06 Thread Sourabh Jain
As the number of FADump sysfs files increases it is hard to manage all of them inside /sys/kernel directory. It's better to have all the FADump related sysfs files in a dedicated directory /sys/kernel/fadump. But in order to maintain backward compatibility a symlink has been added for every sysfs

[PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name

2019-12-06 Thread Sourabh Jain
The __compat_only_sysfs_link_entry_to_kobj function creates a symlink to a kobject but doesn't provide an option to change the symlink file name. This patch adds a wrapper function create_sysfs_symlink_entry_to_kobj that extends the __compat_only_sysfs_link_entry_to_kobj functionality which

[PATCH v4 1/6] Documentation/ABI: add ABI documentation for /sys/kernel/fadump_*

2019-12-06 Thread Sourabh Jain
Add missing ABI documentation for existing FADump sysfs files. Signed-off-by: Sourabh Jain --- Documentation/ABI/testing/sysfs-kernel-fadump_enabled | 7 +++ Documentation/ABI/testing/sysfs-kernel-fadump_registered | 8 Documentation/ABI/testing/sysfs-kernel-fadump_release_mem

[PATCH v4 0/6] reorganize and add FADump sysfs files

2019-12-06 Thread Sourabh Jain
Currently, FADump sysfs files are present inside /sys/kernel directory. But as the number of FADump sysfs file increases it is not a good idea to push all of them in /sys/kernel directory. It is better to have separate directory to keep all the FADump sysfs files. Patch series reorganizes the

Re: [PATCH v3 1/2] powerpc/vcpu: Assume dedicated processors as non-preempt

2019-12-06 Thread Vaidyanathan Srinivasan
* Srikar Dronamraju [2019-12-05 14:02:17]: > With commit 247f2f6f3c70 ("sched/core: Don't schedule threads on pre-empted > vCPUs"), scheduler avoids preempted vCPUs to schedule tasks on wakeup. > This leads to wrong choice of CPU, which in-turn leads to larger wakeup > latencies. Eventually, it

Re: [PATCH 0/3] pseries: Track and expose idle PURR and SPURR ticks

2019-12-06 Thread Naveen N. Rao
Naveen N. Rao wrote: Hi Nathan, Nathan Lynch wrote: Hi Kamalesh, Kamalesh Babulal writes: On 12/5/19 3:54 AM, Nathan Lynch wrote: "Gautham R. Shenoy" writes: Tools such as lparstat which are used to compute the utilization need to know [S]PURR ticks when the cpu was busy or idle. The