public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: mjg59@srcf.ucam.org, bhe@redhat.com, greg@kroah.com,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Shaun Ruffell <sruffell@digium.com>,
	bp@alien8.de, ebiederm@xmission.com, akpm@linux-foundation.org,
	dyoung@redhat.com, chaowang@redhat.com
Subject: Re: [PATCH 11/15] purgatory: Core purgatory functionality
Date: Mon, 11 Aug 2014 16:23:35 -0400	[thread overview]
Message-ID: <20140811202335.GA30740@redhat.com> (raw)
In-Reply-To: <53E906B0.5040105@zytor.com>

On Mon, Aug 11, 2014 at 11:08:48AM -0700, H. Peter Anvin wrote:
> On 08/11/2014 11:02 AM, Vivek Goyal wrote:
> > 
> > Hi hpa,
> > 
> > I took it because kexec-tools uses it and in one of the committs Eric
> > gave following reasoning.
> > 
> >     On x86_64 use -mcmodel=large so that the code is built without
> >     any 32bit assumptions.  -mcmodel=medium and -mcmodel=small
> >     result int code that has 32bit relocations against variables
> >     that can live anywhere in the address space
> > 
> > We do want to load purgatory anywhere in the address space. 
> > 
> > But if there are other ways to achieve the same thing, I will do that
> > change.
> > 
> > So when you say "small PIC", I need to use -mcmodel=small and -fPIC?
> > 
> 
> Actually -fPIE is probably better than -fPIC.
> 
> -mcmodel=large is incompatible with all other code out there, which
> means that even though it is supposed to work it will be poorly tested
> at best.  So even despite the gcc version issue, using the small PIC
> model would be better.

Hi hpa,

I have not introduced a new config option for new system call. It compiles
under existing config option CONFIG_KEXEC and I think that's the reason
Shaun is running into this issue.

I passed -mcmodel=small and -fPIE for purgaotry build.

KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
-fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os
-mcmodel=small -fPIE

On the surface I see new reclocation types. 

000000000022  003000000004 R_X86_64_PLT32    00000000000000d8 sha256_init - 4
000000000034  003f00000004 R_X86_64_PLT32    000000000000011a sha256_update - 4
000000000049  004100000004 R_X86_64_PLT32    0000000000001d4d sha256_final - 4

Current code does not take care of these. I am hoping these can be
managed.

I also see undefined symbol.

    64: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_

And current purgatory relocation code does not expect any undefined
symbols and errors out. IIUC, undefined symbols expect to be resolved
externally by linking against somehing else. But in case of purgatory
this is suppoed to be stand alone and does not link against anything
else. So I am not sure how to take care of this.

I doubt that I can get this code working with -fPIE in short
amount of time (Given my lack of knowledge in this area). So while we
continue to explore it, will it make sense that I also work on a patch to
hide all the new functionality behind a new config option
(say CONFIG_KEXEC_FILE). That way existing users will not be impacted and
only users of the new syscall will be expected to have newer gcc with
-mcmodel=large.

And then I can continue to look into how to get rid of -mcmodel=large
requirement.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2014-08-11 20:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 20:33 [PATCH 00/15][V4] kexec: A new system call to allow in kernel loading Vivek Goyal
2014-06-26 20:33 ` [PATCH 01/15] bin2c: Move bin2c in scripts/basic Vivek Goyal
2014-06-26 20:33 ` [PATCH 02/15] kernel: Build bin2c based on config option CONFIG_BUILD_BIN2C Vivek Goyal
2014-06-26 20:33 ` [PATCH 03/15] kexec: rename unusebale_pages to unusable_pages Vivek Goyal
2014-06-26 20:33 ` [PATCH 04/15] kexec: Move segment verification code in a separate function Vivek Goyal
2014-06-26 20:33 ` [PATCH 05/15] kexec: Use common function for kimage_normal_alloc() and kimage_crash_alloc() Vivek Goyal
2014-06-26 20:33 ` [PATCH 06/15] resource: Provide new functions to walk through resources Vivek Goyal
2014-06-26 20:33 ` [PATCH 07/15] kexec: Make kexec_segment user buffer pointer a union Vivek Goyal
2014-06-26 20:33 ` [PATCH 08/15] kexec: New syscall kexec_file_load() declaration Vivek Goyal
2014-06-26 20:43   ` Vivek Goyal
2014-06-26 21:03     ` Andy Lutomirski
2014-06-27 11:50       ` Vivek Goyal
2014-06-27 12:20         ` Michael Kerrisk (man-pages)
2014-06-26 20:33 ` [PATCH 09/15] kexec: Implementation of new syscall kexec_file_load Vivek Goyal
2014-06-26 20:58   ` Andrew Morton
2014-06-27 16:31     ` Vivek Goyal
2014-07-01 20:25       ` Vivek Goyal
2014-06-26 20:33 ` [PATCH 10/15] purgatory/sha256: Provide implementation of sha256 in purgaotory context Vivek Goyal
2014-06-26 20:33 ` [PATCH 11/15] purgatory: Core purgatory functionality Vivek Goyal
2014-08-11 17:40   ` Shaun Ruffell
2014-08-11 17:51     ` H. Peter Anvin
2014-08-11 18:02       ` Vivek Goyal
2014-08-11 18:08         ` H. Peter Anvin
2014-08-11 18:15           ` Vivek Goyal
2014-08-11 20:23           ` Vivek Goyal [this message]
2014-06-26 20:33 ` [PATCH 12/15] kexec: Load and Relocate purgatory at kernel load time Vivek Goyal
2014-06-26 20:33 ` [PATCH 13/15] kexec-bzImage64: Support for loading bzImage using 64bit entry Vivek Goyal
2014-06-26 20:33 ` [PATCH 14/15] kexec: Support for kexec on panic using new system call Vivek Goyal
2014-06-26 20:33 ` [PATCH 15/15] kexec: Support kexec/kdump on EFI systems Vivek Goyal
2014-07-01 19:46   ` Matt Fleming
2014-07-01 20:14     ` Andrew Morton
2014-07-01 20:21       ` Vivek Goyal
2014-07-01 21:23       ` Matt Fleming
2014-07-01 20:09   ` [PATCH 17/15] kexec-bzimage: Change EFI helper function names Vivek Goyal
2014-06-26 20:39 ` [PATCH 00/15][V4] kexec: A new system call to allow in kernel loading Vivek Goyal
2014-06-26 20:58 ` Andrew Morton
2014-06-26 21:21   ` Borislav Petkov
2014-06-27 11:33   ` Vivek Goyal
2014-06-27 16:34 ` [PATCH 16/15] kexec: Fix freeing up for image loader data loading Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140811202335.GA30740@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=chaowang@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=sruffell@digium.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox