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

Re: [PATCH 2/8] xen/evtchn: modify evtchn_alloc_unbound to allocate specified port


  • To: Julien Grall <julien@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Mon, 11 Jul 2022 16:08:30 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=kzzUzxRym5wX6T3toMxMnQRrUl504ic1G+KMhuIVNTM=; b=QxPA9a+e4e1kZzoNdqusUgYD8Kg8kwMlSr1DXQjhzN0kRhXEfz2suWYtKubnT7Jn/7r4fhwDA9FwQJEBI3nDeOHM44HXMF6wW6cuAjBMFU5fiwPJFf2/H/NYODrNLtWutpcRZHuTN+VhshY8u/bUfoSTXqquKxzT+WszB5JGB0crJ+Lnvq2wUp8ToRfjmXpTBsbEPqh7JaRxyF+9/mjVz/MgZgUtty3AZt64qKKkmBR78pjYVgUP2bcDYPOzdIjH77HCa7o0/HBphWrqO41arFis6xNT6GQ891+VZDQbtj5mfRFOA6EpZIVjamdtka8KEUEq2RK9Rez5bqeg9Xr9cA==
  • 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=kzzUzxRym5wX6T3toMxMnQRrUl504ic1G+KMhuIVNTM=; b=acR/QPViUO4yKg24s8LzM0Ss3zQvVbHunfn1f5jezNd8i2tlypBwsNbAvBR9IKiLxeZmOdhC2dbyucAlveGYd2dOM+++VzBfwk4mtYNYoxFMZNR9fTN2CvrDt9qq5W8GuvAvOWudEUbTfroHjxylUMR58xaX5C+5eGo6NaeyMld3qhGt3dL/WjfEZKAruMWsjWuSqUNaFRxYHVU1IHs3JJf96x7nC7J5oUy9kZvzCSuvIOpe/Dvzp/2c0CEnIPoirfN9n6TMb6kpzBSSPbfzxO6MNPEVX2rb4AlsfWU/v9iUaNzpzeqCTP0t+lciIeKMwGcMu0dXFTV3uUP1RhutBw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=VlHGYKAJpib6ti0VaWExV4kr3wrt4lgB7Enc4P3PBi7qxk1CO7sM1jGiKoVoJpbGwLoar97Xq3R/QAEGuJMV+I8oBxegSC+/kKWrnDOoqEgS88SsO7Da0+B4Ws2VddK7Czyyg+JQsBxirwUNppYA4e6skpkMzFGm2zylKZz7dyetOUZ0cKQ03pg0fpQNmyBHkKT6tShlPg6Kv0tXESUqszzI5LNh/80PHestAew32N3yeIXg5q09lvOwwnbDC20Zx34MoIh8MrFc07bsx4iVOd2VXBbCxBT+gXDJgooG7KU3myTmvMK/v8JBRu1cKUseGoWS+VqoTTC39wtjYOrtiQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HtOGEMRQCzOS0PXfl9iyn9MJo6LJWBSsXAKLY0op1vmTalW+3C/2+TNvR0AmZQJuxOCvZu4Mp0Fb95rNhyalDSs+7EXfdcGGy4YiNEwhCFpo6/P6v3n+lcudAPxLboxU6vVY/7JU4XNG38zkjTJGkeI8VjCDkKvswHee44Qfo5JFytknQCAG+JPa6NEoyKvad8CEswTaRaacovb4aC5q89ccnjRDM8jYCw52IDPdD+ftcgC4KS0ZvLIEnU7eqBHm39cGFJvjX6s49CHLTx/9mwFka86Vfc6GVMeJ5Tfw6LgzCVYd5IfSgyMpSdKjUuRPtgAg4Z7m9EScsnjFEA8QgQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 11 Jul 2022 16:08:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYhkXaSSR0QDc2DUiowhnmyNd/Sq1bgqiAgB3xuAA=
  • Thread-topic: [PATCH 2/8] xen/evtchn: modify evtchn_alloc_unbound to allocate specified port

Hi Julien,

> On 22 Jun 2022, at 3:51 pm, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi,
> 
> On 22/06/2022 15:37, Rahul Singh wrote:
>> evtchn_alloc_unbound() always allocates the next available port. Static
>> event channel support for dom0less domains requires allocating a
>> specified port.
>> Modify the evtchn_alloc_unbound() to accept the port number as an
>> argument and allocate the specified port if available. If the port
>> number argument is zero, the next available port will be allocated.
> 
> I haven't yet fully reviewed this series. But I would like to point out that 
> this opening a security hole (which I thought I had mention before) that 
> could be exploited by a guest at runtime.
> 
> You would need [1] or similar in order to fix the issue. I am wrote "similar" 
> because the patch could potentially be a problem if you allow a guest to use 
> FIFO (you may need to allocate a lot of memory to fill the hole).
> 
> Cheers,
> 
> [1] 
> https://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commit;h=2d89486fcf11216331e58a21b367b8a9be1af725

Thanks for sharing the patch.  If you are okay I can use this patch in next 
version to fix the security hole.

For the FIFO issue, we can introduce the new config option to restrict the 
maximum number of static
port supported in Xen. We can check the user-defined static port when we parse 
the device tree and if
a user-defined static port is greater than the maximum allowed static port will 
return an error to the user.
In this way, we can avoid allocating a lot of memory to fill the hole.

Let me know your view on this.

config MAX_STATIC_PORT
    int "Maximum number of static ports”
    range 1 4095
    help                                                                        
       Controls the build-time maximum number of static port supported.

Regards,
Rahul


 


Rackspace

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