[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/ubsan: expand pointer overflow message printing
commit 53ec18fa8f590ea6ad4792a0b126013dd39a25ee Author: Roger Pau Monne <roger.pau@xxxxxxxxxx> AuthorDate: Thu Mar 13 12:02:50 2025 +0100 Commit: Roger Pau Monne <roger.pau@xxxxxxxxxx> CommitDate: Mon Mar 17 13:33:29 2025 +0100 xen/ubsan: expand pointer overflow message printing Add messages about operations against the NULL pointer, or that result in a NULL pointer. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/common/ubsan/ubsan.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c index 7ebe4bfc14..20aa0cb598 100644 --- a/xen/common/ubsan/ubsan.c +++ b/xen/common/ubsan/ubsan.c @@ -517,9 +517,18 @@ void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data, ubsan_prologue(&data->location, &flags); - pr_err("pointer operation %s %p to %p\n", - base > result ? "overflowed" : "underflowed", - _p(base), _p(result)); + if (!base && !result) + pr_err("applying zero offset to null pointer\n"); + else if (!base && result) + pr_err("applying non-zero offset %p to null pointer\n", + _p(result)); + else if (base && !result) + pr_err("applying non-zero offset to non-null pointer %p produced null pointer\n", + _p(base)); + else + pr_err("pointer operation %s %p to %p\n", + base > result ? "overflowed" : "underflowed", + _p(base), _p(result)); ubsan_epilogue(&flags); } -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |