Re: [GIT PULL] x86/kaslr for v3.14

From: Ingo Molnar
Date: Wed Jan 29 2014 - 03:12:10 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, Jan 28, 2014 at 11:48 AM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> > I really meant it when I said I build without debuginfo! :)
>
> Ok, but so what?
>
> As mentioned, nobody sane should build with DEBUG_INFO. But a normal
> vmlinux file has the symbol information even without it.

So, your mail sure read to me as a rant directed at me, so I thought
I'd defend myself or something :)

I now realize that the whole episode was caused by me calling the
vmlinux 'symbol-less':

> > > > AFAICS this won't work in a symbol-less vmlinux. Is there some
> > > > trick to do it with gdb?

while I should have said 'debuginfo-less'. Mea culpa.

> > So, when I build a kernel, such as with a regular 'make defconfig',
> > the following happens in gdb:
> >
> > Reading symbols from /home/mingo/tip/vmlinux...(no debugging symbols found)...done.
> > (gdb) list schedule+0x45
> > No symbol table is loaded. Use the "file" command.
> >
> > Is there a way to resolve schedule+0x45 in a regular vmlinux? It
> > was an honest question.
>
> That seems to be just a gdb bug (or "UI feature"), in that gdb likes
> to give misleading error messages and requires odd syntax for some
> things.

Yeah. Almost as if they worked hard to make annoying users go away or
something. (LLVM is IMO a blessing because, despite its somewhat
broken licensing, it cured a similar attitude of the GCC folks. In a
way competition is more important than licensing details!)

> But you can see that the symbol is perfectly fine:
>
> (gdb) list *(schedule+0x45)

Oh, cool. Thanks for that trick - this will save me quite some time in
the future.

So we can strip absolute addresses just fine from oopses - cool.

I'd even argue to strip the hex on non-randomized kernels as long as
there's kallsyms around, and only print hex if we don't have any
symbols.

> So my point is that the hex address doesn't give you *anything* that
> the symbolic address doesn't give you. [...]

Yeah, and with your trick that's now the case for my debugging as
well, which is a nice touch.

> [...] Unless you do truly crazy things like actively strip the
> kernel.

Being crazy is something I try to avoid. (Beyond being a maintainer
of a software project as busy and stressful as the Linux kernel that is.)

Thanks,

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/