[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGdX0WG6Nid66iuRWqLbfmH89XacEXuUNYCNjnB7j=HYiyCKBw@mail.gmail.com>
Date: Sun, 30 Mar 2014 16:02:49 +0800
From: Jovi Zhangwei <jovi.zhangwei@...il.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH v2 08/29] ktap: add bytecode reader(kernel/trace/ktap/kp_bcread.[c|h])
On Sun, Mar 30, 2014 at 10:47 AM, Andi Kleen <andi@...stfloor.org> wrote:
>> +/* Read debug info of a prototype. */
>> +static void bcread_dbg(BCReadCtx *ctx, ktap_proto_t *pt, int sizedbg)
>> +{
>> + void *lineinfo = (void *)proto_lineinfo(pt);
>> +
>> + bcread_block(ctx, lineinfo, sizedbg);
>> + /* Swap lineinfo if the endianess differs. */
>
>
> Why does this care about endianness? Can't that be handled in the user
> space? And why would the user space create different endianness than
> the host is?
>
That's designed for portability initially, it means we can just run bytecode
without compile script file everywhere, especially when compilation is
a heavily task for some embedded platform, even though ktap compilation
is extremely fast.
I doubt maybe there will have this bytecode portability requirement in future?
>> + for (i = 0; i < sizekgc; i++, kr++) {
>> + int tp = bcread_uint32(ctx);
>> + if (tp >= BCDUMP_KGC_STR) {
>
> The signedness handling all over this file is a scary.
> What happens if the user puts in negative values or near overflow
> values.
>
> Most likely a lot of these checks should be unsigned
> and need to be audited again (and ideally fuzzed too)
>
>> +
>> + /* Allocate prototype object and initialize its fields. */
>> + pt = (ktap_proto_t *)kp_obj_new(ctx->ks, (int)sizept);
>
> Error check?
>
> Lots of other similar cases.
>
I will take more check in kp_bcread.c file, will fix in next version.
Thanks.
Jovi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists