Re: [Git pull] arch/x86 updates

From: Ingo Molnar
Date: Fri Oct 19 2007 - 19:15:32 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Fri, 19 Oct 2007, Thomas Gleixner wrote:
> >
> > Pavel Emelyanov (1):
> > i386: consolidate show_regs and show_registers for i386
>
> While I think this is good otherwise, why does it do
>
> printk(".. comm: %.*s .."
> TASK_COMM_LEN, current->comm,
>
> instead of just using "%s" and "current->comm"? I only noticed because
> there was an unrelated conflict around that thing.
>
> That "current->comm" had better be NUL-terminated already, we use it
> as such all over the place. And if it's not, *that* should be fixed.
>
> I'm editing it back to the simpler pure string.

it might make some marginal sense to get an oops message out when
there's stack overflow/corruption that damages task->comm. I've seen a
good number of traces that printed out task->comm as an overlength
string - which obscured other, possibly more important info that could
have been printed until the system became so hosed that it would not
print anything.

but ... this is really splitting hairs and even when the stack and hence
the task struct is corrupted, an accidental NIL character is almost
always a certainty. I remember only a single case in the past ~10 years
where an oops would print a "never ending" p->comm because the
corruption was a runaway memset to a non-0 value.

so printing it as %s should be perfectly fine too, for all practical
purposes. (and printing it _without_ the TASK_COMM_LEN complication
might help get out information faster in some other crash situations -
so the argument can be made in the opposite direction too.)

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/