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

Re: [PATCH] xen: make VMAP support in MMU system only


  • To: Julien Grall <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Thu, 22 Aug 2024 11:52:39 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lMG8aiKz4WuD+wtermS59/pswWNOKugwWJiLeC1HqG4=; b=lj0bo8AY2ATLyaJTJB1OpX7vplGPo3y5d+jAYQwP2JXzFUdkgzXWLmKqr2jmeR87UT7c4t3LBMkSTsD9CvwuP85RkI1tM4a5xtvYd18Vq3nnPzyHq0bq82HbiMdNzNFmkkjHha5sbjtEHnZXHm/KMHxC/Gj4lXQkGI3cRF8a2SJSQdlZLLeaNDGep22hBPU1trvuwS0cFjsTyJFdgX8xvdTpIU6R2yCwnT0OkU7OXVsiJXXFzg5eQpEg035wQGdbCK/VuwdFANI5uBAB0M8yPEfboJB4M8Lzr8L3SL5/bDS43HUyNRlEq9dRLyzLy8+Hnnr8GBeVtm513lHWDjJXgA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uXnKRZ8dNXvdm5G4tV7nBu1iHtQ5thwOySY3v7LAJHkF2Rn+K/+iPboCU3EhmFyy8IWH1UjtnC3AbtdM0HHMKUdAp5MiTqiAsf9etnySS4Hgx9fZbQDRGYVMB5eGpKs27VxpOBE59Mx4zscBV+L/7NbnRxcBZqVDMJIKZ/wEGqCUq4GxbqYzB5UpiaNmBJO5hmcpLz56oHnevF9vAkAXpOYjeJ7WcGVesazWdARK9PqtbFyPrkvREJAQzL7sNrsRiPibc4fdpn6L229ioyGQg63YODAVMiulYvufYjIgVhRQ/wV9i5HzvGZ3VxRdO+oclzGl+xtCKG8p0ANUaEJ7EA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Penny Zheng <penny.zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Chen <wei.chen@xxxxxxx>
  • Delivery-date: Thu, 22 Aug 2024 10:53:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 21/08/2024 22:14, Julien Grall wrote:
Hi Ayan,
Hi Julien,

On 21/08/2024 13:25, Ayan Kumar Halder wrote:
From: Penny Zheng <penny.zheng@xxxxxxx>

Introduce CONFIG_VMAP which is selected by the architectures that use
MMU. vm_init() does not do anything if CONFIG_VMAP is not enabled.

VMAP is widely used in ALTERNATIVE feature to remap a range of memory
with new memory attributes. Since this is highly dependent on virtual
address translation, we choose to fold VMAP in MMU system.

In this patch, we introduce a new Kconfig CONFIG_HAS_VMAP, and make it
only support in MMU system on ARM architecture. And ALTERNATIVE now
depends on VMAP.

HARDEN_BRANCH_PREDICTOR is now gated on MMU as speculative
attacks are not possible on non MMU based systems (ie Cortex-R52, R82).
See https://developer.arm.com/Arm%20Security%20Center/Speculative%20Processor%20Vulnerability.

I don't have a strong opinion on whether it should be split. But I do agree this deserves a bit more explanation.

Also, as I mentioned before, speculative attacks may be possible on non-MMU based systems. In fact some the Cortex-R are in the affected list... The R82 and R52 are not listed, but note:

"For information about any unlisted processors please contact Arm".

So how about the following explanation:

"At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the vmap() to update the exceptions vectors. While it might be possible to rework the code, it is believed that speculative attackes would be difficult to exploit on non-MMU because the software is tightly controlled. So for now make HARDEN_PREDICTOR to depend on the !MMU.

This makes sense. However, I think you mean

..... make HARDEN_BRANCH_PREDICTOR to depend on the **MMU**.



Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif"
from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus,
HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of
them use MMU and has VMAP_VIRT_START defined.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>

With the typo pointed out by Jan:

Yes, I will use HAS_VMAP.

 I will update the commit message as below. Let me know if this makes sense.

```
xen: make VMAP support in MMU system only

Introduce CONFIG_HAS_VMAP which is selected by the architectures that
use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not
enabled.

HAS_VMAP is widely used in ALTERNATIVE feature to remap a range of
memory with new memory attributes. Since this is highly dependent on
virtual address translation, we choose to fold HAS_VMAP in MMU. And
ALTERNATIVE depends on HAS_VMAP.

At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the
vmap() to update the exceptions vectors. While it might be possible to
rework the code, it is believed that speculative attackes would be
difficult to exploit on non-MMU because the software is tightly
controlled. So for now make HARDEN_BRANCH_PREDICTOR to depend on the
MMU.

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif"
from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus,
HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of
them use MMU and has VMAP_VIRT_START defined.

```

- Ayan


Acked-by: Julien Grall <jgrall@xxxxxxxxxx>

Cheers,




 


Rackspace

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