Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests] realmode: load above stack
Date: Tue, 4 Jun 2024 16:40:20 +0200	[thread overview]
Message-ID: <49f8aadf-6e3f-4d2b-a32a-8ba941a3a2a1@redhat.com> (raw)
In-Reply-To: <20240604143507.1041901-1-pbonzini@redhat.com>

On 04/06/2024 16.35, Paolo Bonzini wrote:
> The bottom 32K of memory are generally reserved for use by the BIOS;
> for example, traditionally the boot loader is placed at 0x7C00 and
> the stack grows below that address.
> 
> It turns out that with some versions of clang, realmode.flat has
> become big enough that it overlaps the stack used by the multiboot
> option ROM loader.  The result is that a couple instructions are
> overwritten.  Typically one or two tests fail and that's it...
> 
> Move the code above the forbidden region, in real 90s style.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   x86/realmode.lds | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/realmode.lds b/x86/realmode.lds
> index 0ed3063b..e4782a98 100644
> --- a/x86/realmode.lds
> +++ b/x86/realmode.lds
> @@ -1,6 +1,6 @@
>   SECTIONS
>   {
> -    . = 16K;
> +    . = 32K;
>       stext = .;
>       .text : { *(.init) *(.text) }
>       . = ALIGN(4K);

This fails for me with:

ld -m elf_i386 -nostdlib -o x86/realmode.elf \
       -T /home/thuth/devel/kvm-unit-tests/x86/realmode.lds x86/realmode.o
x86/realmode.o: in function `init_inregs':
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0x79): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0x82): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0x8b): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0x94): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0x9d): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0xa6): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0xaf): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0xb8): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0xc1): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:176:(.text+0xca): relocation 
truncated to fit: R_386_16 against `.bss'
/home/thuth/devel/kvm-unit-tests/x86/realmode.c:180:(.text+0xda): additional 
relocation overflows omitted from the output
make: *** [/home/thuth/devel/kvm-unit-tests/x86/Makefile.common:107: 
x86/realmode.elf] Error 1

  Thomas


  reply	other threads:[~2024-06-04 14:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 14:35 [PATCH kvm-unit-tests] realmode: load above stack Paolo Bonzini
2024-06-04 14:40 ` Thomas Huth [this message]
2024-06-04 14:50   ` Paolo Bonzini
2026-05-04  7:58 ` Thomas Huth
2026-05-04  8:07   ` intel_iommu unit test is also failing (was: Re: [PATCH kvm-unit-tests] realmode: load above stack) Thomas Huth
2026-05-04 15:45     ` Peter Xu
2026-05-05  5:49       ` Clément MATHIEU--DRIF
2026-05-05  6:37         ` Clément MATHIEU--DRIF
2026-05-05  7:36           ` Clément MATHIEU--DRIF
2026-05-05  9:27             ` Clément MATHIEU--DRIF
2026-05-05  9:45               ` intel_iommu unit test is also failing Thomas Huth
2026-05-05  9:53                 ` Clément MATHIEU--DRIF
2026-05-05 10:15                   ` Thomas Huth
2026-05-05 10:23                 ` Michael S. Tsirkin
2026-05-05 10:34                   ` Thomas Huth
2026-05-05 10:53                     ` Michael S. Tsirkin
2026-05-05 11:38                       ` Thomas Huth
2026-05-05 12:33                         ` Michael S. Tsirkin
2026-05-05 17:08                           ` Thomas Huth
2026-05-05 11:39                       ` Clément MATHIEU--DRIF

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=49f8aadf-6e3f-4d2b-a32a-8ba941a3a2a1@redhat.com \
    --to=thuth@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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