[PATCH v3 08/20] vmw_balloon: rename VMW_BALLOON_2M_SHIFT to VMW_BALLOON_2M_ORDER

2018-09-26 Thread Nadav Amit
hange. Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 4e067d269706..626abe65eddb 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_ball

[PATCH v3 01/20] vmw_balloon: handle commands in a single function.

2018-09-26 Thread Nadav Amit
selectively). Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 223 +++-- 1 file changed, 116 insertions(+), 107 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 2543ef1ece17..0a4d5501f805

[PATCH v3 19/20] vmw_balloon: memory shrinker

2018-09-26 Thread Nadav Amit
-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 124 - 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 4c9c171325c3..8d60c7e65242 100644 --- a/drivers

[PATCH v3 07/20] vmw_balloon: treat all refused pages equally

2018-09-26 Thread Nadav Amit
refused list. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 52 +- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 96dde120bbd5

[PATCH v3 09/20] vmw_balloon: refactor change size from vmballoon_work

2018-09-26 Thread Nadav Amit
The required change in the balloon size is currently computed in vmballoon_work(), vmballoon_inflate() and vmballoon_deflate(). Refactor it to simplify the next patches. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 75

[PATCH v3 06/20] vmw_balloon: change batch/single lock abstractions

2018-09-26 Thread Nadav Amit
consistent in the return type and avoid potential coding errors. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 358 + 1 file changed, 165 insertions(+), 193 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers

[PATCH v3 03/20] vmw_balloon: merge send_lock and send_unlock path

2018-09-26 Thread Nadav Amit
The lock and unlock code paths are very similar, so avoid the duplicate code by merging them together. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 62 +- 1 file changed, 21 insertions(+), 41 deletions(-) diff

[PATCH v3 02/20] vmw_balloon: unify commands tracing and stats

2018-09-26 Thread Nadav Amit
Now that we have a single point, unify the tracing and collecting the statistics for commands and their failure. While it might somewhat reduce the control over debugging, it cleans the code a lot. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 116

[PATCH v3 04/20] vmw_balloon: simplifying batch access

2018-09-26 Thread Nadav Amit
The use of accessors for batch entries complicates the code and makes it less readable. Remove it an instead use bit-fields. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 81 ++ 1 file changed, 30 insertions(+), 51

Re: [PATCH v6 00/10] x86/alternative: text_poke() fixes

2018-11-26 Thread Nadav Amit
> On Nov 26, 2018, at 2:32 AM, Peter Zijlstra wrote: > > On Tue, Nov 20, 2018 at 12:35:35PM -0800, Nadav Amit wrote: > >> Nadav Amit (9): >> Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()" >> x86/jump_label: Use text_poke_early

Re: [PATCH v2 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-19 Thread Nadav Amit
at 8:20 PM, Masahiro Yamada wrote: > On Sat, Nov 17, 2018 at 6:02 AM Nadav Amit wrote: >> From: Masahiro Yamada >> Sent: November 16, 2018 at 7:45:45 AM GMT >>> To: Nadav Amit >>> Cc: Ingo Molnar , Michal Marek , >>> Thomas Gleixner , Borislav Pet

Re: [PATCH v5 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-20 Thread Nadav Amit
> On Nov 20, 2018, at 10:23 AM, H. Peter Anvin wrote: > > On 11/20/18 10:18 AM, Peter Zijlstra wrote: >>> Can't we make this test in text_poke() directly, please? >> >> He does that in 9/10 iirc. > > No, in 9/10 he does that change locally for the jump_label, but there is > absolutely no reason

Re: [PATCH v5 00/10] x86/alternative: text_poke() fixes

2018-11-20 Thread Nadav Amit
> On Nov 20, 2018, at 4:42 AM, Peter Zijlstra wrote: > > On Tue, Nov 13, 2018 at 05:07:20AM -0800, Nadav Amit wrote: >> v4->v5: >> - Fix Xen breakage [Damian Tometzki] >> - BUG_ON() when poking_mm initialization fails [PeterZ] >> - Better comments on "

[PATCH v6 09/10] x86/jump-label: remove support for custom poker

2018-11-20 Thread Nadav Amit
Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index ed5fe274a7d8..994c13e2867d 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86

[PATCH v6 06/10] x86/alternative: use temporary mm for text poking

2018-11-20 Thread Nadav Amit
conservative enough when mapping pages, as it always tries to map 2 pages, even when a single one is sufficient. So try to be more conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v6 08/10] x86: avoid W^X being broken during modules loading

2018-11-20 Thread Nadav Amit
Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/kernel/alternative.c | 28 +--- arch/x86/kernel/module.c | 2 +- include/linux/filter.h| 6 ++ kernel

[PATCH v6 05/10] x86/alternative: initializing temporary mm for patching

2018-11-20 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 35

[PATCH v6 04/10] fork: provide a function for copying init_mm

2018-11-20 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

[PATCH v6 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-20 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Co-Developed-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 7 ++- 1 file ch

[PATCH v6 07/10] x86/kgdb: avoid redundant comparison of patched code

2018-11-20 Thread Nadav Amit
text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff

[PATCH v6 01/10] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-20 Thread Nadav Amit
e text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Acked-by: Jiri Kosina Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 1 + arch/x86/kernel/alternative.c| 52 arch/x86/kernel/kgdb.c | 11 +++--- 3 files changed,

[PATCH v6 10/10] x86/alternative: remove the return value of text_poke_*()

2018-11-20 Thread Nadav Amit
The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 4 ++-- arch/x86/kernel/alternative.c| 11

[PATCH v6 00/10] x86/alternative: text_poke() fixes

2018-11-20 Thread Nadav Amit
fix [peterz] - Removed remainders of text_poke return value [masami] - Use __weak for poking_init instead of macros [masami] - Simplify error handling in poking_init [masami] andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (9): Fix "x86/alternatives: Lockdep-enforce text_mu

[PATCH v6 03/10] x86/mm: temporary mm struct

2018-11-20 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 32 ++ 1 file changed, 32 insertions(+) diff --git a/arch/x86/include/asm

Re: Out of tree module build errors since v4.20-rc1

2018-11-21 Thread Nadav Amit
> On Nov 21, 2018, at 12:56 PM, Liam R. Howlett wrote: > > > My out of tree driver build is now reporting issues with the jump table: > > ./include/linux/jump_label.h: In function ‘jump_entry_code’: > ./include/linux/jump_label.h:153:14: error: dereferencing pointer to > incomplete type ‘const

Re: [PATCH v2 1/4] x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h

2018-11-27 Thread Nadav Amit
> On Nov 27, 2018, at 10:48 AM, Roman Kagan wrote: > > On Tue, Nov 27, 2018 at 02:10:49PM +0100, Vitaly Kuznetsov wrote: >> Roman Kagan writes: >>> On Mon, Nov 26, 2018 at 04:47:29PM +0100, Vitaly Kuznetsov wrote: >>> I personally tend to prefer masks over bitfields, so I'd rather do the >>> con

Re: [PATCH v2 1/4] x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h

2018-11-28 Thread Nadav Amit
> On Nov 28, 2018, at 5:07 AM, Thomas Gleixner wrote: > > On Wed, 28 Nov 2018, Vitaly Kuznetsov wrote: > >> Nadav Amit writes: >> >>> On a different note: how come all of the hyper-v structs are not marked >>> with the “packed" attribute? &

Re: [PATCH v6 08/10] x86: avoid W^X being broken during modules loading

2018-11-28 Thread Nadav Amit
> On Nov 20, 2018, at 12:35 PM, Nadav Amit wrote: > > When modules and BPF filters are loaded, there is a time window in > which some memory is both writable and executable. An attacker that has > already found another vulnerability (e.g., a dangling pointer) might be > ab

Re: [RFC PATCH 0/5] x86: dynamic indirect call promotion

2018-11-28 Thread Nadav Amit
> On Nov 28, 2018, at 8:08 AM, Josh Poimboeuf wrote: > > On Wed, Oct 17, 2018 at 05:54:15PM -0700, Nadav Amit wrote: >> This RFC introduces indirect call promotion in runtime, which for the >> matter of simplification (and branding) will be called here "relpolines"

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-28 Thread Nadav Amit
> On Nov 28, 2018, at 3:09 PM, Logan Gunthorpe wrote: > > > > On 2018-11-14 6:57 p.m., Nadav Amit wrote: >> Eventually, if you get a fix into icecc, we will need to change the >> Makefile, consider the version number and act accordingly. > > I got a fix pulled

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-28 Thread Nadav Amit
> On Nov 28, 2018, at 4:49 PM, Logan Gunthorpe wrote: > > > > On 2018-11-28 5:38 p.m., Nadav Amit wrote: >> So what’s your take? Would you think this patch is still needed? Should it >> only be enabled automatically for distcc and not for distcc-pump? > >

Re: [RFC PATCH 0/5] x86: dynamic indirect call promotion

2018-11-28 Thread Nadav Amit
> On Nov 28, 2018, at 5:40 PM, Andy Lutomirski wrote: > > On Wed, Nov 28, 2018 at 4:38 PM Josh Poimboeuf wrote: >> On Wed, Nov 28, 2018 at 07:34:52PM +0000, Nadav Amit wrote: >>>> On Nov 28, 2018, at 8:08 AM, Josh Poimboeuf wrote: >>>> >>>> O

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-14 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 15, 2018 at 1:19:45 AM GMT > To: Nadav Amit , Ingo Molnar > Cc: Ingo Molnar , Masahiro Yamada > , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , X86 ML , Linux Kbuild mailing > list , LKML > Subject: Re: [PAT

[PATCH] vmw_balloon: update maintainers list

2018-11-14 Thread Nadav Amit
From: Xavier Deguillard Julien will be replacing me as the vmw_balloon maintainer. Cc: Julien Freche Signed-off-by: Xavier Deguillard Signed-off-by: Nadav Amit --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a78d45755881

[PATCH v2 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-14 Thread Nadav Amit
file. Since this is less efficient, this compilation mode is only used when distcc or icecc are used. Note that the assembly stage should also be distributed, if distcc is configured using "CFLAGS=-DENABLE_REMOTE_ASSEMBLE". Reported-by: Logan Gunthorpe Signed-off-by: Nadav Amit ---

[PATCH v2 2/2] x86: set a dependency on macros.S

2018-11-14 Thread Nadav Amit
Changes in macros.S should trigger the recompilation of all C files, as the macros might need to affect their compilation. Acked-by: Ingo Molnar Signed-off-by: Nadav Amit --- scripts/Makefile.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.build b

[PATCH v2 0/2] x86: Asm macros fixes

2018-11-14 Thread Nadav Amit
patches through tip. Please advise if you disagree. v1->v2: * Remove whitespaces [Ingo] * Automatically enable split compilation when distcc or icecc are used Nadav Amit (2): Makefile: Fix distcc compilation with x86 macros x86: set a dependency on macros.S Makefile | 4 +++- a

Re: [PATCH v2 2/2] x86: set a dependency on macros.S

2018-11-16 Thread Nadav Amit
From: Masahiro Yamada Sent: November 16, 2018 at 7:37:46 AM GMT > To: Nadav Amit > Cc: Ingo Molnar , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , X86 ML , Linux Kbuild mailing > list , Linux Kernel Mailing List > > Subject: Re: [PATCH v2 2/2]

Re: [PATCH v2 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-16 Thread Nadav Amit
From: Masahiro Yamada Sent: November 16, 2018 at 7:45:45 AM GMT > To: Nadav Amit > Cc: Ingo Molnar , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , X86 ML , Linux Kbuild mailing > list , Linux Kernel Mailing List > > Subject: Re: [PATCH v2 1/2]

Re: [PATCH v4 06/10] x86/alternative: use temporary mm for text poking

2018-11-11 Thread Nadav Amit
From: Peter Zijlstra Sent: November 11, 2018 at 11:52:20 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , LKML , X86 > ML , H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , Masami > Hiramatsu > Subject:

Re: [PATCH v4 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-12 Thread Nadav Amit
Peter, I have put you as a “Co-Developed-by”, since the patch ended up as being the single line that you wrote in the correspondence of the previous version. I would therefore need to ask for your signed-off-by. Regards, Nadav From: Nadav Amit Sent: November 10, 2018 at 11:17:24 PM GMT >

[PATCH 0/2] x86: Asm macros fixes

2018-11-12 Thread Nadav Amit
There has been a complaint that the recent use of assembly macros in C files broke distcc. The first patch fixes this issue. The second patch adds a dependency for all C files on macros.S, to trigger their recompilation when the relevant macros change. Nadav Amit (2): Makefile: Fix distcc

[PATCH 2/2] x86: set a dependency on macros.S

2018-11-12 Thread Nadav Amit
Changes in macros.S should trigger the recompilation of all C files, as the macros might need to affect their compilation. Signed-off-by: Nadav Amit --- scripts/Makefile.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build

[PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-12 Thread Nadav Amit
file. Since this is less efficient, this compilation mode is only used when make is called with the "DISTCC=y" parameter. Note that the assembly stage should also be distributed, if distcc is configured using "CFLAGS=-DENABLE_REMOTE_ASSEMBLE". Reported-by: Logan Gunthorpe

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-13 Thread Nadav Amit
From: Ingo Molnar Sent: November 13, 2018 at 11:30:00 AM GMT > To: Nadav Amit > Cc: Ingo Molnar , Masahiro Yamada > , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , x...@kernel.org, linux-kbu...@vger.kernel.org, > linux-kernel@vger.kernel.org > Su

Re: [PATCH 10/17] prmem: documentation

2018-11-13 Thread Nadav Amit
From: Andy Lutomirski Sent: November 13, 2018 at 5:47:16 PM GMT > To: Nadav Amit > Cc: Igor Stoppa , Kees Cook , > Peter Zijlstra , Mimi Zohar , > Matthew Wilcox , Dave Chinner , > James Morris , Michal Hocko , Kernel > Hardening , linux-integrity > , LSM List >

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-13 Thread Nadav Amit
From: Nadav Amit Sent: November 13, 2018 at 5:55:34 PM GMT > To: Ingo Molnar > Cc: Ingo Molnar , Masahiro Yamada > , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , X86 ML , Linux Kbuild mailing > list , LKML , > Logan Gunthorpe > Subject:

[PATCH v5 06/10] x86/alternative: use temporary mm for text poking

2018-11-13 Thread Nadav Amit
conservative enough when mapping pages, as it always tries to map 2 pages, even when a single one is sufficient. So try to be more conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v5 04/10] fork: provide a function for copying init_mm

2018-11-13 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

[PATCH v5 09/10] x86/jump-label: remove support for custom poker

2018-11-13 Thread Nadav Amit
Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index ed5fe274a7d8..994c13e2867d 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86

[PATCH v5 03/10] x86/mm: temporary mm struct

2018-11-13 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 32 ++ 1 file changed, 32 insertions(+) diff --git a/arch/x86/include/asm

[PATCH v5 08/10] x86: avoid W^X being broken during modules loading

2018-11-13 Thread Nadav Amit
Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/kernel/alternative.c | 28 +--- arch/x86/kernel/module.c | 2 +- include/linux/filter.h| 6 ++ kernel

[PATCH v5 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-13 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Co-Developed-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 7 ++- 1 file ch

[PATCH v5 10/10] x86/alternative: remove the return value of text_poke_*()

2018-11-13 Thread Nadav Amit
The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 4 ++-- arch/x86/kernel/alternative.c| 11

[PATCH v5 07/10] x86/kgdb: avoid redundant comparison of patched code

2018-11-13 Thread Nadav Amit
text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kernel

[PATCH v5 00/10] x86/alternative: text_poke() fixes

2018-11-13 Thread Nadav Amit
ify text_mutex use instead [masami] - Comment fix [peterz] - Removed remainders of text_poke return value [masami] - Use __weak for poking_init instead of macros [masami] - Simplify error handling in poking_init [masami] Andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (9): Fix

[PATCH v5 05/10] x86/alternative: initializing temporary mm for patching

2018-11-13 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 35

[PATCH v5 01/10] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-13 Thread Nadav Amit
e text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Acked-by: Jiri Kosina Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 3 +- arch/x86/kernel/alternative.c| 72 +--- arch/x86/kernel/kgdb.c | 15 -- 3 files changed,

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-14 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 14, 2018 at 7:29:38 AM GMT > To: Nadav Amit , Ingo Molnar > Cc: Ingo Molnar , Masahiro Yamada > , Michal Marek , > Thomas Gleixner , Borislav Petkov , H. > Peter Anvin , X86 ML , Linux Kbuild mailing > list , LKML > Subject: Re: [PAT

[PATCH v7 10/14] x86: avoid W^X being broken during modules loading

2018-12-05 Thread Nadav Amit
protection. Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/kernel/alternative.c | 28 +--- arch/x86/kernel/module.c | 2 +- include/linux

[PATCH v7 11/14] x86/jump-label: remove support for custom poker

2018-12-05 Thread Nadav Amit
Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index ed5fe274a7d8..994c13e2867d 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86

[PATCH v7 12/14] x86/alternative: Remove the return value of text_poke_*()

2018-12-05 Thread Nadav Amit
The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 4 ++-- arch/x86/kernel/alternative.c| 11

[PATCH v7 14/14] module: Prevent module removal racing with text_poke()

2018-12-05 Thread Nadav Amit
It seems dangerous to allow code modifications to take place concurrently with module unloading. So take the text_mutex while the memory of the module is freed. Signed-off-by: Nadav Amit --- kernel/module.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kernel/module.c b/kernel

[PATCH v7 13/14] module: Do not set nx for module memory before freeing

2018-12-05 Thread Nadav Amit
the PTEs can be avoided (excluding the direct-mapping alias), which is true. However, in x86 it requires some cleanup of the contiguous page allocator, which is outside of the scope of this patch-set. Cc: Rick P Edgecombe Cc: Will Deacon Cc: Andy Lutomirski Signed-off-by: Nadav Amit --- kerne

[PATCH v7 01/14] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-12-05 Thread Nadav Amit
e text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Acked-by: Jiri Kosina Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 1 + arch/x86/kernel/alternative.c| 52 arch/x86/kernel/kgdb.c | 11 +++--- 3 files changed,

[PATCH v7 04/14] fork: provide a function for copying init_mm

2018-12-05 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

[PATCH v7 06/14] x86/alternative: use temporary mm for text poking

2018-12-05 Thread Nadav Amit
conservative enough when mapping pages, as it always tries to map 2 pages, even when a single one is sufficient. So try to be more conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v7 05/14] x86/alternative: initializing temporary mm for patching

2018-12-05 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 35

[PATCH v7 09/14] x86/kprobes: Instruction pages initialization enhancements

2018-12-05 Thread Nadav Amit
executable pages from modifications using nested page-tables. This would allow us to ensure the executable has not changed between allocation and its write-protection. While at it, do some small cleanup of what appears to be unnecessary masking. Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v7 07/14] x86/kgdb: avoid redundant comparison of patched code

2018-12-05 Thread Nadav Amit
text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff

[PATCH v7 02/14] x86/jump_label: Use text_poke_early() during early init

2018-12-05 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Cc: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 7 ++- 1 file changed, 6 inser

[PATCH v7 08/14] x86/ftrace: Use text_poke_*() infrastructure

2018-12-05 Thread Nadav Amit
This provides the advantages of having slightly "safer" code patching and avoiding races with module removal or other mechanisms that patch the kernel code. Cc: Steven Rostedt Signed-off-by: Nadav Amit --- arch/x86/kernel/ftrace.c | 74 +--- 1 f

[PATCH v7 00/14] x86/alternative: text_poke() enhancements

2018-12-05 Thread Nadav Amit
error handling in poking_init [masami] Andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (13): Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()" x86/jump_label: Use text_poke_early() during early init fork: provide a function for copying init_

[PATCH v7 03/14] x86/mm: temporary mm struct

2018-12-05 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 32 ++ 1 file changed, 32 insertions(+) diff --git a/arch/x86/include/asm

Re: [PATCH v7 08/14] x86/ftrace: Use text_poke_*() infrastructure

2018-12-05 Thread Nadav Amit
> On Dec 4, 2018, at 5:34 PM, Nadav Amit wrote: > > A following patch is going to make module allocated memory > non-executable. This requires to modify ftrace and make the memory > executable again after it is configured. > > In addition, this patch makes ftrace use th

Re: [PATCH v7 13/14] module: Do not set nx for module memory before freeing

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 1:57 AM, Peter Zijlstra wrote: > > On Tue, Dec 04, 2018 at 05:34:07PM -0800, Nadav Amit wrote: > >> So let's remove it. Andy suggested that the changes of the PTEs can be >> avoided (excluding the direct-mapping alias), which is true. Howeve

Re: [PATCH v7 13/14] module: Do not set nx for module memory before freeing

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 10:52 AM, Andy Lutomirski wrote: > > On Wed, Dec 5, 2018 at 12:52 AM Nadav Amit wrote: >> When module memory is about to be freed, there is no apparent reason to >> make it (and its data) executable, but that's exactly what is done >> toda

Re: [PATCH v7 13/14] module: Do not set nx for module memory before freeing

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 12:21 PM, Edgecombe, Rick P > wrote: > > On Thu, 2018-12-06 at 10:52 -0800, Andy Lutomirski wrote: >> On Wed, Dec 5, 2018 at 12:52 AM Nadav Amit wrote: >>> When module memory is about to be freed, there is no apparent reason to >>> ma

Should this_cpu_read() be volatile?

2018-12-07 Thread Nadav Amit
[Resend, changing title & adding lkml and some others ] On Dec 7, 2018, at 3:12 PM, Nadav Amit wrote: [ We can start a new thread, since I have the tendency to hijack threads. ] > On Dec 7, 2018, at 12:45 AM, Peter Zijlstra wrote: > > On Thu, Dec 06, 2018 at 09:26:24AM -080

Re: [RFC] avoid indirect calls for DMA direct mappings

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 9:43 AM, Jesper Dangaard Brouer wrote: > > On Thu, 6 Dec 2018 07:37:19 -0800 > Christoph Hellwig wrote: > >> Hi all, >> >> a while ago Jesper reported major performance regressions due to the >> spectre v2 mitigations in his XDP forwarding workloads. A large part >> of t

Re: [PATCH 1/2] vmalloc: New flag for flush before releasing pages

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 11:19 AM, Andy Lutomirski wrote: > > On Thu, Dec 6, 2018 at 11:01 AM Tycho Andersen wrote: >> On Thu, Dec 06, 2018 at 10:53:50AM -0800, Andy Lutomirski wrote: If we are going to unmap the linear alias, why not do it at vmalloc() time rather than vfree() time? >>>

Re: [PATCH 1/2] vmalloc: New flag for flush before releasing pages

2018-12-06 Thread Nadav Amit
> On Dec 6, 2018, at 12:17 PM, Andy Lutomirski wrote: > > On Thu, Dec 6, 2018 at 11:39 AM Nadav Amit wrote: >>> On Dec 6, 2018, at 11:19 AM, Andy Lutomirski wrote: >>> >>> On Thu, Dec 6, 2018 at 11:01 AM Tycho Andersen wrote: >>>> On Thu, D

Re: [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs

2018-12-09 Thread Nadav Amit
t me know. > > ------ > > From: Nadav Amit > > commit 9bc4f28af75a91aea0ae383f50b0a430c4509303 upstream. > > When page-table entries are set, the compiler might optimize their > assignment by using multiple instructions to set the PTE. This might > turn into a security hazard if the us

Re: Should this_cpu_read() be volatile?

2018-12-09 Thread Nadav Amit
> On Dec 8, 2018, at 2:52 AM, Peter Zijlstra wrote: > > On Fri, Dec 07, 2018 at 04:40:52PM -0800, Nadav Amit wrote: > >>> I'm actually having difficulty finding the this_cpu_read() in any of the >>> functions you mention, so I cannot make any concrete suggest

Re: [PATCH v7 00/14] x86/alternative: text_poke() enhancements

2018-12-09 Thread Nadav Amit
> On Dec 6, 2018, at 2:03 AM, Peter Zijlstra wrote: > > On Tue, Dec 04, 2018 at 05:33:54PM -0800, Nadav Amit wrote: >> Which leads me to (b) - the patch-set is big "enough" IMHO. Indeed, >> there are open security issues in the kernel when it comes to W^X. But &

Re: [PATCH v2] x86/hyper-v: Mark TLFS structures packed

2018-11-30 Thread Nadav Amit
mization, which would break the hypervisor ABI. > > Mark the structures as packed to prevent this. Seems good to me (I made sure you remembered to set __packed for the nested structs ;-) ) If needed: Acked-by: Nadav Amit Having said that, something else is sort of strange in the T

Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros

2018-11-30 Thread Nadav Amit
> On Nov 29, 2018, at 8:43 AM, Logan Gunthorpe wrote: > > > > On 2018-11-28 6:31 p.m., Nadav Amit wrote: >>> On Nov 28, 2018, at 4:49 PM, Logan Gunthorpe wrote: >>> >>> >>> >>> On 2018-11-28 5:38 p.m., Nadav Amit wrote: >>

Re: [RFC PATCH 0/5] x86: dynamic indirect call promotion

2018-11-30 Thread Nadav Amit
> On Nov 29, 2018, at 7:19 AM, Josh Poimboeuf wrote: > > On Wed, Nov 28, 2018 at 10:06:52PM -0800, Andy Lutomirski wrote: >> On Wed, Nov 28, 2018 at 7:24 PM Andy Lutomirski wrote: >>> On Nov 28, 2018, at 6:06 PM, Nadav Amit wrote: >>> >>>>> On

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-10 Thread Nadav Amit
From: Nadav Amit Sent: November 8, 2018 at 8:18:23 PM GMT > To: Logan Gunthorpe , h...@zytor.com , > Ingo Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , Linux Kbuild mailing list > , Stephen Bates > Subject: Re: [PATCH v9 02/10] Makefi

[PATCH v4 08/10] x86: avoid W^X being broken during modules loading

2018-11-10 Thread Nadav Amit
Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/kernel/alternative.c | 28 +--- arch/x86/kernel/module.c | 2 +- include/linux/filter.h| 6 ++ kernel

[PATCH v4 06/10] x86/alternative: use temporary mm for text poking

2018-11-10 Thread Nadav Amit
conservative enough when mapping pages, as it always tries to map 2 pages, even when a single one is sufficient. So try to be more conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v4 10/10] x86/alternative: remove the return value of text_poke_*()

2018-11-10 Thread Nadav Amit
The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 4 ++-- arch/x86/kernel/alternative.c| 11

[PATCH v4 09/10] x86/jump-label: remove support for custom poker

2018-11-10 Thread Nadav Amit
Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index ed5fe274a7d8..7947df599e58 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86/kernel

[PATCH v4 07/10] x86/kgdb: avoid redundant comparison of code

2018-11-10 Thread Nadav Amit
text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kernel

[PATCH v4 03/10] x86/mm: temporary mm struct

2018-11-10 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 20 1 file changed, 20 insertions(+) diff --git a/arch/x86/include/asm

[PATCH v4 05/10] x86/alternative: initializing temporary mm for patching

2018-11-10 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 39

[PATCH v4 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-10 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Co-Developed-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 7 ++- 1 file ch

[PATCH v4 04/10] fork: provide a function for copying init_mm

2018-11-10 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

[PATCH v4 00/10] x86/alternative: text_poke() fixes

2018-11-10 Thread Nadav Amit
s of text_poke return value [masami] - Use __weak for poking_init instead of macros [masami] - Simplify error handling in poking_init [masami] Andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (9): Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()" x86/

[PATCH v4 01/10] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-10 Thread Nadav Amit
Lockdep-enforce text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 3 +- arch/x86/kernel/alternative.c| 72 +--- arch/x86/kernel/kgdb.c | 15 -- 3 files changed,

<    1   2   3   4   5   6   7   8   9   10   >