From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 2/3] xen/ubsan: Implement __ubsan_handle_nonnull_arg()
Date: Mon, 9 Oct 2017 15:11:18 +0100 [thread overview]
Message-ID: <20171009141119.32595-3-wei.liu2@citrix.com> (raw)
In-Reply-To: <20171009141119.32595-1-wei.liu2@citrix.com>
From: Andrew Cooper <andrew.cooper3@citrix.com>
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 <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
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 fb0409df1b..685b4de0d6 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;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-09 14:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 14:11 [PATCH v2 0/3] Add support for using the Undefined Behaviour Sanitizer Wei Liu
2017-10-09 14:11 ` [PATCH v2 1/3] xen/ubsan: Import ubsan implementation from Linux 4.13 Wei Liu
2017-10-09 14:11 ` Wei Liu [this message]
2017-10-09 14:11 ` [PATCH v2 3/3] xen: hook up UBSAN with CONFIG_UBSAN Wei Liu
2017-10-09 14:23 ` Andrew Cooper
2017-10-09 14:28 ` Wei Liu
2017-10-09 14:31 ` Julien Grall
2017-10-09 14:36 ` Jan Beulich
2017-10-09 14:38 ` Andrew Cooper
2017-10-09 14:41 ` Wei Liu
2017-10-09 14:55 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171009141119.32595-3-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.