lkml.org 
[lkml]   [2014]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 08/29] ktap: add bytecode reader(kernel/trace/ktap/kp_bcread.[c|h])
> +/* 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?

> + 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.


-Andi

--
ak@linux.intel.com -- Speaking for myself only.


\
 
 \ /
  Last update: 2014-03-30 05:01    [W:1.286 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site