[RFC PATCH v4 12/12] IMA: turn ima_policy_flags into __wr_after_init

2019-02-11 Thread Igor Stoppa
. __wr_after_init can still provide some protection, at least against simple memory overwrite attacks Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman

[RFC PATCH v4 11/12] __wr_after_init: test write rare functionality

2019-02-11 Thread Igor Stoppa
Set of test cases meant to confirm that the write rare functionality works as expected. It can be optionally compiled as module. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago

[RFC PATCH v4 03/12] __wr_after_init: x86_64: randomize mapping offset

2019-02-11 Thread Igor Stoppa
. This is accomplished by providing arch-specific version of the function __init_wr_base() Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC: linux

[RFC PATCH v4 08/12] __wr_after_init: lkdtm test

2019-02-11 Thread Igor Stoppa
Verify that trying to modify a variable with the __wr_after_init attribute will cause a crash. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC

Re: [RFC PATCH v4 00/12] hardening: statically allocated protected memory

2019-02-11 Thread Igor Stoppa
On 12/02/2019 02:09, Kees Cook wrote: On Mon, Feb 11, 2019 at 3:28 PM Igor Stoppa wrote: [...] Patch-set implementing write-rare memory protection for statically allocated data. It seems like this could be expanded in the future to cover dynamic memory too (i.e. just a separate base

Re: [RFC PATCH v4 00/12] hardening: statically allocated protected memory

2019-02-11 Thread Igor Stoppa
On 12/02/2019 03:26, Kees Cook wrote: On Mon, Feb 11, 2019 at 5:08 PM igor.sto...@gmail.com wrote: On Tue, 12 Feb 2019, 4.47 Kees Cook On Mon, Feb 11, 2019 at 4:37 PM Igor Stoppa wrote: On 12/02/2019 02:09, Kees Cook wrote: On Mon, Feb 11, 2019 at 3:28 PM Igor Stoppa wrote: It

Re: [RFC PATCH v4 01/12] __wr_after_init: Core and default arch

2019-02-11 Thread Igor Stoppa
On 12/02/2019 04:39, Matthew Wilcox wrote: On Tue, Feb 12, 2019 at 01:27:38AM +0200, Igor Stoppa wrote: +#ifndef CONFIG_PRMEM [...] +#else + +#include It's a mistake to do conditional includes like this. That way you see include loops with some configs and not others. Our header

Re: [RFC PATCH v5 03/12] __wr_after_init: Core and default arch

2019-02-14 Thread Igor Stoppa
On 14/02/2019 13:28, Peter Zijlstra wrote: On Thu, Feb 14, 2019 at 12:41:32AM +0200, Igor Stoppa wrote: [...] +#define wr_rcu_assign_pointer(p, v) ({ \ + smp_mb(); \ + wr_assign(p, v);\ + p; \ +}) This

[RFC PATCH v5 03/12] __wr_after_init: Core and default arch

2019-02-13 Thread Igor Stoppa
write-rare path. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC: linux-integr...@vger.kernel.org CC: kernel-harden...@lists.openwal

[RFC PATCH v5 04/12] __wr_after_init: x86_64: randomize mapping offset

2019-02-13 Thread Igor Stoppa
. This is accomplished by providing arch-specific version of the function __init_wr_base() Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC: linux

[RFC PATCH v5 02/12] __wr_after_init: linker section and attribute

2019-02-13 Thread Igor Stoppa
since the granularity available for write protection is of one memory page. The functionality is automatically activated by any architecture that sets CONFIG_ARCH_HAS_PRMEM Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: D

[RFC PATCH v5 00/12] hardening: statically allocated protected memory

2019-02-13 Thread Igor Stoppa
address for the alternate map across the entire available address range from user space (128TB - 64TB) * convert BUG() to WARN() * turn verification of written data into debugging option * wr_rcu_assign_pointer() as special case of wr_assign() * example with protection of ima_policy_flags * doc

[RFC PATCH v5 06/12] __wr_after_init: arm64: enable

2019-02-13 Thread Igor Stoppa
Set ARCH_HAS_PRMEM to Y for arm64 Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC: linux-integr...@vger.kernel.org CC: kernel-harden

[RFC PATCH v5 07/12] __wr_after_init: Documentation: self-protection

2019-02-13 Thread Igor Stoppa
Update the self-protection documentation, to mention also the use of the __wr_after_init attribute. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed

[RFC PATCH v5 08/12] __wr_after_init: lkdtm test

2019-02-13 Thread Igor Stoppa
Verify that trying to modify a variable with the __wr_after_init attribute will cause a crash. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC

[RFC PATCH v5 12/12] IMA: turn ima_policy_flags into __wr_after_init

2019-02-13 Thread Igor Stoppa
. __wr_after_init can still provide some protection, at least against simple memory overwrite attacks Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman

[RFC PATCH v5 09/12] __wr_after_init: rodata_test: refactor tests

2019-02-13 Thread Igor Stoppa
Refactor the test cases, in preparation for using them also for testing __wr_after_init memory, when available. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC

[RFC PATCH v5 11/12] __wr_after_init: test write rare functionality

2019-02-13 Thread Igor Stoppa
Set of test cases meant to confirm that the write rare functionality works as expected. It can be optionally compiled as module. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago

[RFC PATCH v5 10/12] __wr_after_init: rodata_test: test __wr_after_init

2019-02-13 Thread Igor Stoppa
The write protection of the __wr_after_init data can be verified with the same methodology used for const data. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC

[RFC PATCH v5 05/12] __wr_after_init: x86_64: enable

2019-02-13 Thread Igor Stoppa
Set ARCH_HAS_PRMEM to Y for x86_64 Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: Thiago Jung Bauermann CC: Ahmed Soliman CC: linux-integr...@vger.kernel.org CC: kernel-harden

Re: [RFC PATCH v5 03/12] __wr_after_init: Core and default arch

2019-02-16 Thread Igor Stoppa
On 15/02/2019 10:57, Peter Zijlstra wrote: Where are the comments and Changelog notes ? How is an arch maintainer to be aware of this requirement when adding support for his/her arch? Yes, it will be fixed in the next revision. I've added comment to the core wr_assign function and also to

Re: [PATCH] infiniband: nes: add unlikely() to assert()

2018-09-05 Thread Igor Stoppa
On 05/09/18 09:01, Leon Romanovsky wrote: On Fri, Aug 31, 2018 at 10:24:18PM +0300, Igor Stoppa wrote: Typically the assert is expected to not fail. This whole assert can be removed. ok Signed-off-by: Igor Stoppa Acked-by: Doug Ledford Most probably that I missed discussion, but

[PATCH] seccomp: remove unnecessary unlikely()

2018-09-05 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Acked-by: Kees Cook Cc: linux-security-mod...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- kernel/seccomp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 dele

Re: [PATCH] seccomp: remove unnecessary unlikely()

2018-09-05 Thread Igor Stoppa
On 06/09/18 01:23, Kees Cook wrote: Should I take this, or is it part of your series going somewhere else? It turned out it doesn't really work to have a generic series against 20 trees :-/ I'm submitting them individually to each subsystem. So this one is just for security. -- thanks,

Re: [PATCH] infiniband: nes: add unlikely() to assert()

2018-09-07 Thread Igor Stoppa
On 07/09/18 18:13, Doug Ledford wrote: This patch was part of a larger series on lkml. In that context, I acked it so that the series could be applied by whomever took it (it didn't belong on rdma-list as a series since only one patch out of some large number touched rdma files). Now it is bei

[PATCH] cpufreq: remove unnecessary unlikely()

2018-09-07 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Srivatsa S. Bhat Cc: "Rafael J. Wysocki" Cc: linux...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/cpufreq/cpufreq.c | 2 +- 1 file chang

[PATCH] filesystems: remove unnecessary unlikely()

2018-09-07 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Alexander Viro Cc: linux-fsde...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- fs/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/o

[PATCH] usb: octeon-hcd: remove unnecessary unlikely()

2018-09-07 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Aaro Koskinen Cc: Greg Kroah-Hartman Cc: de...@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org --- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- 1 file chang

[PATCH] mips: bug: add unlikely() to BUG_ON()

2018-09-07 Thread Igor Stoppa
Add a hint to the compiler that probably it won't be necessary to BUG() Signed-off-by: Igor Stoppa Cc: David Daney Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan Cc: linux-m...@linux-mips.org Cc: linux-kernel@vger.kernel.org --- arch/mips/include/asm/bug.h | 2 +- 1 file chang

[RESEND PATCH] mm: percpu: remove unnecessary unlikely()

2018-09-07 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Acked-by: Dennis Zhou Cc: Tejun Heo Cc: zijun_hu Cc: Christoph Lameter Cc: linux...@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/percpu.c | 2 +- 1 file chang

[PATCH] asm-generic: bug: add unlikely() to BUG_ON()

2018-09-07 Thread Igor Stoppa
Add a hint to the compiler. If BUG_ON() is used instead of BUG(), it means that probably the preferred outcome is to not BUG(). The optimization is disabled, in case CONFIG_PROFILE_ANNOTATED_BRANCHES is turned on. Signed-off-by: Igor Stoppa Cc: Arnd Bergmann Cc: linux-a...@vger.kernel.org Cc

Re: [RESEND PATCH] mm: percpu: remove unnecessary unlikely()

2018-09-07 Thread Igor Stoppa
On 07/09/18 21:39, Dennis Zhou wrote: Sorry for the delay. I'll be taking over the percpu tree and am in the process of getting a tree. I'm still keeping track of this and will take it for the next release. ok, np! -- thank you, igor

Re: [PATCH] asm-generic: bug: add unlikely() to BUG_ON()

2018-09-07 Thread Igor Stoppa
On 07/09/18 23:41, Arnd Bergmann wrote: Could you add a comment about -Wmaybe-uninitialized next to the definition? Otherwise that is easily lost. Also, I see that the file has two separate definitions of BUG_ON(), and the other one does have an unlikely() in it already. Can you change both

[PATCH v2] asm-generic: bug: unify hints for BUG_ON()

2018-09-07 Thread Igor Stoppa
-uninitialized. Signed-off-by: Igor Stoppa Cc: Arnd Bergmann Cc: linux-a...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/asm-generic/bug.h | 8 1 file changed, 8 insertions(+) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 20561a60db9c

Re: [PATCH] mips: bug: add unlikely() to BUG_ON()

2018-09-10 Thread Igor Stoppa
Hi Paul, On 08/09/18 01:02, Paul Burton wrote: I'm not sure this will actually do anything. __BUG_ON() doesn't use the value of its condition argument for regular control flow unless it's compile-time constant anyway, in which case unlikely() should be redundant because the compiler knows the

Re: [PATCH v2] asm-generic: bug: unify hints for BUG_ON()

2018-09-10 Thread Igor Stoppa
On 10/09/18 15:16, Arnd Bergmann wrote: Acked-by: Arnd Bergmann I assume this will be included in a longer patch series rather than going through my asm-generic tree, right? sadly, no: this patch is just for the asm-generic tree I tried with the longer patch series, but it didn't work out

[PATCH v2] asm-generic: bug: unify hints for BUG_ON()

2018-09-11 Thread Igor Stoppa
-uninitialized. Signed-off-by: Igor Stoppa Acked-by: Arnd Bergmann Cc: linux-a...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/asm-generic/bug.h | 8 1 file changed, 8 insertions(+) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 20561a60db9c

[PATCH 14/23] wimax: i2400m: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Inaky Perez-Gonzalez --- drivers/net/wimax/i2400m/tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/

[PATCH 15/23] lvm: device mapper: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Mike Snitzer Cc: Alasdair Kergon --- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 20f7e4e

[PATCH 07/23] seccomp: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Kees Cook --- kernel/seccomp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index fd023ac24e10..5a2a9af

[PATCH 06/23] virtio: add unlikely() to WARN_ON_ONCE()

2018-08-30 Thread Igor Stoppa
The condition to test is unlikely() to be true. Add the hint. Signed-off-by: Igor Stoppa Cc: "Michael S. Tsirkin" --- tools/virtio/linux/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h index fb

[PATCH 12/23] wireless: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Larry Finger Cc: Kalle Valo --- drivers/net/wireless/broadcom/b43/dma.c | 2 +- drivers/net/wireless/broadcom/b43legacy/dma.c | 2 +- 2 files changed, 2 inser

[PATCH 17/23] usb: octeon-hcd: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Aaro Koskinen Cc: Greg Kroah-Hartman --- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/o

[PATCH 20/23] mm: percpu: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: zijun_hu Cc: Tejun Heo Cc: Christoph Lameter Cc: Dennis Zhou --- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/percpu.c b/mm/per

[PATCH 01/23] infiniband: nes: add unlikely() to assert()

2018-08-30 Thread Igor Stoppa
Typically the assert is expected to not fail. Signed-off-by: Igor Stoppa Cc: Chien Tung Cc: Roland Dreier Cc: Faisal Latif Cc: Doug Ledford Cc: Jason Gunthorpe --- drivers/infiniband/hw/nes/nes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/nes

[PATCH 04/23] mips: bug: add unlikely() to BUG_ON()

2018-08-30 Thread Igor Stoppa
Add a hint to the compiler that probably it won't be necessary to BUG() Signed-off-by: Igor Stoppa Cc: David Daney Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan --- arch/mips/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/include/asm/

[PATCH 02/23] ethernet: hnae: add unlikely() to assert()

2018-08-30 Thread Igor Stoppa
The assert() condition is likely to be true. Signed-off-by: Igor Stoppa Cc: huangdaode Cc: Yisen Zhuang Cc: Salil Mehta --- drivers/net/ethernet/hisilicon/hns/hnae.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net

[PATCH 11/23] wireless: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON_ONCE() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Kalle Valo Cc: Michal Kazior --- drivers/net/wireless/ath/ath10k/htt_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wir

[PATCH 08/23] drm: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Rob Clark Cc: David Airlie Cc: Archit Taneja Cc: Stephane Viau --- drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c | 4 ++-- drivers/gpu/drm/msm/disp/mdp_format.c| 2

[PATCH 19/23] pinctrl: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Andrew Jeffery Cc: Linus Walleij --- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/a

[PATCH 10/23] wireless: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON_ONCE() already contains an unlikely(), and the logical or of two of them is still unlikely(), so it's not necessary to wrap them into another. Signed-off-by: Igor Stoppa Cc: Christian Lamparter Cc: Kalle Valo --- drivers/net/wireless/ath/carl9170/tx.c | 4 ++-- 1 file chang

[PATCH 03/23] asm-generic: bug: add unlikely() to BUG_ON()

2018-08-30 Thread Igor Stoppa
Add a hint to the compiler. If BUG_ON() is used instead of BUG(), it means that probably the preferred outcome is to not BUG(). Signed-off-by: Igor Stoppa Cc: Arnd Bergmann --- include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic

[PATCH 05/23] selftest: vm: add unlikely() to BUG_ON()

2018-08-30 Thread Igor Stoppa
BUG_ON() is unlikely() to BUG() Signed-off-by: Igor Stoppa Cc: Dmitry Safonov Cc: Shuah Khan --- tools/testing/selftests/vm/map_populate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/map_populate.c b/tools/testing/selftests/vm/map_populate.c

[PATCH 21/23] filesystems: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Alexander Viro --- fs/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/open.c b/fs/open.c index 0285ce7dbd51..19a9e4b378d3 100644 --- a/fs/o

[PATCH 13/23] freescale: ethernet: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
Both WARN_ON() and WARN_ONCE() already contain an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Madalin Bucur --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/driver

[PATCH 18/23] infiniband: scsi: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/dr

[PATCH 22/23] powerpc: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Arseny Solokha Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman --- arch/powerpc/mm/tlb_nohash.c | 2 +- arch/powerpc/sysdev/xive/common.c | 2

[PATCH 23/23] scsi: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
BUG_ON() already contains an unlikely(), there is no need for another one. Signed-off-by: Igor Stoppa Cc: "Martin K. Petersen" Cc: "James E.J. Bottomley" --- drivers/scsi/scsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_

[PATCH 16/23] lvm: device mapper: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: Joe Thornber Cc: Alasdair Kergon --- drivers/md/dm-cache-policy-smq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-cache-policy-sm

[PATCH 09/23] cpufreq: remove unnecessary unlikely()

2018-08-30 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Cc: "Rafael J. Wysocki" Cc: Srivatsa S. Bhat --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuf

[PATCH] infiniband: nes: add unlikely() to assert()

2018-08-31 Thread Igor Stoppa
Typically the assert is expected to not fail. Signed-off-by: Igor Stoppa Acked-by: Doug Ledford Cc: Faisal Latif Cc: Chien Tung Cc: Roland Dreier Cc: Faisal Latif Cc: Jason Gunthorpe Cc: linux-r...@vger.kernel.org CC: linux-kernel@vger.kernel.org --- drivers/infiniband/hw/nes/nes.h | 2

[PATCH] mm: percpu: remove unnecessary unlikely()

2018-08-31 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Acked-by: Dennis Zhou Cc: Tejun Heo Cc: zijun_hu Cc: Christoph Lameter Cc: linux...@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/percpu.c | 2 +- 1 file chang

[PATCH] infiniband: scsi: remove unnecessary unlikely()

2018-08-31 Thread Igor Stoppa
WARN_ON() already contains an unlikely(), so it's not necessary to wrap it into another. Signed-off-by: Igor Stoppa Reviewed-by: Bart Van Assche Cc: linux-r...@vger.kernel.org (open list:SCSI RDMA PROTOCOL (SRP) TARGET) Cc: linux-kernel@vger.kernel.org (open list) --- drivers/infiniban

Re: [PATCH 00/23] Make use of unlikely() more consistently.

2018-08-31 Thread Igor Stoppa
On 31/08/18 17:09, Arnd Bergmann wrote: [...] #define assert(condition) ... if (unlikely(!(condition))) error_action() ... There is a potential that this introduces false-postive -Wmaybe-uninitialized warnings when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, since that

[PATCH] selftest: vm: add unlikely() to BUG_ON()

2018-08-31 Thread Igor Stoppa
BUG_ON() is unlikely() to BUG() For unlikely(), borrow the definition from tools/include/linux/compiler.h Signed-off-by: Igor Stoppa Cc: Dmitry Safonov Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- tools/testing/selftests/vm/map_populate.c | 6

Re: [PATCH 05/23] selftest: vm: add unlikely() to BUG_ON()

2018-08-31 Thread Igor Stoppa
Hi Dmitry, On 31/08/18 02:04, Dmitry Safonov wrote: Probably, the one from "tools/include/linux/compiler.h" can be used in tools directory. Thank you for the advice. It seems to work now. -- igor

Re: [Question PATCH 0/1] mm: crash in vmalloc_to_page - misuse or bug?

2018-03-02 Thread Igor Stoppa
Ping? The kernel test automation seems to confirm my findings: https://marc.info/?l=linux-mm&m=151999308428656&w=2 Is this really a bug? On 22/02/18 16:13, Igor Stoppa wrote: > While trying to change the code of find_vm_area, I got an automated > notification that my code wa

[PATCH 1/9] struct page: add field for vm_struct

2018-04-23 Thread Igor Stoppa
arent area. This will avoid more expensive searches, later on. Signed-off-by: Igor Stoppa Reviewed-by: Jay Freyensee Reviewed-by: Matthew Wilcox --- include/linux/mm_types.h | 1 + mm/vmalloc.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/linux/mm_types.h b/inc

[PATCH 4/9] Documentation for Pmalloc

2018-04-23 Thread Igor Stoppa
Detailed documentation about the protectable memory allocator. Signed-off-by: Igor Stoppa --- Documentation/core-api/index.rst | 1 + Documentation/core-api/pmalloc.rst | 161 + 2 files changed, 162 insertions(+) create mode 100644 Documentation/core-api

[PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-04-23 Thread Igor Stoppa
available for modifying the memory, which is also mapped at a random address, which is harder to retrieve, even in case of another core racing with the one performing the modification. Signed-off-by: Igor Stoppa CC: Carlos Chinea Perez CC: Remi Denis Courmont --- Documentation/core-api

[PATCH 8/9] Preliminary self test for pmalloc rare write

2018-04-23 Thread Igor Stoppa
Try to alter locked but modifiable pools. The test neds some cleanup and expansion. It is provided primarily as reference. Signed-off-by: Igor Stoppa --- mm/test_pmalloc.c | 75 +++ 1 file changed, 75 insertions(+) diff --git a/mm

[PATCH 6/9] lkdtm: crash on overwriting protected pmalloc var

2018-04-23 Thread Igor Stoppa
Verify that pmalloc read-only protection is in place: trying to overwrite a protected variable will crash the kernel. Signed-off-by: Igor Stoppa --- drivers/misc/lkdtm/core.c | 3 +++ drivers/misc/lkdtm/lkdtm.h | 1 + drivers/misc/lkdtm/perms.c | 25 + 3 files changed

[PATCH 9/9] Protect SELinux initialized state with pmalloc

2018-04-23 Thread Igor Stoppa
shows how to deny an easy target to the attacker. In case the kernel is compiled with JOP safeguards, then it becomes far harder for the attacker to jump into the middle of the function which calls pmalloc_rare_write, to alter the state. Signed-off-by: Igor Stoppa --- security/selinu

[PATCH 2/9] vmalloc: rename llist field in vmap_area

2018-04-23 Thread Igor Stoppa
tilization outside of the purging phase. Since the purging happens after the vmap_area is dismissed, its use is mutually exclusive with any use performed while the area is allocated. Signed-off-by: Igor Stoppa --- include/linux/vmalloc.h | 2 +- mm/vmalloc.c| 6 +++--- 2 files changed, 4

[PATCH 5/9] Pmalloc selftest

2018-04-23 Thread Igor Stoppa
Add basic self-test functionality for pmalloc. The testing is introduced as early as possible, right after the main dependency, genalloc, has passed successfully, so that it can help diagnosing failures in pmalloc users. Signed-off-by: Igor Stoppa --- include/linux/test_pmalloc.h | 24

[RFC PATCH v23 0/6] mm: security: write protection for dynamic data

2018-04-23 Thread Igor Stoppa
tect one of hte internal states of SELinux. Changes since v22: [http://www.openwall.com/lists/kernel-hardening/2018/04/13/3] - refactored some helper functions in a separate local header - expanded the documentation - introduction of rare write support - example with SELinux "initialized&quo

[PATCH 3/9] Protectable Memory

2018-04-23 Thread Igor Stoppa
page, where present. Signed-off-by: Igor Stoppa --- include/linux/pmalloc.h | 148 include/linux/vmalloc.h | 3 + mm/Kconfig | 6 ++ mm/Makefile | 1 + mm/pmalloc.c

Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-04-24 Thread Igor Stoppa
On 24/04/18 15:50, Matthew Wilcox wrote: On Mon, Apr 23, 2018 at 04:54:56PM +0400, Igor Stoppa wrote: While the vanilla version of pmalloc provides support for permanently transitioning between writable and read-only of a memory pool, this patch seeks to support a separate class of data

Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-04-24 Thread Igor Stoppa
On 24/04/18 16:32, lazytyped wrote: On 4/24/18 1:50 PM, Matthew Wilcox wrote: struct modifiable_data { struct immutable_data *d; ... }; Then allocate a new pool, change d and destroy the old pool. With the above, you have just shifted the target of the arbitrary write from

Re: [PATCH 9/9] Protect SELinux initialized state with pmalloc

2018-04-24 Thread Igor Stoppa
On 24/04/18 16:49, Stephen Smalley wrote: On 04/23/2018 08:54 AM, Igor Stoppa wrote: [...] The patch is probably in need of rework, to make it fit better with the new SELinux internal data structures, however it shows how to deny an easy target to the attacker. I know this is just an

Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-04-24 Thread Igor Stoppa
On 24/04/18 19:03, lazytyped wrote: On 4/24/18 4:44 PM, Matthew Wilcox wrote: On Tue, Apr 24, 2018 at 02:32:36PM +0200, lazytyped wrote: On 4/24/18 1:50 PM, Matthew Wilcox wrote: struct modifiable_data { struct immutable_data *d; ... }; Then allocate a new pool, change d a

Re: [RFC PATCH v19 0/8] mm: security: ro protection for dynamic data

2018-03-19 Thread Igor Stoppa
On 14/03/18 19:33, Matthew Wilcox wrote: > I think an implementation of > pmalloc which used a page_frag-style allocator would be larger than > 100 lines, but I don't think it would have to be significantly larger > than that. I have some doubt about what is the best way to implement it using vmal

Correct way to access the physmap? - Was: Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-05-03 Thread Igor Stoppa
On 24/04/18 15:50, Matthew Wilcox wrote: On Mon, Apr 23, 2018 at 04:54:56PM +0400, Igor Stoppa wrote: While the vanilla version of pmalloc provides support for permanently transitioning between writable and read-only of a memory pool, this patch seeks to support a separate class of data

Re: Correct way to access the physmap? - Was: Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools

2018-05-03 Thread Igor Stoppa
On 04/05/18 01:55, Dave Hansen wrote: On 05/03/2018 02:52 PM, Igor Stoppa wrote: At the end of the summit, we agreed that I would go through the physmap. Do you mean the kernel linear map? Apparently I did mean it. It was confusing, because I couldn't find a single place stati

Re: [PATCH 4/8] struct page: add field for vm_struct

2018-03-15 Thread Igor Stoppa
On 14/03/18 19:43, J Freyensee wrote: > On 3/13/18 3:00 PM, Matthew Wilcox wrote: [...] >>> Signed-off-by: Igor Stoppa >> Reviewed-by: Matthew Wilcox > > Igor, do you mind sticking these tags on the files that have spent some > time reviewing a revision of your pat

Re: [RFC PATCH v19 0/8] mm: security: ro protection for dynamic data

2018-03-15 Thread Igor Stoppa
On 14/03/2018 19:33, Matthew Wilcox wrote: > On Wed, Mar 14, 2018 at 06:11:22PM +0200, Igor Stoppa wrote: [...] >> Probably page_frag does well with relatively large allocations, while >> genalloc seems to be better for small (few allocation units) allocations. > > I don

[PATCH 0/1] mm: Improve consistency of ___GFP_xxx masks

2017-04-26 Thread Igor Stoppa
The GFP bitmasks and the __GFP_BITS_SHIFT defines are expressed as hardcoded constants. This can be expressed in a more consistent way by relying on an enum of shift positions. Igor Stoppa (1): Remove hardcoding of ___GFP_xxx bitmasks include/linux/gfp.h | 82

[PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-26 Thread Igor Stoppa
The bitmasks used for ___GFP_xxx can be defined in terms of an enum, which doesn't require manual updates to its values. As bonus, __GFP_BITS_SHIFT is automatically kept consistent. Signed-off-by: Igor Stoppa --- include/linux/gfp.h | 82 +++

Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-26 Thread Igor Stoppa
On 26/04/17 17:47, Michal Hocko wrote: > On Wed 26-04-17 16:35:49, Igor Stoppa wrote: >> The bitmasks used for ___GFP_xxx can be defined in terms of an enum, >> which doesn't require manual updates to its values. > > GFP masks are rarely updated so why is this wort

Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-27 Thread Igor Stoppa
On 26/04/17 18:29, Igor Stoppa wrote: > On 26/04/17 17:47, Michal Hocko wrote: [...] >> Also the current mm tree has ___GFP_NOLOCKDEP which is not addressed >> here so I suspect you have based your change on the Linus tree. > I used your tree from kernel.org I found it,

Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-27 Thread Igor Stoppa
On 26/04/17 18:29, Igor Stoppa wrote: > On 26/04/17 17:47, Michal Hocko wrote: [...] >> Also the current mm tree has ___GFP_NOLOCKDEP which is not addressed >> here so I suspect you have based your change on the Linus tree. > I used your tree from kernel.org I found it,

Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-27 Thread Igor Stoppa
On 27/04/17 16:41, Michal Hocko wrote: > On Wed 26-04-17 18:29:08, Igor Stoppa wrote: > [...] >> If you prefer to have this patch only as part of the larger patchset, >> I'm also fine with it. > > I agree that the situation is not ideal. If a larger set of chan

Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-28 Thread Igor Stoppa
On 28/04/17 10:40, Michal Hocko wrote: > Do not add a new zone, really. What you seem to be looking for is an > allocator on top of the page/memblock allocator which does write > protection on top. I understand that you would like to avoid object > management duplication but I am not really sure

Generic approach to customizable zones - was: Re: [PATCH v7 0/7] Introduce ZONE_CMA

2017-04-28 Thread Igor Stoppa
On 27/04/17 18:06, Michal Hocko wrote: > On Tue 25-04-17 12:42:57, Joonsoo Kim wrote: [...] >> Yes, it requires one more bit for a new zone and it's handled by the patch. > > I am pretty sure that you are aware that consuming new page flag bits > is usually a no-go and something we try to avoid

Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

2017-04-28 Thread Igor Stoppa
On 28/04/17 10:43, Igor Stoppa wrote: [...] > I'm writing an alternative different proposal, let's call it last attempt. > > Should be ready in a few minutes. Here: http://marc.info/?l=linux-mm&m=149336675129967&w=2 -- thanks, igor

Re: Generic approach to customizable zones - was: Re: [PATCH v7 0/7] Introduce ZONE_CMA

2017-04-28 Thread Igor Stoppa
s, but I have not completed the whole conversion. > On Fri 28-04-17 11:04:27, Igor Stoppa wrote: > [...] >> * if one is happy to have a 64bits type, allow for as many zones as >> it's possible to fit, or anyway more than what is possible with >> the 32 bit mask.

[PATCH v8 0/3] mm: LSM: ro protection for dynamic data

2017-06-27 Thread Igor Stoppa
going away, according to Casey. Note: The patch is larg-ish, but I was not sure what criteria to use for splitting it. If it helps the reviewing, please do let me know how I should split it and I will comply. Igor Stoppa (2): Protectable memory support Make LSM Writable Hooks a command line opti

[PATCH 1/3] Protectable memory support

2017-06-27 Thread Igor Stoppa
From: Igor Stoppa The MMU available in many systems running Linux can often provide R/O protection to the memory pages it handles. However, the MMU-based protection works efficiently only when said pages contain exclusively data that will not need further modifications. Statically allocated

[PATCH 2/3] LSM: Convert security_hook_heads into explicit array of struct list_head

2017-06-27 Thread Igor Stoppa
result of introducing an enum, security_hook_heads becomes a local variable. In order to pass 80 columns check by scripts/checkpatch.pl , rename security_hook_heads to hook_heads. Signed-off-by: Tetsuo Handa Rebased-by: Igor Stoppa Cc: Kees Cook Cc: Paul Moore Cc: Stephen Smalley Cc: Case

[PATCH 3/3] Make LSM Writable Hooks a command line option

2017-06-27 Thread Igor Stoppa
From: Igor Stoppa This patch shows how it is possible to take advantage of pmalloc: instead of using the build-time option __lsm_ro_after_init, to decide if it is possible to keep the hooks modifiable, now this becomes a boot-time decision, based on the kernel command line. This patch relies on

<    1   2   3   4   5   >