[xen master] xen/ubsan: Implement __ubsan_handle_nonnull_arg()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] xen/ubsan: Implement __ubsan_handle_nonnull_arg()

patchbot
commit e7a95e859cf4da92620b64a04f4d858ea96c2de9
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Tue Oct 3 19:07:52 2017 +0100
Commit:     Wei Liu <[hidden email]>
CommitDate: Mon Oct 9 17:04:58 2017 +0100

    xen/ubsan: Implement __ubsan_handle_nonnull_arg()
   
    This hook appears to be missing from the Linux ubsan implemention.  This patch
    is a forward port of https://lkml.org/lkml/2014/10/20/182
   
    Signed-off-by: Andrew Cooper <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Acked-by: Jan Beulich <[hidden email]>
---
 xen/common/ubsan/ubsan.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index fb0409d..685b4de 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -328,6 +328,25 @@ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
 }
 EXPORT_SYMBOL(__ubsan_handle_type_mismatch);
 
+void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data)
+{
+ unsigned long flags;
+
+ if (suppress_report(&data->location))
+ return;
+
+ ubsan_prologue(&data->location, &flags);
+
+ pr_err("null pointer passed as argument %d, declared with nonnull attribute\n",
+       data->arg_index);
+
+ if (location_is_valid(&data->attr_location))
+ print_source_location("nonnull attribute declared in ",
+      &data->attr_location);
+
+ ubsan_epilogue(&flags);
+}
+
 void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
 {
  unsigned long flags;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog