Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504236 > unrolled thread

[PATCH 4.4 0/2] 4.4.26-stable review

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-10-19 20:40 +0200
Last post2016-10-20 03:50 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 4.4 0/2] 4.4.26-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-19 20:40 +0200
    [PATCH 4.4 1/2] x86/build: Build compressed x86 kernels as PIE Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-19 20:40 +0200
    Re: [PATCH 4.4 0/2] 4.4.26-stable review Paul Bolle <pebolle@tiscali.nl> - 2016-10-19 21:00 +0200
      Re: [PATCH 4.4 0/2] 4.4.26-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-19 21:40 +0200
        Re: [PATCH 4.4 0/2] 4.4.26-stable review Paul Bolle <pebolle@tiscali.nl> - 2016-10-19 21:50 +0200
    Re: [PATCH 4.4 0/2] 4.4.26-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-10-20 00:30 +0200
    Re: [PATCH 4.4 0/2] 4.4.26-stable review Guenter Roeck <linux@roeck-us.net> - 2016-10-20 03:50 +0200

#1504236 — [PATCH 4.4 0/2] 4.4.26-stable review

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-10-19 20:40 +0200
Subject[PATCH 4.4 0/2] 4.4.26-stable review
Message-ID<su3Wq-53C-31@gated-at.bofh.it>
This is the start of the stable review cycle for the 4.4.26 release.
There are 2 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Fri Oct 21 18:27:53 UTC 2016.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.26-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.4.26-rc1

Linus Torvalds <torvalds@linux-foundation.org>
    mm: remove gup_flags FOLL_WRITE games from __get_user_pages()

H.J. Lu <hjl.tools@gmail.com>
    x86/build: Build compressed x86 kernels as PIE


-------------

Diffstat:

 Makefile                           |  4 ++--
 arch/x86/boot/compressed/Makefile  | 14 +++++++++++++-
 arch/x86/boot/compressed/head_32.S | 28 ++++++++++++++++++++++++++++
 arch/x86/boot/compressed/head_64.S |  8 ++++++++
 include/linux/mm.h                 |  1 +
 mm/gup.c                           | 14 ++++++++++++--
 6 files changed, 64 insertions(+), 5 deletions(-)

[toc] | [next] | [standalone]


#1504248 — [PATCH 4.4 1/2] x86/build: Build compressed x86 kernels as PIE

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-10-19 20:40 +0200
Subject[PATCH 4.4 1/2] x86/build: Build compressed x86 kernels as PIE
Message-ID<su3Wq-53C-63@gated-at.bofh.it>
In reply to#1504236
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: H.J. Lu <hjl.tools@gmail.com>

commit 6d92bc9d483aa1751755a66fee8fb39dffb088c0 upstream.

The 32-bit x86 assembler in binutils 2.26 will generate R_386_GOT32X
relocation to get the symbol address in PIC.  When the compressed x86
kernel isn't built as PIC, the linker optimizes R_386_GOT32X relocations
to their fixed symbol addresses.  However, when the compressed x86
kernel is loaded at a different address, it leads to the following
load failure:

  Failed to allocate space for phdrs

during the decompression stage.

If the compressed x86 kernel is relocatable at run-time, it should be
compiled with -fPIE, instead of -fPIC, if possible and should be built as
Position Independent Executable (PIE) so that linker won't optimize
R_386_GOT32X relocation to its fixed symbol address.

Older linkers generate R_386_32 relocations against locally defined
symbols, _bss, _ebss, _got and _egot, in PIE.  It isn't wrong, just less
optimal than R_386_RELATIVE.  But the x86 kernel fails to properly handle
R_386_32 relocations when relocating the kernel.  To generate
R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as
hidden in both 32-bit and 64-bit x86 kernels.

To build a 64-bit compressed x86 kernel as PIE, we need to disable the
relocation overflow check to avoid relocation overflow errors. We do
this with a new linker command-line option, -z noreloc-overflow, which
got added recently:

 commit 4c10bbaa0912742322f10d9d5bb630ba4e15dfa7
 Author: H.J. Lu <hjl.tools@gmail.com>
 Date:   Tue Mar 15 11:07:06 2016 -0700

    Add -z noreloc-overflow option to x86-64 ld

    Add -z noreloc-overflow command-line option to the x86-64 ELF linker to
    disable relocation overflow check.  This can be used to avoid relocation
    overflow check if there will be no dynamic relocation overflow at
    run-time.

The 64-bit compressed x86 kernel is built as PIE only if the linker supports
-z noreloc-overflow.  So far 64-bit relocatable compressed x86 kernel
boots fine even when it is built as a normal executable.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
[ Edited the changelog and comments. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/boot/compressed/Makefile  |   14 +++++++++++++-
 arch/x86/boot/compressed/head_32.S |   28 ++++++++++++++++++++++++++++
 arch/x86/boot/compressed/head_64.S |    8 ++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)

--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -22,7 +22,7 @@ targets := vmlinux vmlinux.bin vmlinux.b
 	vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
 
 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
-KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
+KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 cflags-$(CONFIG_X86_32) := -march=i386
 cflags-$(CONFIG_X86_64) := -mcmodel=small
@@ -35,6 +35,18 @@ KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__A
 GCOV_PROFILE := n
 
 LDFLAGS := -m elf_$(UTS_MACHINE)
+ifeq ($(CONFIG_RELOCATABLE),y)
+# If kernel is relocatable, build compressed kernel as PIE.
+ifeq ($(CONFIG_X86_32),y)
+LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
+else
+# To build 64-bit compressed kernel as PIE, we disable relocation
+# overflow check to avoid relocation overflow error with a new linker
+# command-line option, -z noreloc-overflow.
+LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
+	&& echo "-z noreloc-overflow -pie --no-dynamic-linker")
+endif
+endif
 LDFLAGS_vmlinux := -T
 
 hostprogs-y	:= mkpiggy
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -31,6 +31,34 @@
 #include <asm/asm-offsets.h>
 #include <asm/bootparam.h>
 
+/*
+ * The 32-bit x86 assembler in binutils 2.26 will generate R_386_GOT32X
+ * relocation to get the symbol address in PIC.  When the compressed x86
+ * kernel isn't built as PIC, the linker optimizes R_386_GOT32X
+ * relocations to their fixed symbol addresses.  However, when the
+ * compressed x86 kernel is loaded at a different address, it leads
+ * to the following load failure:
+ *
+ *   Failed to allocate space for phdrs
+ *
+ * during the decompression stage.
+ *
+ * If the compressed x86 kernel is relocatable at run-time, it should be
+ * compiled with -fPIE, instead of -fPIC, if possible and should be built as
+ * Position Independent Executable (PIE) so that linker won't optimize
+ * R_386_GOT32X relocation to its fixed symbol address.  Older
+ * linkers generate R_386_32 relocations against locally defined symbols,
+ * _bss, _ebss, _got and _egot, in PIE.  It isn't wrong, just less
+ * optimal than R_386_RELATIVE.  But the x86 kernel fails to properly handle
+ * R_386_32 relocations when relocating the kernel.  To generate
+ * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as
+ * hidden:
+ */
+	.hidden _bss
+	.hidden _ebss
+	.hidden _got
+	.hidden _egot
+
 	__HEAD
 ENTRY(startup_32)
 #ifdef CONFIG_EFI_STUB
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -33,6 +33,14 @@
 #include <asm/asm-offsets.h>
 #include <asm/bootparam.h>
 
+/*
+ * Locally defined symbols should be marked hidden:
+ */
+	.hidden _bss
+	.hidden _ebss
+	.hidden _got
+	.hidden _egot
+
 	__HEAD
 	.code32
 ENTRY(startup_32)

[toc] | [prev] | [next] | [standalone]


#1504258

FromPaul Bolle <pebolle@tiscali.nl>
Date2016-10-19 21:00 +0200
Message-ID<su4fL-5aV-17@gated-at.bofh.it>
In reply to#1504236
On Wed, 2016-10-19 at 20:30 +0200, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.26 release.
> There are 2 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

Did I botch my attempt at a backport of "lightnvm: ensure that
nvm_dev_ops can be used without CONFIG_NVM" to v4.4.y (see
https://lkml.kernel.org/r/<1476477349-28155-1-git-send-email-pebolle@ti
scali.nl> ) sufficiently for it to be dropped?

Thanks,


Paul Bolle

[toc] | [prev] | [next] | [standalone]


#1504293

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-10-19 21:40 +0200
Message-ID<su4Su-5Dz-49@gated-at.bofh.it>
In reply to#1504258
On Wed, Oct 19, 2016 at 08:52:55PM +0200, Paul Bolle wrote:
> On Wed, 2016-10-19 at 20:30 +0200, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.26 release.
> > There are 2 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> 
> Did I botch my attempt at a backport of "lightnvm: ensure that
> nvm_dev_ops can be used without CONFIG_NVM" to v4.4.y (see
> https://lkml.kernel.org/r/<1476477349-28155-1-git-send-email-pebolle@ti
> scali.nl> ) sufficiently for it to be dropped?

It's in good company, sitting along with 250+ other patches I have yet
to work through to apply to the stable kernels.  For various reasons I
needed to get a round of stable kernels out sooner, which is why it
isn't in there.  Don't worry, it's not lost, it will get handled
eventually...

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1504297

FromPaul Bolle <pebolle@tiscali.nl>
Date2016-10-19 21:50 +0200
Message-ID<su529-5H7-7@gated-at.bofh.it>
In reply to#1504293
On Wed, 2016-10-19 at 21:34 +0200, Greg Kroah-Hartman wrote:
> It's in good company, sitting along with 250+ other patches I have yet
> to work through to apply to the stable kernels.  For various reasons I
> needed to get a round of stable kernels out sooner, which is why it
> isn't in there.  Don't worry, it's not lost, it will get handled
> eventually...

Great. I'll be patient from now on. Sorry for the noise.


Paul Bolle

[toc] | [prev] | [next] | [standalone]


#1504368

FromShuah Khan <shuah.kh@samsung.com>
Date2016-10-20 00:30 +0200
Message-ID<su7wZ-7rI-13@gated-at.bofh.it>
In reply to#1504236
On 10/19/2016 12:30 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.26 release.
> There are 2 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri Oct 21 18:27:53 UTC 2016.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.26-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com

[toc] | [prev] | [next] | [standalone]


#1504452

FromGuenter Roeck <linux@roeck-us.net>
Date2016-10-20 03:50 +0200
Message-ID<suaEy-Sb-3@gated-at.bofh.it>
In reply to#1504236
On 10/19/2016 11:30 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.26 release.
> There are 2 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Oct 21 18:27:53 UTC 2016.
> Anything received after that time might be too late.
>
Build results:
	total: 149 pass: 149 fail: 0
Qemu test results:
	total: 103 pass: 103 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web