>>> On 17.10.17 at 13:36, <roger....@citrix.com> wrote:
> clang 5.0 changed the layout of the type_mismatch_data structure and
> introduced __ubsan_handle_type_mismatch_v1 and
> __ubsan_handle_pointer_overflow.
> 
> This commit adds support for the new structure layout, adds the
> missing handlers and the new types for type_check_kinds.
> 
> Signed-off-by: Roger Pau Monné <roger....@citrix.com>

Acked-by: Jan Beulich <jbeul...@suse.com>
with a remark:

> +void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
> +                             unsigned long base, unsigned long result)
> +{
> +     unsigned long flags;
> +
> +     if (suppress_report(&data->location))
> +             return;
> +
> +     ubsan_prologue(&data->location, &flags);
> +
> +     pr_err("pointer overflow:\n");
> +
> +     if (((long)base >= 0) == ((long)result >= 0))
> +             pr_err("%s of unsigned offset to %p overflowed to %p\n",
> +                     base > result ? "addition" : "subtraction",

Strictly speaking you also want to make "to" conditional upon this
being an add; for subtract it ought to be "from". Or perhaps just
say overflow and underflow?

And then - is "base > result" really a valid determination of
add/subtract (or overflow/underflow)? If the pointed to type is
wider than one byte, an addition may wrap one or more times
and still yield a value larger than the starting pointer.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to