diff mbox

[v4,16/16] livepatch: In xen_nop test-case remove the .bss and .data sections

Message ID 1474043908-12101-17-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Sept. 16, 2016, 4:38 p.m. UTC
As they are not needed for the livepatch to work.

Also this allows us to properly test:
"livepatch: Disallow applying after an revert" as the livepatch
will now only have the minimalistic sections:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.gnu.build-i NOTE             0000000000000000  00000040
       0000000000000024  0000000000000000   A       0     0     4
  [ 2] .text             PROGBITS         0000000000000024  00000064
       0000000000000000  0000000000000000  AX       0     0     4
  [ 3] .livepatch.depend PROGBITS         0000000000000000  00000064
       0000000000000024  0000000000000000   A       0     0     1
  [ 4] .livepatch.funcs  PROGBITS         0000000000000000  000000a0
       0000000000000040  0000000000000000  WA       0     0     32
  [ 5] .note.GNU-stack   PROGBITS         0000000000000000  000000e0
       0000000000000000  0000000000000000   X       0     0     1
  [ 6] .comment          PROGBITS         0000000000000000  000000e0
       000000000000002d  0000000000000001  MS       0     0     1
  [ 7] .shstrtab         STRTAB           0000000000000000  0000010d
       0000000000000071  0000000000000000           0     0     1
  [ 8] .symtab           SYMTAB           0000000000000000  00000400
       00000000000000c0  0000000000000018           9     7     8
  [ 9] .strtab           STRTAB           0000000000000000  000004c0
       000000000000000f  0000000000000000           0     0     1

In which only .livepatch.funcs is write-able.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

v4: New submission
---
 xen/test/livepatch/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jan Beulich Sept. 19, 2016, 9:32 a.m. UTC | #1
>>> On 16.09.16 at 18:38, <konrad.wilk@oracle.com> wrote:
> As they are not needed for the livepatch to work.

I think this patch can be dropped when skipping zero-size sections,
as suggested earlier.

Jan
diff mbox

Patch

diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile
index d7a4735..41ad59d 100644
--- a/xen/test/livepatch/Makefile
+++ b/xen/test/livepatch/Makefile
@@ -104,6 +104,8 @@  xen_nop.o: config.h
 .PHONY: $(LIVEPATCH_NOP)
 $(LIVEPATCH_NOP): xen_nop.o note.o
 	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_NOP) $^
+	$(OBJCOPY) --remove-section=.bss --remove-section=.data $@
+	$(OBJCOPY) --strip-unneeded $@
 
 .PHONY: livepatch
 livepatch: $(LIVEPATCH) $(LIVEPATCH_BYE) $(LIVEPATCH_REPLACE) $(LIVEPATCH_NOP)