Re: [PATCH v2 0/4] s390: compile relocatable kernel with/without fPIE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 21, 2024 at 12:59:21PM -0400, Joe Lawrence wrote:
> On 6/19/24 14:23, Joe Lawrence wrote:
> > On 6/19/24 13:01, Sumanth Korikkar wrote:
> >> Other Note:
> >> The latest kernel is built with -fPIC and linked with -no-pie (reference
> >> commit: ca888b17da9b ("s390: Compile kernel with -fPIC and link with
> >> -no-pie")) which also avoids generation of dynamic symbols and helps
> >> kpatch usecases (when num of sections >=64k sections).  Also the build
> >> options would be similar (-fPIC in kernel and -fPIC in kpatch-build)
> >>
> >> For latest kernel, there is no need to add explicit -fPIC again
> >> in kpatch tool.
> >>
> >> But for the intermediate commits, yes, makes sense to add
> >> it in kpatch-build tools and will create one PR.
> >>
> > 
> > Interesting!  With 00cda11d3b2e ("s390: Compile kernel with -fPIC and
> > link with -no-pie") it sounds like the original vmlinux would be built
> > with -fPIC as well, so the optimization decisions re: __mmput() would
> > likely be the same.  I can retry the tests with v6.10-rcX to verify.
> > 
> 
> To follow up, all of the kpatch-build integration tests work with
> v6.10.0-rc4 :) as the kernel is built with -fPIC and so are the kpatch
> reference and patched builds.  For pre-v6.10 kernels, I think there may
> be some instances where a patch author may need to account for slight
> build differences to appease kpatch-build expectations as I noticed here.
> 
> -- 
> Joe
>
Hi Joe,

I tried bisecting provided rhel config with defconfig, but didnt
succeed yet.

However, I tried using KCFLAGS="-fPIE -mno-pic-data-is-text-relative"
instead of KCFLAGS="-fPIC -mno-pic-data-is-text-relative" and it
generated similar output.

* objdump -Dr -j.text --disassemble=mmput kernel/fork.o

Disassembly of section .text:

00000000000011d0 <mmput>:
    11d0:       c0 04 00 00 00 00       jgnop   11d0 <mmput>
    11d6:       a7 18 ff ff             lhi     %r1,-1
    11da:       eb 01 21 3c 00 f8       laa     %r0,%r1,316(%r2)
    11e0:       07 e0                   bnor    %r0
    11e2:       ec 08 00 06 01 7e       cije    %r0,1,11ee <mmput+0x1e>
    11e8:       c0 f4 00 00 00 00       jg      11e8 <mmput+0x18>
                        11ea: R_390_PC32DBL     __s390_indirect_jump_r14+0x2
    11ee:       c0 f4 00 00 00 00       jg      11ee <mmput+0x1e>
                        11f0: R_390_PLT32DBL    __mmput+0x2

* KCFLAGS="-fPIE -mno-pic-data-is-text-relative -fno-section-anchors" \ 
  make -s -j$(nproc) kernel/fork.o ; 
  objdump -Dr -j.text --disassemble=mmput kernel/fork.o

kernel/fork.o:     file format elf64-s390


Disassembly of section .text:

0000000000001230 <mmput>:
    1230:       c0 04 00 00 00 00       jgnop   1230 <mmput>
    1236:       a7 18 ff ff             lhi     %r1,-1
    123a:       eb 01 21 3c 00 f8       laa     %r0,%r1,316(%r2)
    1240:       07 e0                   bnor    %r0
    1242:       ec 08 00 06 01 7e       cije    %r0,1,124e <mmput+0x1e>
    1248:       c0 f4 00 00 00 00       jg      1248 <mmput+0x18>
                        124a: R_390_PC32DBL     __s390_indirect_jump_r14+0x2
    124e:       c0 f4 00 00 00 00       jg      124e <mmput+0x1e>
                        1250: R_390_PLT32DBL    __mmput+0x2

* For commit 778666df60f0 ("s390: compile relocatable kernel without -fPIE"),
  "-fPIE -mno-pic-data-is-text-relative" could be used to prevent
  confusion to the kpatch tool. I will make changes in the kpatch pull request.
* For latest kernel, both vmlinux and kpatch-build uses -fPIC and
  hence no changes are necessary in kpatch tool.

Thank you,
Sumanth




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux