Re: [PATCH 8/9] Add KASan support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 18, 2020 at 12:15:53PM +0200, Ahmad Fatoum wrote:
> 
> 
> On 9/18/20 10:45 AM, Sascha Hauer wrote:
> > -	return block_prepare_used(control, block, adjust);
> > +	void *ret;
> > +
> > +	ret = block_prepare_used(control, block, adjust, size);
> > +	if (!ret)
> > +		return ret;
> > +
> > +	return ret;
> 
> Debugging leftover? You can just return the function result directly.

Not exactly debugging leftover. I had the poisoning code here in an
earlier version and haven't rolled it back completely when moving the
code elsewhere. Fixed.

> > +static void print_error_description(struct kasan_access_info *info)
> > +{
> > +	pr_err("BUG: KASAN: %s in %pS\n",
> > +		get_bug_type(info), (void *)info->ip);
> > +	pr_err("%s of size %zu at addr %px\n",
> > +		info->is_write ? "Write" : "Read", info->access_size,
> > +		info->access_addr);
> 
> I just removed the pr_err in ubsan with this rationale:
> 
>     common: ubsan: replace pr_err with printf
> 
>     The pr_print family of functions also writes to the barebox
>     log buffer, which we don't require for printing UBSan errors,
>     which is a debugging aid. This also improves UBSan coverage as now
>     undefined behavior within pr_print may be reported as well.
> 
> Should we use plain printf here as well? Less code to execute
> = less chance to run into a recursion.

I am not sure. I did a quick

	foo = strdup("Hallo");
	free(foo);
	pr_err(foo);

At least this worked as expected. I can't really tell at the moment if
this covers all cases. I think there will be surprises when we call
pr_err inside a pr_err which faults. On the other hand I would really
expect such a message to be in the log.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux