Project

General

Profile

Actions

Bug #14106

closed

bop_panic prints the wrong thing

Added by Robert Mustacchi 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

While debugging something I noticed that calls to bop_panic were not printing the right value. That is I had something that simplifies down to the equivalent of:

static const uint8_t sig[4] = { 'A', 'P', 'O', 'B' };

...

                 bop_panic("Bad APOB signature, found 0x%x 0x%x 0x%x 0x%x",
                    sig[0], sig[1], sig[2], sig[3]);

And I found that I had output that didn't match with the above and instead was getting stack addresses. A bop_printf of this showed the expected data. This made me immediately begin to suspect the varargs handling code, though the fact that bop_printf worked made this a dubious thing. After wrangling my head, the issue became somewhat clear:

 909 bop_panic(const char *fmt, ...)
 910 {
 911         va_list ap;
 912 
 913         va_start(ap, fmt);
 914         bop_printf(NULL, fmt, ap);
 915         va_end(ap);

We had gotten the varargs form and then passed to the normal printf, which went and got the var args again! We should be using vbop_printf not, bop_printf!

Actions #1

Updated by Robert Mustacchi 4 months ago

  • Gerrit CR set to 1724
Actions #2

Updated by Robert Mustacchi 4 months ago

  • Description updated (diff)
Actions #3

Updated by Robert Mustacchi 4 months ago

To test this, I saw that the prior panic messages I had now had the correct messages and no longer had stack data showing up.

Actions #4

Updated by Electric Monk 4 months ago

  • Status changed from New to Closed
  • % Done changed from 70 to 100

git commit 789b2662f9579fb14ec2572f1e8c904d9d8278b9

commit  789b2662f9579fb14ec2572f1e8c904d9d8278b9
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-09-28T23:22:20.000Z

    14106 bop_panic prints the wrong thing
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF