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

[PATCH] ubsan: Fix pointer overflow error message


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 7 Nov 2023 10:14:17 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DjS8PUvMoyk/GGe8HZDq/JIIKYhL8ZZdZRfEE4IxtYk=; b=dlDbrptvN2T1t4Wqx0t52KzTwuL75REllGUa64GLohO3gwure6K95xuX6KMd4iC7wj46beLIBrf5W4WjgtgoQpJhbGMYSbIT8zCz5cb2yNzHPKTSCSH6COFx9AEy6HX9IKepjrkyWJNmv/vaucY02bGtd9vD9GsSl2pB2lbLp3pQE6H94zPL3cqbfEwcavVNgHdK3AJWxxCFzqPi1rJ6Elhpa8PWmlHIEfjlgtTlVhWJEKxvsK7FyB5qtxaDu9lf8O4woc+o49p/opVIuKSLi4obEK3AHoSO5Ymj1YQtVtMjHYm9LRNluA6tN095mQLsvgMeMlgW7milKMH8hPLimw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4ndbjnbgk980dgrmTXQG05AyIrr/P5C9CoM1ZCsux+y7UCFsVnIMluokYvH7wl5PdMpp5a64iKeshhs7V2vK2iQpWjrzStJajpOWJbg50cdHSfqF3kjf15YY2HZYdKIHrpPedM3ZuC8uoRI2n3e7K5UEhLE68PrxHXIbvXDHiLHsyy4rjR+/BvjaRRHGZlDgusWnwymrxc+gr33kemwukqKNe3ukNKJHKYRLnR0+tF2Hyo2cKAD5gT1YW/aW9CS3Dk3BqrwOyd9EYlCJSnPMMh5AXXS8jg69FHNhbXB17g1iLiWaEiH8CtNXUPpFdGnd+8Bsrp2DJoLvPYd/1YVqA==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 07 Nov 2023 09:15:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In __ubsan_handle_pointer_overflow(), fix the condition for determining
whether a pointer operation overflowed or underflowed. Currently, the
function reports "underflowed" when it should be reporting "overflowed"
and vice versa.

Example of incorrect error reporting:
void *foo = (void *)__UINTPTR_MAX__;
foo += 1;

UBSAN:
pointer operation underflowed ffffffff to 00000000

Fixes: 4e3fb2fb47d6 ("ubsan: add clang 5.0 support")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/common/ubsan/ubsan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 0fddacabda6a..a3a80fa99eec 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -513,7 +513,7 @@ 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 ? "underflowed" : "overflowed",
+              base > result ? "overflowed" : "underflowed",
               _p(base), _p(result));
 
        ubsan_epilogue(&flags);
-- 
2.25.1




 


Rackspace

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