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

From: Sasha Levin
Date: Mon Nov 30 2015 - 13:51:59 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/