mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 8/9] Add KASan support
Date: Mon, 21 Sep 2020 08:24:37 +0200	[thread overview]
Message-ID: <20200921062437.GC21278@pengutronix.de> (raw)
In-Reply-To: <518f7fbb-8454-52e9-8b43-fc04d099ee6e@pengutronix.de>

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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-09-21  6:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18  8:45 [PATCH 0/9] barebox " Sascha Hauer
2020-09-18  8:45 ` [PATCH 1/9] Add print_hex_dump kernel implementation Sascha Hauer
2020-09-18  8:45 ` [PATCH 2/9] Add _RET_IP_ macro Sascha Hauer
2020-09-18  8:45 ` [PATCH 3/9] Kallsyms: Also resolve global variables Sascha Hauer
2020-09-22 16:17   ` Michael Grzeschik
2020-09-28  8:30     ` Sascha Hauer
2020-09-18  8:45 ` [PATCH 4/9] Add constructor support Sascha Hauer
2020-09-18  8:45 ` [PATCH 5/9] pbl: Alias memcpy and memset Sascha Hauer
2020-09-18  8:45 ` [PATCH 6/9] string: Add nokasan variants of default memcpy/memset Sascha Hauer
2020-09-18  8:45 ` [PATCH 7/9] sandbox: rename KASan to ASan Sascha Hauer
2020-09-18  8:45 ` [PATCH 8/9] Add KASan support Sascha Hauer
2020-09-18 10:15   ` Ahmad Fatoum
2020-09-21  6:24     ` Sascha Hauer [this message]
2020-09-18  8:45 ` [PATCH 9/9] ARM: " Sascha Hauer
2021-02-09  9:25   ` Ahmad Fatoum
2021-02-10  9:26     ` Sascha Hauer
2021-02-10  9:27       ` Ahmad Fatoum
2020-09-28 14:33 ` [PATCH 0/9] barebox " Ahmad Fatoum
2020-09-28 15:06   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200921062437.GC21278@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox