Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280197

Re: [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker

From Sasha Levin <sasha.levin@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker
Date 2015-11-30 20:00 +0100
Message-ID <qABQ6-7jF-5@gated-at.bofh.it> (permalink)
References <qAzbA-5R5-19@gated-at.bofh.it> <qAzbB-5R5-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/2] UBSAN: run-time undefined behavior sanity checker Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-11-30 17:10 +0100
  [PATCH v3 1/2] kernel: printk: specify alignment for struct printk_log Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-11-30 17:10 +0100
  [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-11-30 17:10 +0100
    Re: [PATCH v3 2/2] UBSAN: run-time undefined behavior sanity checker Sasha Levin <sasha.levin@oracle.com> - 2015-11-30 20:00 +0100

csiph-web