mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	"David S. Miller" <davem@davemloft.net>,
	Nagarathnam Muthusamy <nagarathnam.muthusamy@oracle.com>,
	Nick Alcock <nick.alcock@oracle.com>,
	John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH v2 08/13] sparc64: vdso: Switch to the generic vDSO library
Date: Mon, 1 Sep 2025 21:05:23 +0200	[thread overview]
Message-ID: <3be01877-cfcb-43e2-811d-e8751338dc9c@gaisler.com> (raw)
In-Reply-To: <20250901164203-efc4e1ca-d83c-4776-bc20-13e1088ac548@linutronix.de>

On 2025-09-01 16:59, Thomas Weißschuh wrote:
> So a NULL-pointer deref. Please also try the following, to get the trapping code.
> 
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1299,6 +1299,14 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t,
>         struct k_sigaction *action;
>         int sig = info->si_signo;
>  
> +       if (unlikely(is_global_init(t)) && sig == SIGSEGV) {
> +               struct pt_regs *regs = task_pt_regs(t);
> +
> +               panic("killing init, sig=%d errno=%d code=%d addr=%px vdso=%px pc=0x%lx vdsopc=0x%lx",
> +                     info->si_signo, info->si_errno, info->si_code, info->si_addr,
> +                     t->mm->context.vdso, regs->tpc, regs->tpc - (unsigned long)t->mm->context.vdso);
> +       }
> +
>         spin_lock_irqsave(&t->sighand->siglock, flags);
>         action = &t->sighand->action[sig-1];
>         ignored = action->sa.sa_handler == SIG_IGN;
> 
> 
> Please give me the disassembly for the address printed as "vdsopc" from
> arch/sparc/vdso/vdso64.so.dbg starting from its function entrypoint.

I get

[    1.680341] Run /init as init process
[    1.682256] Kernel panic - not syncing: killing init, sig=11 errno=0 code=1 addr=0000000000000000 vdso=fff800010081e000 pc=0xfff800010081e684 vdsopc=0x684
[    1.682289] CPU: 2 UID: 0 PID: 1 Comm: init Not tainted 6.17.0-rc1-00011-g1f71a73bede3 #12 VOLUNTARY
[    1.682313] Call Trace:
[    1.682324] [<0000000000436524>] dump_stack+0x8/0x18
[    1.682351] [<00000000004291f4>] vpanic+0xdc/0x320
[    1.682373] [<000000000042945c>] panic+0x24/0x30
[    1.682389] [<0000000000493258>] force_sig_info_to_task+0x218/0x240
[    1.682412] [<0000000000493740>] force_sig_fault+0x40/0x60
[    1.682430] [<0000000000439e28>] sun4v_data_access_exception+0xa8/0x140
[    1.682449] [<00000000004066d4>] sun4v_dacc+0x28/0x34
[    1.683232] Press Stop-A (L1-A) from sun keyboard or send break
[    1.683232] twice on console to return to the boot prom
[    1.683252] ---[ end Kernel panic - not syncing: killing init, sig=11 errno=0 code=1 addr=0000000000000000 vdso=fff800010081e000 pc=0xfff800010081e684 vdsopc=0x684 ]---

and we have

#if defined(CONFIG_SPARC64)
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
{
 640:   9d e3 bf 50     save  %sp, -176, %sp
        __asm__ __volatile__(
 644:   40 00 00 03     call  650 <__vdso_clock_gettime+0x10>
 648:   01 00 00 00     nop 
 64c:   ff ff 79 b4     unknown
 650:   9e 03 e0 08     add  %o7, 8, %o7
 654:   c6 43 c0 00     ldsw  [ %o7 ], %g3
 658:   86 00 c0 0f     add  %g3, %o7, %g3
        if (!vdso_clockid_valid(clock))
 65c:   80 a6 20 17     cmp  %i0, 0x17
 660:   18 40 00 3b     bgu,pn   %icc, 74c <__vdso_clock_gettime+0x10c>
 664:   84 10 00 03     mov  %g3, %g2
        msk = 1U << clock;
 668:   82 10 20 01     mov  1, %g1
 66c:   83 28 40 18     sll  %g1, %i0, %g1
        if (likely(msk & VDSO_HRES))
 670:   80 88 68 83     btst  0x883, %g1
 674:   02 40 00 30     be,pn   %icc, 734 <__vdso_clock_gettime+0xf4>
 678:   80 88 60 60     btst  0x60, %g1
        if (!__arch_vdso_hres_capable())
 67c:   87 2e 30 04     sllx  %i0, 4, %g3
 680:   86 00 80 03     add  %g2, %g3, %g3
                while (unlikely((seq = READ_ONCE(vc->seq)) & 1)) {
 684:   fa 00 80 00     ld  [ %g2 ], %i5                          <-- this one
 688:   80 8f 60 01     btst  1, %i5
 68c:   12 60 00 39     bne,pn   %xcc, 770 <__vdso_clock_gettime+0x130>
 690:   01 00 00 00     nop 
 ...

where the READ_ONCE that does the trapping load is the READ_ONCE(vc->seq)
in do_hres() in lib/vdso/gettimeofday.c. So we seem to  have a NULL vc.

With patches 1-8 applied on v6.17-rc1, addr2line gives us:

0x640: arch/sparc/vdso/vclock_gettime.c:34
0x644: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x648: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x64c: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x650: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x654: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x658: arch/sparc/include/asm/vdso/gettimeofday.h:150
0x65c: lib/vdso/gettimeofday.c:321 (discriminator 1)
0x660: lib/vdso/gettimeofday.c:321 (discriminator 1)
0x664: lib/vdso/gettimeofday.c:321 (discriminator 1)
0x668: lib/vdso/gettimeofday.c:328
0x66c: lib/vdso/gettimeofday.c:328
0x670: lib/vdso/gettimeofday.c:329 (discriminator 1)
0x674: lib/vdso/gettimeofday.c:329 (discriminator 1)
0x678: lib/vdso/gettimeofday.c:329 (discriminator 1)
0x67c: lib/vdso/gettimeofday.c:175
0x680: lib/vdso/gettimeofday.c:175
0x684: lib/vdso/gettimeofday.c:190 (discriminator 2)


Cheers,
Andreas

  reply	other threads:[~2025-09-01 19:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15 10:41 [PATCH v2 00/13] sparc64: vdso: Switch to " Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 01/13] vdso: Add struct __kernel_old_timeval forward declaration to gettime.h Thomas Weißschuh
2025-09-04 12:58   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-09-05 21:11   ` tip-bot2 for Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 02/13] sparc64: vdso: Link with -z noexecstack Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 03/13] sparc64: vdso: Remove obsolete "fake section table" reservation Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 04/13] sparc64: vdso: Replace code patching with runtime conditional Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 05/13] sparc64: vdso: Move hardware counter read into header Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 06/13] sparc64: vdso: Move syscall fallbacks " Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 07/13] sparc64: vdso: Introduce vdso/processor.h Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 08/13] sparc64: vdso: Switch to the generic vDSO library Thomas Weißschuh
2025-08-25 15:55   ` Andreas Larsson
2025-08-26  5:56     ` Thomas Weißschuh
2025-08-28 15:38       ` Andreas Larsson
2025-08-29 10:02         ` Andreas Larsson
2025-08-29 10:37           ` Thomas Weißschuh
2025-08-29 10:40             ` John Paul Adrian Glaubitz
2025-08-29 10:52               ` Thomas Weißschuh
2025-08-29 15:24                 ` John Paul Adrian Glaubitz
2025-09-01 15:17                 ` Arnd Bergmann
2025-09-02  6:21                   ` Thomas Weißschuh
2025-08-29 13:41             ` Andreas Larsson
2025-08-29 13:51               ` Thomas Weißschuh
2025-08-29 14:05               ` Thomas Weißschuh
2025-08-29 16:35                 ` Andreas Larsson
2025-08-29 17:07                   ` Thomas Weißschuh
2025-09-01 14:28                     ` Andreas Larsson
2025-09-01 14:59                       ` Thomas Weißschuh
2025-09-01 19:05                         ` Andreas Larsson [this message]
2025-08-29 15:44               ` John Paul Adrian Glaubitz
2025-08-15 10:41 ` [PATCH v2 09/13] sparc64: vdso2c: Drop sym_vvar_start handling Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 10/13] sparc64: vdso2c: Remove symbol handling Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 11/13] sparc64: vdso: Implement clock_gettime64() Thomas Weißschuh
2025-08-15 10:41 ` [PATCH v2 12/13] sparc64: vdso: Implement clock_getres() Thomas Weißschuh
2025-08-15 12:13   ` Arnd Bergmann
2025-08-15 12:34     ` Thomas Weißschuh
2025-08-15 20:09       ` Arnd Bergmann
2025-08-18  5:50         ` Thomas Weißschuh
2025-08-18  6:54           ` Arnd Bergmann
2025-08-18 13:00             ` Thomas Weißschuh
2025-08-18 13:17               ` Arnd Bergmann
2025-08-15 10:41 ` [PATCH v2 13/13] clocksource: remove ARCH_CLOCKSOURCE_DATA Thomas Weißschuh

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=3be01877-cfcb-43e2-811d-e8751338dc9c@gaisler.com \
    --to=andreas@gaisler.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=nagarathnam.muthusamy@oracle.com \
    --cc=nick.alcock@oracle.com \
    --cc=sboyd@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=vincenzo.frascino@arm.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

all inboxes | Powered by JetHome®