[PATCH v4 4/9] drm/i915/perf: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to i915_perf monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to i915_perf subsystem remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure i915_perf monitoring is discouraged with respect to

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

2019-12-18 Thread Michael Ellerman
Linus Torvalds writes: > On Tue, Dec 17, 2019 at 10:04 AM Linus Torvalds > wrote: >> >> Let me think about it. > > How about we just get rid of the union entirely, and just use > 'unsigned long' or 'unsigned long long' depending on the size. > > Something like the attached patch - it still

[PATCH v4 9/9] drivers/oprofile: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to the monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure monitoring is discouraged with respect to CAP_SYS_PERFMON capability.

[Bug 205889] CONFIG_PPC_85xx with CONFIG_CORENET_GENERIC outputs uImage instead of zImage

2019-12-18 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205889 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added CC|

[PATCH v15 13/23] selftests/vm/pkeys: Introduce powerpc support

2019-12-18 Thread Sandipan Das
From: Ram Pai This makes use of the abstractions added earlier and introduces support for powerpc. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/pkey-helpers.h| 2 + tools/testing/selftests/vm/pkey-powerpc.h|

[PATCH v15 17/23] selftests/vm/pkeys: Associate key on a mapped page and detect write violation

2019-12-18 Thread Sandipan Das
From: Ram Pai Detect write-violation on a page to which write-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 12

Re: [RFC PATCH 1/2] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush

2019-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2019 at 10:52:53AM +0530, Aneesh Kumar K.V wrote: > Upstream ppc64 is broken after the commit: a46cc7a90fd8 > ("powerpc/mm/radix: Improve TLB/PWC flushes"). > > Also the patches are not adding any extra TLBI on either radix or hash. > > Considering we need to backport this to

[PATCH v4 2/9] perf/core: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to perf_events monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to perf_events subsystem remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure perf_events monitoring is discouraged with respect to

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

2019-12-18 Thread Christian Borntraeger
On 12.12.19 21:49, Linus Torvalds wrote: > On Thu, Dec 12, 2019 at 11:34 AM Will Deacon wrote: >> >> The root of my concern in all of this, and what started me looking at it in >> the first place, is the interaction with 'typeof()'. Inheriting 'volatile' >> for a pointer means that local

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

2019-12-18 Thread Will Deacon
On Wed, Dec 18, 2019 at 11:22:05AM +0100, Christian Borntraeger wrote: > On 12.12.19 21:49, Linus Torvalds wrote: > > On Thu, Dec 12, 2019 at 11:34 AM Will Deacon wrote: > >> > >> The root of my concern in all of this, and what started me looking at it in > >> the first place, is the interaction

[Bug 205885] [Bisected] BUG: KASAN: null-ptr-deref in strncpy+0x3c/0x60

2019-12-18 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205885 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added Status|NEW |RESOLVED

Re: [PATCH v2 2/3] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush

2019-12-18 Thread Aneesh Kumar K.V
On 12/18/19 2:47 PM, Peter Zijlstra wrote: On Wed, Dec 18, 2019 at 11:05:29AM +0530, Aneesh Kumar K.V wrote: From: Peter Zijlstra Architectures for which we have hardware walkers of Linux page table should flush TLB on mmu gather batch allocation failures and batch flush. Some architectures

Re: [PATCH v2 2/3] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush

2019-12-18 Thread Michael Ellerman
"Aneesh Kumar K.V" writes: > On 12/18/19 2:47 PM, Peter Zijlstra wrote: >> On Wed, Dec 18, 2019 at 11:05:29AM +0530, Aneesh Kumar K.V wrote: >>> From: Peter Zijlstra >>> >>> Architectures for which we have hardware walkers of Linux page table should >>> flush TLB on mmu gather batch allocation

[PATCH v4 7/9] parisc/perf: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to the monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure monitoring is discouraged with respect to CAP_SYS_PERFMON capability.

Re: [PATCH 1/2] powerpc/pseries/svm: Don't access some SPRs

2019-12-18 Thread Michael Ellerman
Sukadev Bhattiprolu writes: > Ultravisor disables some CPU features like EBB and BHRB in the HFSCR > for secure virtual machines (SVMs). If the SVMs attempt to access > related registers, they will get a Program Interrupt. > > Use macros/wrappers to skip accessing EBB and BHRB registers in secure

[PATCH v4 6/9] powerpc/perf: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to the monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure monitoring is discouraged with respect to CAP_SYS_PERFMON capability.

Re: [PATCH] powerpc/setup_64: use DEFINE_DEBUGFS_ATTRIBUTE to define fops_rfi_flush

2019-12-18 Thread Michael Ellerman
Chen Zhou writes: > Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for > debugfs files. > > Semantic patch information: > Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() > imposes some significant overhead as compared to > DEFINE_DEBUGFS_ATTRIBUTE +

Re: [PATCH v3 3/3] powerpc: Book3S 64-bit "heavyweight" KASAN support

2019-12-18 Thread Christophe Leroy
On 12/18/2019 04:32 AM, Daniel Axtens wrote: Daniel Axtens writes: Hi Christophe, I'm working through your feedback, thank you. Regarding this one: --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -2081,7 +2081,14 @@ void show_stack(struct task_struct *tsk,

[PATCH v15 21/23] selftests/vm/pkeys: Fix number of reserved powerpc pkeys

2019-12-18 Thread Sandipan Das
From: "Desnes A. Nunes do Rosario" The number of reserved pkeys in a PowerNV environment is different from that on PowerVM or KVM. Tested on PowerVM and PowerNV environments. Signed-off-by: "Desnes A. Nunes do Rosario" Signed-off-by: Ram Pai Signed-off-by: Sandipan Das ---

[PATCH v4 3/9] perf tool: extend Perf tool with CAP_SYS_PERFMON capability support

2019-12-18 Thread Alexey Budankov
Extend error messages to mention CAP_SYS_PERFMON capability as an option to substitute CAP_SYS_ADMIN capability for secure system performance monitoring and observability operations. Make perf_event_paranoid_check() and __cmd_ftrace() to be aware of CAP_SYS_PERFMON capability. Signed-off-by:

[PATCH v4 5/9] trace/bpf_trace: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to bpf_trace monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to bpf_trace monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure bpf_trace monitoring is discouraged with respect to

[PATCH v4 8/9] drivers/perf: open access for CAP_SYS_PERFMON privileged process

2019-12-18 Thread Alexey Budankov
Open access to monitoring for CAP_SYS_PERFMON privileged processes. For backward compatibility reasons access to the monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure monitoring is discouraged with respect to CAP_SYS_PERFMON capability.

[PATCH v17 06/23] powerpc: mm: Add p?d_leaf() definitions

2019-12-18 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 p?d_is_leaf() functions already exist. Export

Re: [PATCH 05/18] powerpc sstep: Prepare to support prefixed instructions

2019-12-18 Thread Daniel Axtens
Jordan Niethe writes: > Currently all instructions are a single word long. A future ISA version > will include prefixed instructions which have a double word length. The > functions used for analysing and emulating instructions need to be > modified so that they can handle these new instruction

Re: [PATCH v11 06/25] mm: fix get_user_pages_remote()'s handling of FOLL_LONGTERM

2019-12-18 Thread Kirill A. Shutemov
On Mon, Dec 16, 2019 at 02:25:18PM -0800, John Hubbard wrote: > As it says in the updated comment in gup.c: current FOLL_LONGTERM > behavior is incompatible with FAULT_FLAG_ALLOW_RETRY because of the > FS DAX check requirement on vmas. > > However, the corresponding restriction in

Re: [PATCH v6 05/10] mm/memory_hotplug: Shrink zones when offlining memory

2019-12-18 Thread David Hildenbrand
On 01.12.19 00:21, Andrew Morton wrote: > On Sun, 27 Oct 2019 23:45:52 +0100 David Hildenbrand wrote: > >> I think I just found an issue with try_offline_node(). >> try_offline_node() is pretty much broken already (touches garbage >> memmaps and will not considers mixed NIDs within sections),

Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines

2019-12-18 Thread Kirill A. Shutemov
On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: > +static void put_compound_head(struct page *page, int refs) > +{ > + /* Do a get_page() first, in case refs == page->_refcount */ > + get_page(page); > + page_ref_sub(page, refs); > + put_page(page); > +} It's not

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread Kirill A. Shutemov
On Mon, Dec 16, 2019 at 02:25:16PM -0800, John Hubbard wrote: > An upcoming patch changes and complicates the refcounting and > especially the "put page" aspects of it. In order to keep > everything clean, refactor the devmap page release routines: > > * Rename put_devmap_managed_page() to

Re: [PATCH 18/18] powerpc/fault: Use analyse_instr() to check for store with updates to sp

2019-12-18 Thread Daniel Axtens
Jordan Niethe writes: > A user-mode access to an address a long way below the stack pointer is > only valid if the instruction is one that would update the stack pointer > to the address accessed. This is checked by directly looking at the > instructions op-code. As a result is does not take

Re: [PATCH 08/18] powerpc sstep: Add support for prefixed VSX load/stores

2019-12-18 Thread Daniel Axtens
Jordan Niethe writes: > This adds emulation support for the following prefixed VSX load/stores: > * Prefixed Load VSX Scalar Doubleword (plxsd) > * Prefixed Load VSX Scalar Single-Precision (plxssp) > * Prefixed Load VSX Vector [0|1] (plxv, plxv0, plxv1) > * Prefixed Store VSX Scalar

Re: [PATCH v2 2/3] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush

2019-12-18 Thread Peter Zijlstra
On Thu, Dec 19, 2019 at 12:13:48AM +1100, Michael Ellerman wrote: > >> I'm a little confused though; if nohash is a software TLB fill, why do > >> you need a TLBI for tables? > >> > > > > nohash (AKA book3e) has different mmu modes. I don't follow all the > > details w.r.t book3e. Paul or

[PATCH v15 14/23] selftests/vm/pkeys: Fix assertion in test_pkey_alloc_exhaust()

2019-12-18 Thread Sandipan Das
From: Ram Pai Some pkeys which are valid on the hardware are reserved and not available for application use. These keys cannot be allocated. test_pkey_alloc_exhaust() tries to account for these and has an assertion which validates if all available pkeys have been exahaustively allocated.

[PATCH v15 18/23] selftests/vm/pkeys: Detect write violation on a mapped access-denied-key page

2019-12-18 Thread Sandipan Das
From: Ram Pai Detect write-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 13

[PATCH v15 20/23] selftests/vm/pkeys: Test correct behaviour of pkey-0

2019-12-18 Thread Sandipan Das
From: Ram Pai Ensure that pkey-0 is allocated on start and that it can be attached dynamically in various modes, without failures. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 53

Re: [PATCH v2 2/3] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush

2019-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2019 at 11:05:29AM +0530, Aneesh Kumar K.V wrote: > From: Peter Zijlstra > > Architectures for which we have hardware walkers of Linux page table should > flush TLB on mmu gather batch allocation failures and batch flush. Some > architectures like POWER supports multiple

Re: [PATCH v2 3/3] asm-generic/tlb: Avoid potential double flush

2019-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2019 at 11:05:30AM +0530, Aneesh Kumar K.V wrote: > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -402,7 +402,12 @@ tlb_update_vma_flags(struct mmu_gather *tlb, struct > vm_area_struct *vma) { } > > static inline void tlb_flush_mmu_tlbonly(struct

[PATCH v15 12/23] selftests/vm/pkeys: Introduce generic pkey abstractions

2019-12-18 Thread Sandipan Das
From: Ram Pai This introduces some generic abstractions and provides the corresponding architecture-specfic implementations for these abstractions. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Signed-off-by: Sandipan Das ---

[PATCH v15 19/23] selftests/vm/pkeys: Introduce a sub-page allocator

2019-12-18 Thread Sandipan Das
From: Ram Pai This introduces a new allocator that allocates 4K hardware pages to back 64K linux pages. This allocator is available only on powerpc. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Signed-off-by: Sandipan Das ---

[PATCH v15 09/23] selftests/vm/pkeys: Fix assertion in pkey_disable_set/clear()

2019-12-18 Thread Sandipan Das
From: Ram Pai In some cases, a pkey's bits need not necessarily change in a way that the value of the pkey register increases when performing a pkey_disable_set() or decreases when performing a pkey_disable_clear(). For example, on powerpc, if a pkey's current state is PKEY_DISABLE_ACCESS and

[PATCH v15 10/23] selftests/vm/pkeys: Fix alloc_random_pkey() to make it really random

2019-12-18 Thread Sandipan Das
From: Ram Pai alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. This fixes it. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 3 ++-

[PATCH v15 22/23] selftests/vm/pkeys: Override access right definitions on powerpc

2019-12-18 Thread Sandipan Das
From: Ram Pai Some platforms hardcode the x86 values for PKEY_DISABLE_ACCESS and PKEY_DISABLE_WRITE such as those in: /usr/include/bits/mman-shared.h. This overrides the definitions with correct values for powerpc. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by:

[PATCH v15 02/23] selftests/vm/pkeys: Rename all references to pkru to a generic name

2019-12-18 Thread Sandipan Das
From: Ram Pai This renames pkru references to "pkey_reg" or "pkey" based on the usage. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Reviewed-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/pkey-helpers.h|

[PATCH v15 16/23] selftests/vm/pkeys: Associate key on a mapped page and detect access violation

2019-12-18 Thread Sandipan Das
From: Ram Pai Detect access-violation on a page to which access-disabled key is associated much after the page is mapped. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen Signed-off: Sandipan Das --- tools/testing/selftests/vm/protection_keys.c | 19

[PATCH v15 23/23] selftests: vm: pkeys: Use the correct page size on powerpc

2019-12-18 Thread Sandipan Das
Both 4K and 64K pages are supported on powerpc. Parts of the selftest code perform alignment computations based on the PAGE_SIZE macro which is currently hardcoded to 64K for powerpc. This causes some test failures on kernels configured with 4K page size. This problem is solved by determining the

[PATCH v15 00/24] selftests, powerpc, x86: Memory Protection Keys

2019-12-18 Thread Sandipan Das
Memory protection keys enables an application to protect its address space from inadvertent access by its own code. This feature is now enabled on powerpc and has been available since 4.16-rc1. The patches move the selftests to arch neutral directory and enhance their test coverage. Testing

Re: [PATCH 05/18] powerpc sstep: Prepare to support prefixed instructions

2019-12-18 Thread Daniel Axtens
Jordan Niethe writes: > Currently all instructions are a single word long. A future ISA version > will include prefixed instructions which have a double word length. The > functions used for analysing and emulating instructions need to be > modified so that they can handle these new instruction

[PATCH v4 0/7] Introduce CAP_SYS_PERFMON to secure system performance monitoring and observability

2019-12-18 Thread Alexey Budankov
Currently access to perf_events, i915_perf and other performance monitoring and observability subsystems of the kernel is open for a privileged process [1] with CAP_SYS_ADMIN capability enabled in the process effective set [2]. This patch set introduces CAP_SYS_PERFMON capability devoted to

[PATCH v15 11/23] selftests: vm: pkeys: Use the correct huge page size

2019-12-18 Thread Sandipan Das
The huge page size can vary across architectures. This will ensure that the correct huge page size is used when accessing the hugetlb controls under sysfs. Instead of using a hardcoded page size (i.e. 2MB), this now uses the HPAGE_SIZE macro which is arch-specific. Cc: Dave Hansen Cc: Florian

[PATCH v4 1/9] capabilities: introduce CAP_SYS_PERFMON to kernel and user space

2019-12-18 Thread Alexey Budankov
Introduce CAP_SYS_PERFMON capability devoted to secure system performance monitoring and observability operations so that CAP_SYS_PERFMON would assist CAP_SYS_ADMIN capability in its governing role for perf_events, i915_perf and other subsystems of the kernel. CAP_SYS_PERFMON intends to harden

[PATCH v15 01/23] selftests/x86/pkeys: Move selftests to arch-neutral directory

2019-12-18 Thread Sandipan Das
From: Ram Pai cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Acked-by: Ingo Molnar Acked-by: Dave Hansen Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile

[PATCH v15 04/23] selftests/vm/pkeys: Move some definitions to arch-specific header

2019-12-18 Thread Sandipan Das
From: Thiago Jung Bauermann This moves definitions which have arch-specific values to the x86-specific header in preparation for multi-arch support. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann Acked-by: Dave Hansen Signed-off-by: Sandipan

[PATCH v15 05/23] selftests/vm/pkeys: Make gcc check arguments of sigsafe_printf()

2019-12-18 Thread Sandipan Das
From: Thiago Jung Bauermann This will help us ensure we print pkey_reg_t values correctly in different architectures. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Sandipan Das --- tools/testing/selftests/vm/pkey-helpers.h | 4 1 file changed, 4 insertions(+) diff --git

[PATCH v15 15/23] selftests/vm/pkeys: Improve checks to determine pkey support

2019-12-18 Thread Sandipan Das
From: Ram Pai For the pkeys subsystem to work, both the CPU and the kernel need to have support. So, additionally check if the kernel supports pkeys apart from the CPU feature checks. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Signed-off-by: Sandipan Das ---

[PATCH v15 08/23] selftests/vm/pkeys: Fix pkey_disable_clear()

2019-12-18 Thread Sandipan Das
From: Ram Pai Currently, pkey_disable_clear() sets the specified bits instead clearing them. This has been dead code up to now because its only callers i.e. pkey_access/write_allow() are also unused. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai Acked-by: Dave Hansen

Re: [PATCH 03/18] powerpc: Add PREFIXED SRR1 bit for future ISA version

2019-12-18 Thread Daniel Axtens
Jordan Niethe writes: > Add the bit definition for exceptions caused by prefixed instructions. > > Signed-off-by: Jordan Niethe > --- > arch/powerpc/include/asm/reg.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h >

Re: [PATCH v2 1/3] powerpc/mmu_gather: Enable RCU_TABLE_FREE even for !SMP case

2019-12-18 Thread Peter Zijlstra
I'm going to assume you'll take these 3 patches through the powerpc tree for convenience, a few small nits, but otherwise ACK on the lot. On Wed, Dec 18, 2019 at 11:05:28AM +0530, Aneesh Kumar K.V wrote: > A follow up patch is going to make sure we correctly invalidate page walk > cache >

Re: [PATCH v4 1/9] capabilities: introduce CAP_SYS_PERFMON to kernel and user space

2019-12-18 Thread Stephen Smalley
On 12/18/19 4:24 AM, Alexey Budankov wrote: Introduce CAP_SYS_PERFMON capability devoted to secure system performance monitoring and observability operations so that CAP_SYS_PERFMON would assist CAP_SYS_ADMIN capability in its governing role for perf_events, i915_perf and other subsystems of

Re: [PATCH v6 05/10] mm/memory_hotplug: Shrink zones when offlining memory

2019-12-18 Thread Andrew Morton
On Wed, 18 Dec 2019 18:08:04 +0100 David Hildenbrand wrote: > On 01.12.19 00:21, Andrew Morton wrote: > > On Sun, 27 Oct 2019 23:45:52 +0100 David Hildenbrand > > wrote: > > > >> I think I just found an issue with try_offline_node(). > >> try_offline_node() is pretty much broken already

Re: [PATCH v15 06/23] selftests/vm/pkeys: Typecast the pkey register

2019-12-18 Thread Dave Hansen
On 12/17/19 11:51 PM, Sandipan Das wrote: > write_pkey_reg(pkey_reg); > - dprintf4("pkey_reg now: %08x\n", read_pkey_reg()); > + dprintf4("pkey_reg now: "PKEY_REG_FMT"\n", read_pkey_reg()); > } > > #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) > diff --git

Re: [PATCH v15 00/24] selftests, powerpc, x86: Memory Protection Keys

2019-12-18 Thread Dave Hansen
On 12/17/19 11:51 PM, Sandipan Das wrote: > Testing > --- > Verified for correctness on powerpc. Need help with x86 testing as I > do not have access to a Skylake server. Client platforms like Coffee > Lake do not have the required feature bits set in CPUID. FWIW, you can get a Skylake Server

Re: [PATCH v15 06/23] selftests/vm/pkeys: Typecast the pkey register

2019-12-18 Thread Michal Suchánek
On Wed, Dec 18, 2019 at 12:46:50PM -0800, Dave Hansen wrote: > On 12/17/19 11:51 PM, Sandipan Das wrote: > > write_pkey_reg(pkey_reg); > > - dprintf4("pkey_reg now: %08x\n", read_pkey_reg()); > > + dprintf4("pkey_reg now: "PKEY_REG_FMT"\n", read_pkey_reg()); > > } > > > > #define

Re: [PATCH v15 06/23] selftests/vm/pkeys: Typecast the pkey register

2019-12-18 Thread Dave Hansen
On 12/18/19 12:59 PM, Michal Suchánek wrote: >> I'd really just rather do %016lx *everywhere* than sprinkle the >> PKEY_REG_FMTs around. > Does lx work with u32 without warnings? Either way, I'd be happy to just make the x86 one u64 to make the whole thing look more sane,

Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines

2019-12-18 Thread Kirill A. Shutemov
On Wed, Dec 18, 2019 at 02:15:53PM -0800, John Hubbard wrote: > On 12/18/19 7:52 AM, Kirill A. Shutemov wrote: > > On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: > > > +static void put_compound_head(struct page *page, int refs) > > > +{ > > > + /* Do a get_page() first, in case refs

Re: [PATCH v15 06/23] selftests/vm/pkeys: Typecast the pkey register

2019-12-18 Thread Michal Suchánek
On Wed, Dec 18, 2019 at 01:01:46PM -0800, Dave Hansen wrote: > On 12/18/19 12:59 PM, Michal Suchánek wrote: > >> I'd really just rather do %016lx *everywhere* than sprinkle the > >> PKEY_REG_FMTs around. > > Does lx work with u32 without warnings? > > Either way, I'd be happy to just make the x86

Re: [PATCH 1/1] kvm/book3s_64: Fixes crash caused by not cleaning vhost IOTLB

2019-12-18 Thread Leonardo Bras
On Wed, 2019-12-18 at 15:53 +1100, Alexey Kardashevskiy wrote: > H_STUFF_TCE is always called with 0. Well, may be some AIX somewhere > calls it with a value other than zero, and I probably saw some other > value somewhere but in QEMU/KVM case it is 0 so you effectively disable > in-kernel

Re: [PATCH 1/2] powerpc/pseries/svm: Don't access some SPRs

2019-12-18 Thread Sukadev Bhattiprolu
Michael Ellerman [m...@ellerman.id.au] wrote: > > eg. here. > > This is the fast path of context switch. > > That expands to: > > if (!(mfmsr() & MSR_S)) > asm volatile("mfspr %0, SPRN_BESCR" : "=r" (rval)); > if (!(mfmsr() & MSR_S)) > asm

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread John Hubbard
On 12/18/19 8:04 AM, Kirill A. Shutemov wrote: On Mon, Dec 16, 2019 at 02:25:16PM -0800, John Hubbard wrote: An upcoming patch changes and complicates the refcounting and especially the "put page" aspects of it. In order to keep everything clean, refactor the devmap page release routines: *

[PATCH v4 2/4] kasan: Document support on 32-bit powerpc

2019-12-18 Thread Daniel Axtens
KASAN is supported on 32-bit powerpc and the docs should reflect this. Suggested-by: Christophe Leroy Reviewed-by: Christophe Leroy Signed-off-by: Daniel Axtens --- Documentation/dev-tools/kasan.rst | 3 ++- Documentation/powerpc/kasan.txt | 12 2 files changed, 14

Re: [PATCH v11 06/25] mm: fix get_user_pages_remote()'s handling of FOLL_LONGTERM

2019-12-18 Thread John Hubbard
On 12/18/19 8:19 AM, Kirill A. Shutemov wrote: ... diff --git a/mm/gup.c b/mm/gup.c index 3ecce297a47f..c0c56888e7cc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -29,6 +29,13 @@ struct follow_page_context { unsigned int page_mask; }; +static __always_inline long

[PATCH v12] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread John Hubbard
An upcoming patch changes and complicates the refcounting and especially the "put page" aspects of it. In order to keep everything clean, refactor the devmap page release routines: * Rename put_devmap_managed_page() to page_is_devmap_managed(), and limit the functionality to "read only": return

Re: [PATCH V3 01/13] powerpc/vas: Describe vas-port and interrupts properties

2019-12-18 Thread Rob Herring
On Mon, Dec 16, 2019 at 09:48:40PM -0800, Haren Myneni wrote: > Commit message? > Signed-off-by: Haren Myneni Your author and S-o-b emails don't match. > --- > Documentation/devicetree/bindings/powerpc/ibm,vas.txt | 5 + > 1 file changed, 5 insertions(+) > > diff --git

Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines

2019-12-18 Thread John Hubbard
On 12/18/19 7:52 AM, Kirill A. Shutemov wrote: On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: +static void put_compound_head(struct page *page, int refs) +{ + /* Do a get_page() first, in case refs == page->_refcount */ + get_page(page); + page_ref_sub(page,

Re: [PATCH V3 01/13] powerpc/vas: Describe vas-port and interrupts properties

2019-12-18 Thread Haren Myneni
On Wed, 2019-12-18 at 16:18 -0600, Rob Herring wrote: > On Mon, Dec 16, 2019 at 09:48:40PM -0800, Haren Myneni wrote: > > > > Commit message? > > > Signed-off-by: Haren Myneni > > Your author and S-o-b emails don't match. Thanks, Oliver suggested IRQ assign in the kernel instead of skiboot.

Re: [PATCH 04/14] powerpc/vas: Setup IRQ mapping and register port for each window

2019-12-18 Thread Haren Myneni
On Wed, 2019-12-18 at 18:18 +1100, Oliver O'Halloran wrote: > On Wed, Nov 27, 2019 at 12:07 PM Haren Myneni > wrote: > > > > *snip* > > > > @@ -36,7 +62,18 @@ static int init_vas_instance(struct platform_device > > *pdev) > > return -ENODEV; > > } > > > > - if

[PATCH v4 4/4] powerpc: Book3S 64-bit "heavyweight" KASAN support

2019-12-18 Thread Daniel Axtens
KASAN support on Book3S is a bit tricky to get right: - It would be good to support inline instrumentation so as to be able to catch stack issues that cannot be caught with outline mode. - Inline instrumentation requires a fixed offset. - Book3S runs code in real mode after booting. Most

[PATCH v4 3/4] powerpc/mm/kasan: rename kasan_init_32.c to init_32.c

2019-12-18 Thread Daniel Axtens
kasan is already implied by the directory name, we don't need to repeat it. Suggested-by: Christophe Leroy Signed-off-by: Daniel Axtens --- arch/powerpc/mm/kasan/Makefile | 2 +- arch/powerpc/mm/kasan/{kasan_init_32.c => init_32.c} | 0 2 files changed, 1 insertion(+), 1

[PATCH v4 1/4] kasan: define and use MAX_PTRS_PER_* for early shadow tables

2019-12-18 Thread Daniel Axtens
powerpc has a variable number of PTRS_PER_*, set at runtime based on the MMU that the kernel is booted under. This means the PTRS_PER_* are no longer constants, and therefore breaks the build. Define default MAX_PTRS_PER_*s in the same style as MAX_PTRS_PER_P4D. As KASAN is the only user at the

[PATCH v4 0/4] KASAN for powerpc64 radix

2019-12-18 Thread Daniel Axtens
Building on the work of Christophe, Aneesh and Balbir, I've ported KASAN to 64-bit Book3S kernels running on the Radix MMU. This provides full inline instrumentation on radix, but does require that you be able to specify the amount of physically contiguous memory on the system at compile time.

"ftrace: Rework event_create_dir()" triggers boot error messages

2019-12-18 Thread Qian Cai
The linux-next commit "ftrace: Rework event_create_dir()” [1] triggers boot warnings for Clang-build (Clang version 8.0.1) kernels (reproduced on both arm64 and powerpc). Reverted it (with trivial conflict fixes) on the top of today’s linux-next fixed the issue. configs:

Re: "ftrace: Rework event_create_dir()" triggers boot error messages

2019-12-18 Thread Steven Rostedt
On Wed, 18 Dec 2019 22:58:23 -0500 Qian Cai wrote: > The linux-next commit "ftrace: Rework event_create_dir()” [1] triggers boot > warnings > for Clang-build (Clang version 8.0.1) kernels (reproduced on both arm64 and > powerpc). > Reverted it (with trivial conflict fixes) on the top of

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread Dan Williams
On Mon, Dec 16, 2019 at 2:26 PM John Hubbard wrote: > > An upcoming patch changes and complicates the refcounting and > especially the "put page" aspects of it. In order to keep > everything clean, refactor the devmap page release routines: > > * Rename put_devmap_managed_page() to

Re: "ftrace: Rework event_create_dir()" triggers boot error messages

2019-12-18 Thread Qian Cai
> On Dec 18, 2019, at 11:31 PM, Steven Rostedt wrote: > > On Wed, 18 Dec 2019 22:58:23 -0500 > Qian Cai wrote: > >> The linux-next commit "ftrace: Rework event_create_dir()” [1] triggers boot >> warnings >> for Clang-build (Clang version 8.0.1) kernels (reproduced on both arm64 and >>

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread Dan Williams
On Wed, Dec 18, 2019 at 9:51 PM John Hubbard wrote: > > On 12/18/19 9:27 PM, Dan Williams wrote: > ... > >> @@ -461,5 +449,5 @@ void __put_devmap_managed_page(struct page *page) > >> page->mapping = NULL; > >> page->pgmap->ops->page_free(page); > >> } > >>

Re: [PATCH] powerpc/setup_64: use DEFINE_DEBUGFS_ATTRIBUTE to define fops_rfi_flush

2019-12-18 Thread Chen Zhou
Hi Michael, On 2019/12/18 19:02, Michael Ellerman wrote: > Chen Zhou writes: >> Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for >> debugfs files. >> >> Semantic patch information: >> Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() >> imposes some significant

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread John Hubbard
On 12/18/19 9:27 PM, Dan Williams wrote: ... @@ -461,5 +449,5 @@ void __put_devmap_managed_page(struct page *page) page->mapping = NULL; page->pgmap->ops->page_free(page); } -EXPORT_SYMBOL(__put_devmap_managed_page); +EXPORT_SYMBOL(free_devmap_managed_page); This patch does

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

2019-12-18 Thread Christophe Leroy
Le 09/12/2019 à 11:53, Michael Ellerman a écrit : Segher Boessenkool writes: On Sat, Dec 07, 2019 at 10:42:28AM +0100, Christophe Leroy wrote: Le 06/12/2019 à 21:59, Segher Boessenkool a écrit : If the compiler can see the callee wants the same TOC as the caller has, it does not arrange

Re: [PATCH v11 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-18 Thread John Hubbard
On 12/18/19 10:52 PM, Dan Williams wrote: On Wed, Dec 18, 2019 at 9:51 PM John Hubbard wrote: On 12/18/19 9:27 PM, Dan Williams wrote: ... @@ -461,5 +449,5 @@ void __put_devmap_managed_page(struct page *page) page->mapping = NULL; page->pgmap->ops->page_free(page); }

Re: [PATCH v4 4/4] powerpc: Book3S 64-bit "heavyweight" KASAN support

2019-12-18 Thread Christophe Leroy
On 12/19/2019 12:36 AM, Daniel Axtens wrote: KASAN support on Book3S is a bit tricky to get right: - It would be good to support inline instrumentation so as to be able to catch stack issues that cannot be caught with outline mode. - Inline instrumentation requires a fixed offset.

[PATCH v3] powerpc/32: add support of KASAN_VMALLOC

2019-12-18 Thread Christophe Leroy
Add support of KASAN_VMALLOC on PPC32. To allow this, the early shadow covering the VMALLOC space need to be removed once high_memory var is set and before freeing memblock. And the VMALLOC area need to be aligned such that boundaries are covered by a full shadow page. Signed-off-by: Christophe