All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Jonathan Corbet <corbet@lwn.net>, Michal Marek <mmarek@suse.cz>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Yury Gribov <y.gribov@samsung.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Konstantin Khlebnikov <koct9i@gmail.com>,
	Kostya Serebryany <kcc@google.com>,
	x86@kernel.org, linux-doc@vger.kernel.org,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker
Date: Mon, 30 Nov 2015 13:50:54 -0500	[thread overview]
Message-ID: <565C9A8E.4060604@oracle.com> (raw)
In-Reply-To: <1448899183-8677-3-git-send-email-aryabinin@virtuozzo.com>

On 11/30/2015 10:59 AM, Andrey Ryabinin wrote:
> +void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
> +					unsigned long lhs, unsigned long rhs)
> +{
> +	unsigned long flags;
> +	struct type_descriptor *rhs_type = data->rhs_type;
> +	struct type_descriptor *lhs_type = data->lhs_type;
> +	char rhs_str[VALUE_LENGTH];
> +	char lhs_str[VALUE_LENGTH];
> +
> +	if (suppress_report(&data->location))
> +		return;
> +
> +	ubsan_prologue(&data->location, &flags);
> +
> +	val_to_string(rhs_str, sizeof(rhs_str), rhs_type, rhs);
> +	val_to_string(lhs_str, sizeof(lhs_str), lhs_type, lhs);
> +
> +	if (val_is_negative(rhs_type, rhs))
> +		pr_err("shift exponent %s is negative\n", rhs_str);
> +
> +	else if (get_unsigned_val(rhs_type, rhs) >=
> +		type_bit_width(lhs_type))
> +		pr_err("shift exponent %s is to large for %u-bit type %s\n",
					     too

Otherwise looks great, I'm running fuzzing with it now.


Thanks,
Sasha

      parent reply	other threads:[~2015-11-30 18:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 15:59 [PATCH v3 0/2] UBSAN: run-time undefined behavior sanity checker Andrey Ryabinin
2015-11-30 15:59 ` Andrey Ryabinin
2015-11-30 15:59 ` [PATCH v3 1/2] kernel: printk: specify alignment for struct printk_log Andrey Ryabinin
2015-11-30 15:59   ` Andrey Ryabinin
2015-11-30 15:59 ` [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker Andrey Ryabinin
2015-11-30 15:59   ` Andrey Ryabinin
2015-11-30 16:47   ` kbuild test robot
2015-11-30 16:47     ` kbuild test robot
2015-11-30 17:23   ` kbuild test robot
2015-11-30 17:23     ` kbuild test robot
2015-11-30 18:50   ` Sasha Levin [this message]

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=565C9A8E.4060604@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=corbet@lwn.net \
    --cc=dvyukov@google.com \
    --cc=hpa@zytor.com \
    --cc=kcc@google.com \
    --cc=koct9i@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=y.gribov@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.