public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-debuggers@vger.kernel.org
Subject: Incorrect vmcoreinfo KERNELOFFSET after "s390/boot: Rework deployment of the kernel image"
Date: Thu, 20 Jun 2024 16:34:15 -0700	[thread overview]
Message-ID: <ZnS8dycxhtXBZVky@telecaster.dhcp.thefacebook.com> (raw)

Hi, Alexander and Sven,

I just got around to testing drgn on s390x on 6.10-rc4, and it appears
to be broken. I bisected it to commit 56b1069c40c7 ("s390/boot: Rework
deployment of the kernel image") and narrowed it down to an issue with
the KERNELOFFSET value reported in vmcoreinfo.

On my test kernel, the ELF symbol for init_task is 0xc96f00:

  $ eu-readelf -s build/vmtest/s390x/kernel-6.10.0-rc4-vmtest30.1default/build/vmlinux | grep ' init_task$'
  72273: 0000000000c96f00   4352 OBJECT  GLOBAL DEFAULT       18 init_task

And the address in the loaded kernel is 0x3ffffeaaf00:

  # grep ' init_task$' /proc/kallsyms
  000003ffffeaaf00 D init_task

0x3ffffeaaf00 - 0xc96f00 is 0x3ffff214000

However, this doesn't match the value of KERNELOFFSET in vmcoreinfo:

  # eu-readelf -n /proc/kcore | grep KERNELOFFSET
    KERNELOFFSET=3ffff314000

It's off by 0x100000. This causes drgn to compute the wrong addresses
for all global variables.

For context, I'm testing using QEMU emulation on an x86-64 host. Note
that it logs "KASLR disabled: CPU has no PRNG" early during boot. My
exact setup is:

  $ git clone https://github.com/osandov/drgn.git
  $ cd drgn
  $ python3 -m vmtest.rootfsbuild -a s390x --build-drgn
  $ python3 -m vmtest.vm -k 's390x:6.10.*' bash -i
  # python3 -m drgn
  >>> prog['init_task'].comm
  (char [16])""

That should be printing "swapper/0".

Any ideas what's going on here?

Thanks!
Omar

             reply	other threads:[~2024-06-20 23:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 23:34 Omar Sandoval [this message]
2024-06-24 13:29 ` Incorrect vmcoreinfo KERNELOFFSET after "s390/boot: Rework deployment of the kernel image" Alexander Gordeev
2024-06-27 13:51 ` Alexander Gordeev
2024-07-09 19:21   ` Petr Tesařík
2024-07-09 20:55     ` Omar Sandoval
2024-07-10  5:02       ` Petr Tesařík
2024-07-10  8:56         ` Alexander Gordeev
2024-07-11 23:55         ` Omar Sandoval
2024-07-10  8:53     ` Alexander Gordeev
2024-07-11 23:30       ` Omar Sandoval
2024-07-12 13:42         ` Alexander Gordeev
2024-07-12 14:17           ` Omar Sandoval
2024-07-15 10:06             ` Alexander Gordeev
2024-08-26  8:22               ` Alexander Gordeev
2024-08-27 19:38                 ` Omar Sandoval

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=ZnS8dycxhtXBZVky@telecaster.dhcp.thefacebook.com \
    --to=osandov@osandov.com \
    --cc=agordeev@linux.ibm.com \
    --cc=linux-debuggers@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.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