[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] xen/ubsan: Support for -fsanitise=builtin



>>> On 24.06.19 at 12:17, <andrew.cooper3@xxxxxxxxxx> wrote:
> This fixes the UBSAN build for GCC 8 and later.  The sanitiser checks for
> passing 0 to the ctz()/clz() builtins.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Fundamentally
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

However,

> --- a/xen/common/ubsan/ubsan.c
> +++ b/xen/common/ubsan/ubsan.c
> @@ -518,3 +518,24 @@ void __ubsan_handle_pointer_overflow(struct 
> pointer_overflow_data *data,
>  
>       ubsan_epilogue(&flags);
>  }
> +
> +void __ubsan_handle_invalid_builtin(struct invalid_builtin_data *data)
> +{
> +     unsigned long flags;
> +     const char *fn;
> +
> +     if (suppress_report(&data->location))
> +             return;
> +
> +     ubsan_prologue(&data->location, &flags);
> +
> +     switch (data->kind) {
> +     case kind_ctz: fn = "ctz"; break;
> +     case kind_clz: fn = "clz"; break;
> +     default: fn = "<UNKNOWN>"; break;
> +     }
> +
> +     pr_err("passing zero to %s(), which is not a valid argument\n", fn);

... logging the unknown enumerator value might turn out helpful
down the road.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.