Re: [PATCH] tools: libsubcmd: Drop the less hack that was inherited from Git.

2018-02-02 Thread Arvind Sankar
Hi, it looks like Sergey has put in a patch to fix the aliasing, looking at the linux-next tree. Are we still looking to remove this hack altogether? Thanks On Thu, Jan 25, 2018 at 08:24:26AM -0500, Arvind Sankar wrote: > Thanks. > > This was found because gcc 8 appears to be

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-15 Thread Arvind Sankar
On Fri, Jan 15, 2021 at 02:07:51PM -0500, Arvind Sankar wrote: > On Thu, Jan 07, 2021 at 11:34:15PM +0100, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > When 5-level page tables are enabled, clang triggers a BUILD_BUG_ON(): > > > > x86_64-linux-l

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-15 Thread Arvind Sankar
On Fri, Jan 15, 2021 at 08:54:18PM +0100, Arnd Bergmann wrote: > On Fri, Jan 15, 2021 at 8:18 PM Borislav Petkov wrote: > > > > On Fri, Jan 15, 2021 at 02:11:25PM -0500, Arvind Sankar wrote: > > > That's how build-time assertions work: they are _supposed_ to be > &g

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-15 Thread Arvind Sankar
On Fri, Jan 15, 2021 at 03:12:25PM -0500, Arvind Sankar wrote: > On Fri, Jan 15, 2021 at 08:54:18PM +0100, Arnd Bergmann wrote: > > On Fri, Jan 15, 2021 at 8:18 PM Borislav Petkov wrote: > > > > > > On Fri, Jan 15, 2021 at 02:11:25PM -0500, Arvind Sankar wrote: &g

Re: [PATCH v4 1/2] arm: lib: xor-neon: remove unnecessary GCC < 4.6 warning

2021-01-20 Thread Arvind Sankar
On Wed, Jan 20, 2021 at 03:09:53PM -0800, Nick Desaulniers wrote: > On Tue, Jan 19, 2021 at 1:35 PM Arnd Bergmann wrote: > > > > On Tue, Jan 19, 2021 at 10:18 PM 'Nick Desaulniers' via Clang Built > > Linux wrote: > > > > > > On Tue, Jan 19, 2021 at 5:17 AM Adrian Ratiu > > > wrote: > > > >

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-18 Thread Arvind Sankar
On Mon, Jan 18, 2021 at 09:24:09PM +0100, Borislav Petkov wrote: > > > > As a matter of fact, it seems like the four assertions could be combined > > > > into: > > > > BUILD_BUG_ON((EFI_VA_END & P4D_MASK) != (MODULES_END & P4D_MASK)); > > > > BUILD_BUG_ON((EFI_VA_START & P4D_MASK) !=

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-15 Thread Arvind Sankar
On Thu, Jan 07, 2021 at 11:34:15PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > When 5-level page tables are enabled, clang triggers a BUILD_BUG_ON(): > > x86_64-linux-ld: arch/x86/platform/efi/efi_64.o: in function > `efi_sync_low_kernel_mappings': > efi_64.c:(.text+0x22c): undefined

Re: [PATCH] x86: efi: avoid BUILD_BUG_ON() for non-constant p4d_index

2021-01-15 Thread Arvind Sankar
On Fri, Jan 15, 2021 at 08:07:29PM +0100, Borislav Petkov wrote: > On Fri, Jan 15, 2021 at 11:32:03AM -0700, Nathan Chancellor wrote: > > I triggered it with CONFIG_UBSAN=y + CONFIG_UBSAN_UNSIGNED_OVERFLOW=y > > (it can be exposed with an allyesconfig/allmodconfig on mainline > > currently). > >

[PATCH 0/2] x86/sev-es: Remove dead code

2020-10-05 Thread Arvind Sankar
Delete some unused macros and an unused function. One question: 4b47cdbda6f1 ("x86/head/64: Move early exception dispatch to C code") uses native_read_cr2(), while the asm code it replaces may use paravirt to read cr2. Is this intentional or should it be using read_cr2()? Arvind

[PATCH 1/2] x86/boot: Remove unused finalize_identity_maps()

2020-10-05 Thread Arvind Sankar
Commit [in tip/master] 8570978ea030 ("x86/boot/compressed/64: Don't pre-map memory in KASLR code") removed all the references to finalize_identity_maps(), but neglected to delete the actual function. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 10 ---

[PATCH 2/2] x86/head/64: Remove unused GET_CR2_INTO() macro

2020-10-05 Thread Arvind Sankar
Commit [in tip/master] 4b47cdbda6f1 ("x86/head/64: Move early exception dispatch to C code") removed the usage of GET_CR2_INTO(). Drop the definition as well, and related definitions in paravirt.h and asm-offsets.h Signed-off-by: Arvind Sankar --- arch/x86/include/asm/parav

[PATCH] x86/build: Fix vmlinux size check on 64-bit

2020-10-05 Thread Arvind Sankar
_SIZE from __START_KERNEL_map, not from _text. The correct check is the same as for 32-bit, since LOAD_OFFSET is defined appropriately for the two architectures. Just check (_end - LOAD_OFFSET) against KERNEL_IMAGE_SIZE unconditionally. Signed-off-by: Arvind Sankar --- arch/x86/kernel/vmlinux.

Re: [PATCH] lz4: Fix kernel decompression speed

2020-08-04 Thread Arvind Sankar
On Tue, Aug 04, 2020 at 10:32:36AM +0200, Pavel Machek wrote: > Hi! > > > >> I've measured the kernel decompression speed using QEMU before and after > > >> this patch for the x86_64 and i386 architectures. The speed-up is about > > >> 10x as shown below. > > >> > > >> Code ArchKernel

Re: [PATCH] lz4: Fix kernel decompression speed

2020-08-04 Thread Arvind Sankar
On Tue, Aug 04, 2020 at 02:57:50AM +, Nick Terrell wrote: > > > > On Aug 3, 2020, at 6:56 PM, Arvind Sankar wrote: > > > > > -- I see that ZSTD_copy8 is already using __builtin_memcpy, > > but there must be more that can be optimized? There's a

Re: [PATCH v5 13/36] vmlinux.lds.h: add PGO and AutoFDO input sections

2020-08-04 Thread Arvind Sankar
On Mon, Aug 03, 2020 at 09:45:32PM -0700, Andi Kleen wrote: > > Why is that? Both .text and .text.hot have alignment of 2^4 (default > > function alignment on x86) by default, so it doesn't seem like it should > > matter for packing density. Avoiding interspersing cold text among > > You may

[PATCH 0/1] x86/boot/compressed: Use builtin mem functions for decompressor

2020-08-04 Thread Arvind Sankar
optimized to use __builtin_memcpy for hot memcpy's, but still improves a little bit more with this patch. [0] https://lore.kernel.org/lkml/20200803194022.2966806-1-nickrterr...@gmail.com/ Arvind Sankar (1): x86/boot/compressed: Use builtin mem functions for decompressor arch/x86/boot/compressed

[PATCH 1/1] x86/boot/compressed: Use builtin mem functions for decompressor

2020-08-04 Thread Arvind Sankar
, of about 400 bytes. Signed-off-by: Arvind Sankar Suggested-by: Nick Terrell Tested-by: Nick Terrell --- arch/x86/boot/compressed/misc.c | 7 ++- arch/x86/boot/string.h | 5 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/bo

Re: Linux 5.9-rc7

2020-10-03 Thread Arvind Sankar
On Sat, Oct 03, 2020 at 04:23:15PM +0200, Gabriel C wrote: > Am Mo., 28. Sept. 2020 um 00:00 Uhr schrieb Linus Torvalds > : > Hello, > > > Shortlog appended, but what I really hope you all will do is to give > > it a nice good testing. One extra week or rc kernels will help, but > > only if

Re: [PATCH 1/1] efi/libstub/x86: simplify efi_is_native()

2020-10-03 Thread Arvind Sankar
On Sat, Oct 03, 2020 at 01:28:18PM -0400, Brian Gerst wrote: > On Sat, Oct 3, 2020 at 2:05 AM Heinrich Schuchardt wrote: > > > > CONFIG_EFI_MIXED depends on CONFIG_X86_64=y. > > There is no need to check CONFIG_X86_64 again. > > > > Signed-off-by: Heinrich Schuchardt > > --- > >

Re: [PATCH 1/1] efi/libstub/x86: simplify efi_is_native()

2020-10-04 Thread Arvind Sankar
On Sun, Oct 04, 2020 at 04:14:11PM +0200, Ard Biesheuvel wrote: > On Sat, 3 Oct 2020 at 21:44, Arvind Sankar wrote: > > > > On Sat, Oct 03, 2020 at 01:28:18PM -0400, Brian Gerst wrote: > > > On Sat, Oct 3, 2020 at 2:05 AM Heinrich Schuchardt > > > wrote: > &g

Re: [PATCH 07/13] x86: Secure Launch kernel early boot stub

2020-09-29 Thread Arvind Sankar
On Tue, Sep 29, 2020 at 10:03:47AM -0400, Ross Philipson wrote: > On 9/25/20 3:18 PM, Arvind Sankar wrote: > > You will also need to avoid initializing data with symbol addresses. > > > > .long mle_header > > .long sl_stub_entry > > .long sl_gd

Re: [PATCH] compiler.h: avoid escaped section names

2020-09-29 Thread Arvind Sankar
On Tue, Sep 29, 2020 at 12:43:18PM -0700, Nick Desaulniers wrote: > The stringification operator, `#`, in the preprocessor escapes strings. > For example, `# "foo"` becomes `"\"foo\""`. GCC and Clang differ in how > they treat section names that contain \". > > The portable solution is to not

Re: [PATCH] compiler.h: avoid escaped section names

2020-09-29 Thread Arvind Sankar
On Tue, Sep 29, 2020 at 04:08:01PM -0400, Arvind Sankar wrote: > On Tue, Sep 29, 2020 at 12:43:18PM -0700, Nick Desaulniers wrote: > > The stringification operator, `#`, in the preprocessor escapes strings. > > For example, `# "foo"` becomes `"\"foo\""`

Re: [PATCH] compiler.h: avoid escaped section names

2020-09-29 Thread Arvind Sankar
On Tue, Sep 29, 2020 at 01:30:22PM -0700, Nick Desaulniers wrote: > On Tue, Sep 29, 2020 at 1:25 PM Nick Desaulniers > wrote: > > > > On Tue, Sep 29, 2020 at 1:08 PM Arvind Sankar wrote: > > > > > > On Tue, Sep 29, 2020 at 12:43:18PM -0700, Nick Desaulnier

[PATCH] x86/boot: Place kernel_info at a fixed offset

2020-09-29 Thread Arvind Sankar
e. Signed-off-by: Arvind Sankar Cc: Ross Philipson [0] https://lore.kernel.org/lkml/1600959521-24158-8-git-send-email-ross.philip...@oracle.com/ --- arch/x86/boot/compressed/kernel_info.S | 19 +++ arch/x86/boot/compressed/kernel_info.h | 12 arch/x86/boot/

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > > > Since this variable is a local register asm, on entry to the asm the > > > compiler

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 03:59:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra > > wrote: > > > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boess

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 06:25:59PM -0500, Segher Boessenkool wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > Do we need register local storage here? > > Depends what you want. It looks like you do: > > > static inline long bar(unsigned long hcall_id) > > { > >

[PATCH] compiler.h: Fix barrier_data() on clang

2020-10-14 Thread Arvind Sankar
definition of barrier() into compiler.h, __memory_barrier() is icc-specific (and barrier() is already defined using it in compiler-intel.h) and doesn't belong in compiler.h. Signed-off-by: Arvind Sankar Fixes: 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive"

Re: [PATCH] compiler.h: Fix barrier_data() on clang

2020-10-15 Thread Arvind Sankar
On Thu, Oct 15, 2020 at 08:50:05AM +, David Laight wrote: > From: Arvind Sankar > > Sent: 14 October 2020 22:27 > ... > > +/* > > + * This version is i.e. to prevent dead stores elimination on @ptr > > + * where gcc and llvm may behave differently when otherwis

Re: [PATCH] compiler.h: Fix barrier_data() on clang

2020-10-15 Thread Arvind Sankar
On Thu, Oct 15, 2020 at 03:24:09PM +, David Laight wrote: > > I think the comment is unclear now that you bring it up, but the problem > > it actually addresses is not that the data is held in registers: in the > > sha256_transform() case mentioned in the commit message, for example, > > the

[PATCH] compiler.h: Clarify comment about the need for barrier_data()

2020-10-15 Thread Arvind Sankar
Be clear about @ptr vs the variable that @ptr points to, and add some more details as to why the special barrier_data() macro is required. Signed-off-by: Arvind Sankar --- include/linux/compiler.h | 33 ++--- 1 file changed, 22 insertions(+), 11 deletions(-) diff

Re: [PATCH] compiler.h: Clarify comment about the need for barrier_data()

2020-10-15 Thread Arvind Sankar
On Thu, Oct 15, 2020 at 09:09:11PM +, David Laight wrote: > From: Arvind Sankar > > Sent: 15 October 2020 19:14 > > > > Be clear about @ptr vs the variable that @ptr points to, and add some > > more details as to why the special barrier_data() macro is required. >

Re: [PATCH v2 5/5] x86/head/64: Disable stack protection for head$(BITS).o

2020-10-16 Thread Arvind Sankar
On Fri, Oct 16, 2020 at 01:17:03PM +0200, Borislav Petkov wrote: > On Thu, Oct 08, 2020 at 03:16:23PM -0400, Arvind Sankar wrote: > > On 64-bit, the startup_64_setup_env() function added in > > 866b556efa12 ("x86/head/64: Install startup GDT") > > has s

Re: [PATCH] compiler.h: Clarify comment about the need for barrier_data()

2020-10-16 Thread Arvind Sankar
On Fri, Oct 16, 2020 at 08:13:44AM +, David Laight wrote: > From: Arvind Sankar > > Sent: 15 October 2020 23:01 > ,,, > > I think it's helpful to have the more detailed explanation about > > register variables -- at first glance, it's a bit mystifying as to why >

Re: [PATCH v2 5/5] x86/head/64: Disable stack protection for head$(BITS).o

2020-10-16 Thread Arvind Sankar
On Fri, Oct 16, 2020 at 03:15:45PM +0200, Borislav Petkov wrote: > On Fri, Oct 16, 2020 at 08:43:01AM -0400, Arvind Sankar wrote: > > You need STACKPROTECTOR_STRONG -- I was testing with defconfig and the > > option is enabled by default. > > And you need to write those

Re: [PATCH v2 4/5] x86/boot/64: Explicitly map boot_params and command line

2020-10-16 Thread Arvind Sankar
On Fri, Oct 16, 2020 at 06:27:59PM +0200, Borislav Petkov wrote: > On Thu, Oct 08, 2020 at 03:16:22PM -0400, Arvind Sankar wrote: > > Signed-off-by: Arvind Sankar > > --- > > arch/x86/boot/compressed/ident_map_64.c | 16 ++-- > > 1 file changed, 14

Re: [PATCH v2 4/5] x86/boot/64: Explicitly map boot_params and command line

2020-10-16 Thread Arvind Sankar
On Fri, Oct 16, 2020 at 07:07:42PM +0200, Borislav Petkov wrote: > On Fri, Oct 16, 2020 at 12:47:55PM -0400, Arvind Sankar wrote: > > Just for clarity, by cleanups you mean patches 2 and 3? i.e. you want to > > see 1, 4, 2, 3? > > It is important for: > > [PATCH v2 4

[PATCH 4/5] x86/boot/64: Explicitly map boot_params and command line

2020-10-07 Thread Arvind Sankar
t be in the identity mapping, but those don't get accessed by the main kernel before it switches to its own page tables. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/ident_

[PATCH 2/5] x86/boot: Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h

2020-10-07 Thread Arvind Sankar
Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h for easier use from multiple files. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/cmdline.c | 8 arch/x86/boot/compressed/kaslr.c | 6 -- arch/x86/boot/compressed/misc.h| 13 + 3 files changed

[PATCH 5/5] x86/head/64: Disable stack protection for head$(BITS).o

2020-10-07 Thread Arvind Sankar
ndler from the decompressor stub is still installed and handles the page fault. Disable stack protection for the whole file, and do it on 32-bit as well to avoid surprises. Signed-off-by: Arvind Sankar --- arch/x86/kernel/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/Makefile

[PATCH 0/5] Couple of bugfixes to sev-es series

2020-10-07 Thread Arvind Sankar
protector for head code. Arvind Sankar (5): x86/boot: Initialize boot_params in startup code x86/boot: Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h x86/boot/64: Change add_identity_map() to take size for ease of use x86/boot/64: Explicitly map boot_params and command line

[PATCH 3/5] x86/boot/64: Change add_identity_map() to take size for ease of use

2020-10-07 Thread Arvind Sankar
also makes the #PF handler print the original CR2 value in case of error, instead of after aligning to PMD_SIZE. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/x86/boot/compressed/iden

[PATCH 1/5] x86/boot: Initialize boot_params in startup code

2020-10-07 Thread Arvind Sankar
Save the boot_params pointer passed in by the bootloader in startup_32/64. This avoids having to initialize it in two different places in C code, and having to preserve SI through the early assembly code. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/head_32.S| 11

Re: [PATCH 1/5] x86/boot: Initialize boot_params in startup code

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 11:04:20AM +0200, Joerg Roedel wrote: > On Wed, Oct 07, 2020 at 03:53:47PM -0400, Arvind Sankar wrote: > > Save the boot_params pointer passed in by the bootloader in > > startup_32/64. This avoids having to initialize it in two different > > places

Re: [PATCH 2/5] x86/boot: Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 11:30:42AM +0200, Borislav Petkov wrote: > On Wed, Oct 07, 2020 at 03:53:48PM -0400, Arvind Sankar wrote: > > Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h for easier > > use from multiple files. > > Well, I don't like that. cmdline.c *is

Re: [PATCH 3/5] x86/boot/64: Change add_identity_map() to take size for ease of use

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 11:14:12AM +0200, Joerg Roedel wrote: > On Wed, Oct 07, 2020 at 03:53:49PM -0400, Arvind Sankar wrote: > > Change back the arguments of add_identity_map() to (start, size) instead > > of (start, end). This reverts > > > > 21cf2372618e (&quo

Re: [PATCH 4/5] x86/boot/64: Explicitly map boot_params and command line

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 11:48:36AM +0200, Joerg Roedel wrote: > On Wed, Oct 07, 2020 at 03:53:50PM -0400, Arvind Sankar wrote: > > This is fragile, as boot_params and the command line mappings are > > required for the main kernel. If EARLY_PRINTK and RANDOMIZE_BASE are > >

Re: [PATCH 5/5] x86/head/64: Disable stack protection for head$(BITS).o

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 10:42:19AM +0200, Joerg Roedel wrote: > On Wed, Oct 07, 2020 at 03:53:51PM -0400, Arvind Sankar wrote: > > On 64-bit, the startup_64_setup_env() function added in > > 866b556efa12 ("x86/head/64: Install startup GDT") > > has s

Re: [PATCH 2/5] x86/boot: Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h

2020-10-08 Thread Arvind Sankar
On Thu, Oct 08, 2020 at 05:10:47PM +0200, Borislav Petkov wrote: > On Thu, Oct 08, 2020 at 09:47:23AM -0400, Arvind Sankar wrote: > > Are you ok with the include of setup.h? > > Or you could simply add cmdline.h and include that. It is high time we > started cleaning up

[PATCH v2 2/5] x86/boot: Split out command-line related declarations

2020-10-08 Thread Arvind Sankar
Move prototypes for command-line related functions into a new header file to split it out from misc.h. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/acpi.c | 1 + arch/x86/boot/compressed/cmdline.c | 1 + arch/x86/boot/compressed/cmdline.h

[PATCH v2 3/5] x86/boot/64: Show original faulting address in case of error

2020-10-08 Thread Arvind Sankar
This makes the #PF handler print the original CR2 value in case of error, instead of after aligning to PMD_SIZE. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed

[PATCH v2 5/5] x86/head/64: Disable stack protection for head$(BITS).o

2020-10-08 Thread Arvind Sankar
ndler from the decompressor stub is still installed and handles the page fault. Disable stack protection for the whole file, and do it on 32-bit as well to avoid surprises. Signed-off-by: Arvind Sankar --- arch/x86/kernel/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/Makefile

[PATCH v2 4/5] x86/boot/64: Explicitly map boot_params and command line

2020-10-08 Thread Arvind Sankar
t be in the identity mapping, but those don't get accessed by the main kernel before it switches to its own page tables. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compress

[PATCH v2 1/5] x86/boot: Initialize boot_params in startup code

2020-10-08 Thread Arvind Sankar
is relocated. Signed-off-by: Arvind Sankar Reviewed-by: Joerg Roedel --- arch/x86/boot/compressed/head_32.S| 12 + arch/x86/boot/compressed/head_64.S| 35 +-- arch/x86/boot/compressed/misc.c | 10 +--- arch/x86/boot/compressed/pgtable_64.c | 5 +--- 4

[PATCH v2 0/5] Couple of bugfixes to sev-es series

2020-10-08 Thread Arvind Sankar
protector for head code. Changes from v1: - Add comments suggested by Joerg - Split out cmdline into cmdline.h and use it - Leave add_identity_map() as [start,end) v1: https://lore.kernel.org/lkml/20201007195351.776555-1-nived...@alum.mit.edu/ Arvind Sankar (5): x86/boot: Initialize

[PATCH] x86/boot/64: Initialize 5-level paging variables earlier

2020-10-10 Thread Arvind Sankar
n anything that might require those variables, and keeps the 4- vs 5-level paging code all in one place. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/ident_map_64.c | 6 -- arch/x86/boot/compressed/kaslr.c| 8 arch/x86/boot/compressed/pgtable_6

Re: [PATCH] x86/boot/64: Initialize 5-level paging variables earlier

2020-10-10 Thread Arvind Sankar
On Sat, Oct 10, 2020 at 03:11:10PM -0400, Arvind Sankar wrote: > Commit > ca0e22d4f011 ("x86/boot/compressed/64: Always switch to own page table") > started using a new set of pagetables even without KASLR. > > After that commit, initialize_identity_maps() is called be

[PATCH] efi/x86: Only copy the compressed kernel image in efi_relocate_kernel()

2020-10-11 Thread Arvind Sankar
on compression level, this can reduce the amount of data copied by 4-5x. Signed-off-by: Arvind Sankar --- drivers/firmware/efi/libstub/x86-stub.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index

Re: [PATCH] x86/boot/64: Initialize 5-level paging variables earlier

2020-10-12 Thread Arvind Sankar
On Mon, Oct 12, 2020 at 05:08:30PM +0300, Kirill A. Shutemov wrote: > On Sat, Oct 10, 2020 at 03:26:24PM -0400, Arvind Sankar wrote: > > On Sat, Oct 10, 2020 at 03:11:10PM -0400, Arvind Sankar wrote: > > > Commit > > > ca0e22d4f011 ("x86/boot/compressed/64:

Re: [PATCH] x86/cmdline: Disable instrumentation of cmdline unconditionally

2020-09-17 Thread Arvind Sankar
On Thu, Sep 17, 2020 at 11:40:55AM +0200, Borislav Petkov wrote: > On Sun, Sep 06, 2020 at 11:46:37AM -0400, Arvind Sankar wrote: > > On 32-bit, cmdline_find_option_bool() is used before paging is enabled, > > from check_loader_disabled_bsp() in the early microcode loader. >

Re: [PATCH v6 13/76] x86/boot/compressed/64: Add IDT Infrastructure

2020-08-27 Thread Arvind Sankar
On Mon, Aug 24, 2020 at 10:54:08AM +0200, Joerg Roedel wrote: > From: Joerg Roedel > > Add code needed to setup an IDT in the early pre-decompression > boot-code. The IDT is loaded first in startup_64, which is after > EfiExitBootServices() has been called, and later reloaded when the > kernel

Re: [PATCH v6 02/76] KVM: SVM: Add GHCB definitions

2020-08-27 Thread Arvind Sankar
On Tue, Aug 25, 2020 at 01:04:46PM +0200, Borislav Petkov wrote: > On Tue, Aug 25, 2020 at 11:22:24AM +0200, Joerg Roedel wrote: > > I don't think so, if I look at the history of these checks their whole > > purpose seems to be to alert the developer/maintainer when their size > > changes and that

Re: [PATCH v6 27/76] x86/sev-es: Add CPUID handling to #VC handler

2020-08-27 Thread Arvind Sankar
On Mon, Aug 24, 2020 at 10:54:22AM +0200, Joerg Roedel wrote: > From: Tom Lendacky > > Handle #VC exceptions caused by CPUID instructions. These happen in > early boot code when the KASLR code checks for RDTSC. > > Signed-off-by: Tom Lendacky > [ jroe...@suse.de: Adapt to #VC handling

[PATCH] x86/boot/compressed: Disable relocation relaxation for non-pie link

2020-08-11 Thread Arvind Sankar
kml/20200807194100.3570838-1-ndesaulni...@google.com/ [2] https://github.com/ClangBuiltLinux/linux/issues/1121 [3] https://reviews.llvm.org/rGc41a18cf61790fc898dcda1055c3efbf442c14c0 [4] https://lore.kernel.org/lkml/20200731202738.2577854-1-nived...@alum.mit.edu/ Signed-off-by: Arvind Sankar Reported-by: N

Re: [PATCH] x86/boot/compressed: Disable relocation relaxation for non-pie link

2020-08-11 Thread Arvind Sankar
On Tue, Aug 11, 2020 at 10:58:40AM -0700, Nick Desaulniers wrote: > > Cc: sta...@vger.kernel.org # 4.19.x > > Thanks Arvind, good write up. Just curious about this stable tag, how > come you picked 4.19? I can see boot failures in our CI for x86+LLD > back to 4.9. Can we amend that tag to use

Re: [PATCH] x86/boot/compressed: Disable relocation relaxation for non-pie link

2020-08-11 Thread Arvind Sankar
On Tue, Aug 11, 2020 at 04:04:40PM -0700, Nick Desaulniers wrote: > On Tue, Aug 11, 2020 at 3:44 PM Arvind Sankar wrote: > > > > On Tue, Aug 11, 2020 at 10:58:40AM -0700, Nick Desaulniers wrote: > > > > Cc: sta...@vger.kernel.org # 4.19.x > > > > > >

Re: [PATCH] x86/boot/compressed: Disable relocation relaxation for non-pie link

2020-08-11 Thread Arvind Sankar
On Tue, Aug 11, 2020 at 04:51:23PM -0700, Nick Desaulniers wrote: > On Tue, Aug 11, 2020 at 4:43 PM Arvind Sankar wrote: > > > > On Tue, Aug 11, 2020 at 04:04:40PM -0700, Nick Desaulniers wrote: > > > On Tue, Aug 11, 2020 at 3:44 PM Arvind Sankar > > > wrot

[PATCH v2] x86/boot/compressed: Disable relocation relaxation

2020-08-11 Thread Arvind Sankar
edu/ Signed-off-by: Arvind Sankar Reported-by: Nick Desaulniers Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Cc: sta...@vger.kernel.org Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/boot/compres

Re: [PATCH] x86: work around clang IAS bug referencing __force_order

2020-08-13 Thread Arvind Sankar
On Wed, Aug 12, 2020 at 05:12:34PM -0700, Nick Desaulniers wrote: > On Thu, Aug 6, 2020 at 3:11 PM Thomas Gleixner wrote: > > > > Arnd Bergmann writes: > > > When using the clang integrated assembler, we get a reference > > > to __force_order that should normally get ignored in a few > > > rare

Re: [PATCH] x86: work around clang IAS bug referencing __force_order

2020-08-13 Thread Arvind Sankar
On Thu, Aug 13, 2020 at 10:37:01AM -0700, Paul E. McKenney wrote: > On Thu, Aug 13, 2020 at 07:28:57PM +0200, Thomas Gleixner wrote: > > Nick Desaulniers writes: > > > On Thu, Aug 6, 2020 at 3:11 PM Thomas Gleixner wrote: > > >> > + * > > >> > + * Clang sometimes fails to kill the reference to

[PATCH 2/3] efi/libstub: Handle NULL cmdline

2020-08-13 Thread Arvind Sankar
Treat a NULL cmdline the same as empty. Although this is unlikely to happen in practice, the x86 kernel entry does check for NULL cmdline and handles it, so do it here as well. Signed-off-by: Arvind Sankar --- drivers/firmware/efi/libstub/efi-stub-helper.c | 6 +- 1 file changed, 5

[PATCH 1/3] efi/libstub: Stop parsing arguments at "--"

2020-08-13 Thread Arvind Sankar
Arguments after "--" are arguments for init, not for the kernel. Signed-off-by: Arvind Sankar --- drivers/firmware/efi/libstub/efi-stub-helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stu

[PATCH 0/3] Three small fixes to cmdline parsing

2020-08-13 Thread Arvind Sankar
First 2 are resends: https://lore.kernel.org/linux-efi/20200725155916.1376773-1-nived...@alum.mit.edu/ https://lore.kernel.org/linux-efi/20200729193300.598448-1-nived...@alum.mit.edu/ Arvind Sankar (3): efi/libstub: Stop parsing arguments at "--" efi/libstub: Handle NULL cmdline e

[PATCH 3/3] efi/libstub: Handle unterminated cmdline

2020-08-13 Thread Arvind Sankar
Make the command line parsing more robust, by handling the case it is not NUL-terminated. Use strnlen instead of strlen, and make sure that the temporary copy is NUL-terminated before parsing. Signed-off-by: Arvind Sankar --- drivers/firmware/efi/libstub/efi-stub-helper.c | 6 -- 1 file

Re: [RFC PATCH 1/2] lib/string: Disable instrumentation

2020-09-08 Thread Arvind Sankar
On Tue, Sep 08, 2020 at 10:21:32AM -0700, Kees Cook wrote: > On Tue, Sep 08, 2020 at 11:39:11AM +0200, Marco Elver wrote: > > On Sun, 6 Sep 2020 at 00:23, Arvind Sankar wrote: > > > > > > String functions can be useful in early boot, but using instrumented > >

Re: [PATCH v7 4/5] x86/build: Warn on orphan section placement

2020-09-08 Thread Arvind Sankar
On Sat, Sep 05, 2020 at 06:48:35PM -0400, Arvind Sankar wrote: > On Tue, Sep 01, 2020 at 07:53:46PM -0700, Kees Cook wrote: > > We don't want to depend on the linker's orphan section placement > > heuristics as these can vary between linkers, and may change between > > versio

[PATCH v6 0/7] x86/boot: Remove run-time relocations from compressed kernel

2020-07-31 Thread Arvind Sankar
dyn and .rela.dyn, instead of just one per arch. Ard Biesheuvel (3): x86/boot/compressed: Move .got.plt entries out of the .got section x86/boot/compressed: Force hidden visibility for all symbol references x86/boot/compressed: Get rid of GOT fixup code Arvind Sankar (4): x86/boot: Add .t

[PATCH v6 3/7] x86/boot/compressed: Get rid of GOT fixup code

2020-07-31 Thread Arvind Sankar
. While at it, drop the KEEP() from the linker script, as it has no effect on the contents of output sections that are created by the linker itself. Tested-by: Nick Desaulniers Tested-by: Sedat Dilek Reviewed-by: Kees Cook Signed-off-by: Ard Biesheuvel Acked-by: Arvind Sankar Signed-off

[PATCH v6 4/7] x86/boot: Add .text.* to setup.ld

2020-07-31 Thread Arvind Sankar
erlaps with .entrytext >>> .bsdata range is [0x1FF, 0x398] >>> .entrytext range is [0x26C, 0x2D3] Add .text.* to the .text output section to fix this, and also prevent any future surprises if the compiler decides to create other such sections. [1] https://reviews.llvm.org/

[PATCH v6 5/7] x86/boot: Remove run-time relocations from .head.text code

2020-07-31 Thread Arvind Sankar
_32 is in the same section as the code. Move efi32_pe_entry into .head.text so that it can use the same method to avoid relocations. Tested-by: Nick Desaulniers Tested-by: Sedat Dilek Reviewed-by: Kees Cook Reviewed-by: Ard Biesheuvel Reviewed-by: Fangrui Song Signed-off-by: Arvind Sankar --- arch/

[PATCH v6 2/7] x86/boot/compressed: Force hidden visibility for all symbol references

2020-07-31 Thread Arvind Sankar
-by: Arvind Sankar Signed-off-by: Arvind Sankar From: Ard Biesheuvel Link: https://lore.kernel.org/r/20200523120021.34996-3-a...@kernel.org --- arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/vmlinux.lds.S | 1 + drivers/firmware/efi/libstub/Makefile | 2 +- drivers

[PATCH v6 7/7] x86/boot: Check that there are no run-time relocations

2020-07-31 Thread Arvind Sankar
versions (as well as clang and lld). Tested-by: Nick Desaulniers Tested-by: Sedat Dilek Reviewed-by: Kees Cook Reviewed-by: Ard Biesheuvel Reviewed-by: Fangrui Song Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/Makefile | 28 +++--- arch/x86/boot/compressed

[PATCH v6 6/7] x86/boot: Remove run-time relocations from head_{32,64}.S

2020-07-31 Thread Arvind Sankar
Cook Reviewed-by: Ard Biesheuvel Reviewed-by: Fangrui Song Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/Makefile | 12 ++-- arch/x86/boot/compressed/head_32.S | 17 - arch/x86/boot/compressed/head_64.S | 4 ++-- arch/x86/boot/compressed/mkpiggy.c | 6

[PATCH v6 1/7] x86/boot/compressed: Move .got.plt entries out of the .got section

2020-07-31 Thread Arvind Sankar
Desaulniers Tested-by: Sedat Dilek Reviewed-by: Kees Cook Signed-off-by: Ard Biesheuvel Acked-by: Arvind Sankar Signed-off-by: Arvind Sankar From: Ard Biesheuvel Link: https://lore.kernel.org/r/20200523120021.34996-2-a...@kernel.org --- arch/x86/boot/compressed/vmlinux.lds.S | 11

Re: [PATCH v5 32/36] x86/boot/compressed: Reorganize zero-size section asserts

2020-07-31 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 04:08:16PM -0700, Kees Cook wrote: > For readability, move the zero-sized sections to the end after DISCARDS > and mark them NOLOAD for good measure. > > Signed-off-by: Kees Cook > --- > arch/x86/boot/compressed/vmlinux.lds.S | 42 +++--- > 1 file

Re: [PATCH v5 29/36] x86/build: Enforce an empty .got.plt section

2020-07-31 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 04:08:13PM -0700, Kees Cook wrote: > The .got.plt section should always be zero (or filled only with the > linker-generated lazy dispatch entry). Enforce this with an assert and > mark the section as NOLOAD. This is more sensitive than just blindly > discarding the section.

Re: [PATCH v5 32/36] x86/boot/compressed: Reorganize zero-size section asserts

2020-07-31 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 09:47:55PM -0400, Arvind Sankar wrote: > On Fri, Jul 31, 2020 at 04:08:16PM -0700, Kees Cook wrote: > > For readability, move the zero-sized sections to the end after DISCARDS > > and mark them NOLOAD for good measure. > > > > Signed-off-by: K

Re: [PATCH v5 13/36] vmlinux.lds.h: add PGO and AutoFDO input sections

2020-07-31 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 04:07:57PM -0700, Kees Cook wrote: > From: Nick Desaulniers > > Basically, consider .text.{hot|unlikely|unknown}.* part of .text, too. > > When compiling with profiling information (collected via PGO > instrumentations or AutoFDO sampling), Clang will separate code into

Re: [PATCH v5 32/36] x86/boot/compressed: Reorganize zero-size section asserts

2020-08-01 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 10:35:14PM -0700, Kees Cook wrote: > On Fri, Jul 31, 2020 at 09:47:55PM -0400, Arvind Sankar wrote: > > On Fri, Jul 31, 2020 at 04:08:16PM -0700, Kees Cook wrote: > > > For readability, move the zero-sized sections to the end after DISCARDS > >

Re: [PATCH v5 32/36] x86/boot/compressed: Reorganize zero-size section asserts

2020-08-01 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 10:36:00PM -0700, Kees Cook wrote: > On Fri, Jul 31, 2020 at 10:53:25PM -0400, Arvind Sankar wrote: > > On Fri, Jul 31, 2020 at 09:47:55PM -0400, Arvind Sankar wrote: > > > On Fri, Jul 31, 2020 at 04:08:16PM -0700, Kees Cook wrote: > > > >

Re: [PATCH v5 13/36] vmlinux.lds.h: add PGO and AutoFDO input sections

2020-08-01 Thread Arvind Sankar
On Fri, Jul 31, 2020 at 11:18:02PM -0700, Kees Cook wrote: > On Fri, Jul 31, 2020 at 11:51:28PM -0400, Arvind Sankar wrote: > > > > This also changes the ordering to place all hot resp unlikely sections > > separate > > from other text, while currently it places th

Re: [PATCH v6 08/22] bootconfig: init: Allow admin to use bootconfig for init command line

2020-08-01 Thread Arvind Sankar
On Fri, Feb 07, 2020 at 02:46:03PM -0500, Steven Rostedt wrote: > > diff --git a/init/main.c b/init/main.c > index 491f1cdb3105..113c8244e5f0 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -142,6 +142,15 @@ static char *extra_command_line; > /* Extra init arguments */ > static char

[PATCH 1/1] x86/kaslr: Replace strlen with strnlen

2020-08-02 Thread Arvind Sankar
strnlen is safer in case the command line is not NUL-terminated. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/kaslr.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 903ccdca0551

[PATCH 0/1] x86/kaslr: Replace strlen with strnlen

2020-08-02 Thread Arvind Sankar
Hi, I'd like to add one more patch to the series if that's ok. Thanks. Arvind Sankar (1): x86/kaslr: Replace strlen with strnlen arch/x86/boot/compressed/kaslr.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.26.2

Re: [PATCH v6 08/22] bootconfig: init: Allow admin to use bootconfig for init command line

2020-08-03 Thread Arvind Sankar
On Tue, Aug 04, 2020 at 12:03:45AM +0900, Masami Hiramatsu wrote: > On Sat, 1 Aug 2020 22:33:18 -0400 > Arvind Sankar wrote: > > > > I came across this as I was poking around some of the command line > > parsing. AFAICT, initargs_found will never be set to true here

Re: [PATCH v5 13/36] vmlinux.lds.h: add PGO and AutoFDO input sections

2020-08-03 Thread Arvind Sankar
On Mon, Aug 03, 2020 at 12:05:06PM -0700, Andi Kleen wrote: > > However, the history of their being together comes from > > > > 9bebe9e5b0f3 ("kbuild: Fix .text.unlikely placement") > > > > which seems to indicate there was some problem with having them separated > > out, > > although I don't

Re: [PATCH] lz4: Fix kernel decompression speed

2020-08-03 Thread Arvind Sankar
ecompressors. Thanks. >From 10f8d939fc367e3127e2d72ba099678debcae422 Mon Sep 17 00:00:00 2001 From: Arvind Sankar Date: Mon, 3 Aug 2020 17:07:37 -0400 Subject: [PATCH] x86/boot/compressed: Use builtin mem functions for decompressor Since commits c041b5ad8640 ("x86, boot: Create a sep

Re: [PATCH] lz4: Fix kernel decompression speed

2020-08-03 Thread Arvind Sankar
On Mon, Aug 03, 2020 at 10:55:01PM +, Nick Terrell wrote: > > > > On Aug 3, 2020, at 2:57 PM, Arvind Sankar wrote: > > > > On Mon, Aug 03, 2020 at 12:40:22PM -0700, Nick Terrell wrote: > >> From: Nick Terrell > >> > >> This patch replac

Re: [PATCH 0/4] -ffreestanding/-fno-builtin-* patches

2020-08-21 Thread Arvind Sankar
On Thu, Aug 20, 2020 at 04:33:03PM -0700, Linus Torvalds wrote: > On Thu, Aug 20, 2020 at 10:56 AM Arvind Sankar wrote: > > > > Clang's interpretation is more useful for embedded, since you can use > > -fno-builtin-foo and avoid calling __builtin_foo directly,

  1   2   3   4   5   6   7   >