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

Re: [PATCH 0/9] xen/arm: Enable UBSAN support


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 26 Jun 2023 07:45:11 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=osy2r5Vr+/zIZXhlsFCIzg6PPd+zfEb4uA78Zi23SnQ=; b=KGCtJcz3M+3VjAE//jZU8m8tNY8HH6eqFh5c7kz3naxC+lmOXyVi3fFruSepAjRt43A9/8LdoGoiHGTyxWQLE4Pp3d29LPNocLmoL4W0qXEFcX/Dv2NhdzsezzoGmOIXpLWjeGambEbDXLuSn+wwjAsZSqnoGyRvxbkvJ1HlQmsBNiG9+ZdvGgnNhpKUYlbBPrr30pVqQVb2dX6maB87BC2FcVZ4OT0HxJLODceYGs8evfPg5IyPz8HT4K9qaiZ0MbubngIlT7U0iS1jm3NVr6Anb3L0zBqGJBQFmC9Rt38RCgAzYb/cEenQ+d2ub2z6jVg3dXrEF6VmsfsIA/Dg4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fq3f+NlR8lQ9IVQzIN8mp50TutrIXgU2Wub7g/KHHmpk3ZTEW/KNSIfrPwHyZqK9JZwJHF1lOGm+s7lcHZbEU0jrNQTfkpQCMgSLq/q63l78ZgeB12hIoArWm3G/JnzL3BGePoLjwQR2Ycxjz6CnYOqeo3QNFLVrPdy1W1njc7WPhaDFfZSyubeYnmjSJAGmEW9sslv0V1+4EEA68CjtyerP0jHcClC/8NBcoUzsfx98ntVInT8Zgo/d3ribLXXWNLkKG8vyh2dFmxwzFsZbwUXJ194PI9BBNBDPjs5sobLctHSbgUCvLkqaxuUayAk1Ai6H0eDdWz5eaIGIt7jwgQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Luca.Fancellu@xxxxxxx, michal.orzel@xxxxxxx, Henry.Wang@xxxxxxx, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 26 Jun 2023 05:45:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.06.2023 22:48, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Hi all,
> 
> At the moment, we are not able to enable UBSAN on Arm because the
> final binary will be over the maximum size of Xen we currently support
> (i.e. 2MB).
> 
> This patch series aim to lift the restrictions and also
> enable UBSAN. Lastly, at the end of the series, there is the first
> issue found by USBAN.
> 
> There are a few of others. One will be fixed by the MISRA work
> in [1] and the other is a bit tricky. One the splat is (the
> others seems to be for similar reasons)
> 
> (XEN) 
> ================================================================================
> (XEN) UBSAN: Undefined behaviour in common/sched/credit2.c:2437:5
> (XEN) member access within misaligned address 43feefbc for type 'struct 
> csched2_runqueue_data'
> (XEN) which requires 8 byte alignment
> (XEN) Xen WARN at common/ubsan/ubsan.c:172
> 
> This is on 32-bit and UBSAN seems to complain about the check in
> list_for_each_entry. I haven't yet dived into the issue yet.

At a guess this is because the list head struct, living in
struct csched2_private, has only 32-bit alignment, while on the
last loop iteration pos doesn't hold a real struct
csched2_runqueue_data * (which ought to b 64-bit aligned, but
isn't in the special case of having reached the list head again).
If I'm not mistaken rwlock_t is 12 bytes for Arm32, which would
match with the address above ending in c, assuming that xmalloc()
returns at least 16-byte-aligned space on Arm32 as well. If so,
in this particular case some rearrangement of struct
csched2_private ought to help, but as you say this is a more
general issue and hence likely wants addressing in a generic way.

Jan



 


Rackspace

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