linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Vimal Agrawal <avimalin@gmail.com>
To: linux-um@lists.infradead.org, oberpar@linux.ibm.com
Subject: printk_caller_id() crashing with UML/GCOV
Date: Fri, 15 Sep 2023 12:57:19 +0530	[thread overview]
Message-ID: <CALkUMdTX89qpGKfTRHOpMgHhiLrMEEnWed9hhV5S5FeWj_k=tw@mail.gmail.com> (raw)

I got following GCOV configs enabled

CONFIG_GCOV_KERNEL=y
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
CONFIG_GCOV_PROFILE_ALL=y

and was trying to run UML (kernel version 6.1.44) and ended up in a
crash in printk_caller_id().

I tried to debug and it seems current_thread_info is returning NULL
and that is because it is not yet set up. It hit much before mm_init
or any thread_info could be created.

this print is actually coming from __gcov_init

void __gcov_init(struct gcov_info *info)

{

        static unsigned int gcov_version;


        mutex_lock(&gcov_lock);

        if (gcov_version == 0) {

                gcov_version = gcov_info_version(info);

                /*

                 * Printing gcc's version magic may prove useful for debugging

                 * incompatibility reports.

                 */

                 // Need to uncomment post fixing NC-124446

                 pr_info("version magic: 0x%x\n", gcov_version);
<<<<<<< this pr_info causing crash



$ gdb ./linux
(gdb) run mem=512M rootfstype=hostfs rw init=/bin/bash

Starting program:
/home/vimal.agrawal/Morane/git-openwrt/basesystem/NEMO/linux-kernel/linux
mem=512M rootfstype=hostfs rw init=/bin/bash

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".


Program received signal SIGSEGV, Segmentation fault.

0x00000000600f2de3 in printk_caller_id () at kernel/printk/printk.c:2033

2033 return in_task() ? task_pid_nr(current) :

(gdb) bt

#0  0x00000000600f2de3 in printk_caller_id () at kernel/printk/printk.c:2033

#1  vprintk_store (facility=0, level=<optimized out>, dev_info=0x0,

    fmt=0x6097ed2a "\001\066version magic: 0x%x\n",
args=0x7fffffffe188) at kernel/printk/printk.c:2143

#2  0x0000000000000000 in ?? ()

I am not sure if any of my .config is causing this. I don't think we
can use pr_info so early. I do see that this pr_info in __gcov_init
was added long back in 2019.

Thanks,
Vimal

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

                 reply	other threads:[~2023-09-15  7:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CALkUMdTX89qpGKfTRHOpMgHhiLrMEEnWed9hhV5S5FeWj_k=tw@mail.gmail.com' \
    --to=avimalin@gmail.com \
    --cc=linux-um@lists.infradead.org \
    --cc=oberpar@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).