All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Bertrand Marquis <Bertrand.Marquis@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>, Wei Liu <wl@xen.org>,
	Rahul Singh <Rahul.Singh@arm.com>
Subject: Re: [PATCH 2/8] xen/evtchn: modify evtchn_alloc_unbound to allocate specified port
Date: Wed, 13 Jul 2022 11:18:36 +0100	[thread overview]
Message-ID: <758779b3-ef39-aa95-15c9-9b84b952e80b@xen.org> (raw)
In-Reply-To: <5f200481-ed3c-a463-90aa-3718c0ab57a3@suse.com>

Hi Jan,

On 13/07/2022 10:53, Jan Beulich wrote:
> On 13.07.2022 11:35, Julien Grall wrote:
>> Hi,
>>
>> On 13/07/2022 07:21, Jan Beulich wrote:
>>>>> 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
>>>>
>>>> The problem is not exclusive to the static event channel. So I don't
>>>> think this is right to introduce MAX_STATIC_PORT to mitigate the issue
>>>> (even though this is the only user today).
>>>>
>>>> A few of alternative solutions:
>>>>      1) Handle preemption in alloc_evtchn_bucket()
>>>>      2) Allocate all the buckets when the domain is created (the max
>>>> numbers event channel is known). We may need to think about preemption
>>>>      3) Tweak is_port_valid() to check if the bucket is valid. This would
>>>> introduce a couple of extra memory access (might be OK as the bucket
>>>> would be accessed afterwards) and we would need to update some users.
>>>>
>>>> At the moment, 3) is appealing me the most. I would be interested to
>>>> have an opionions from the other maintainers.
>>>
>>> Fwiw of the named alternatives I would also prefer 3. Whether things
>>> really need generalizing at this point I'm not sure, though.
>> I am worry that we may end up to forget that we had non-generaic way
>> (e.g. MAX_STATIC_PORT) to prevent trigger the issue. So we could end up
>> to mistakenly introduce a security issue.
>>
>> However, my point was less about generalization but more about
>> introducing CONFIG_MAX_STATIC_PORT.
>>
>> It seems strange to let the admin to decide the maximum number of static
>> port supported.
> 
> Why (assuming s/admin/build admin/)? I view both a build time upper bound
> as well as (alternatively) a command line driven upper bound as reasonable
> (in the latter case there of course still would want/need to be an upper
> bound on what is legitimate to specify from the command line). Using
> static ports after all means there's a static largest port number.
> Determined across all intended uses of a build such an upper bound can be
> a feasible mechanism.

AFAICT, the limit is only here to mitigate the risk with the patch I 
proposed. With a proper fix, the limit would be articial and therefore 
it is not clear why the admin should be able to configure it (even 
temporarily).

Instead, I think we want to have a limit that apply for both statically 
and dynamically allocated even channel. This is what d->max_evtchn_port 
is for.

Cheers,

-- 
Julien Grall


  parent reply	other threads:[~2022-07-13 10:18 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 14:37 [PATCH 0/8] xen/evtchn: implement static event channel signaling Rahul Singh
2022-06-22 14:37 ` [PATCH 1/8] xen/evtchn: make evtchn_bind_interdomain global Rahul Singh
2022-07-05 14:56   ` Jan Beulich
2022-07-06 11:53     ` Rahul Singh
2022-06-22 14:37 ` [PATCH 2/8] xen/evtchn: modify evtchn_alloc_unbound to allocate specified port Rahul Singh
2022-06-22 14:51   ` Julien Grall
2022-07-05 15:06     ` Jan Beulich
2022-07-11 16:08     ` Rahul Singh
2022-07-12 17:28       ` Julien Grall
2022-07-13  6:21         ` Jan Beulich
2022-07-13  9:35           ` Julien Grall
2022-07-13  9:53             ` Jan Beulich
2022-07-13 10:03               ` Bertrand Marquis
2022-07-13 10:33                 ` Julien Grall
2022-07-13 10:18               ` Julien Grall [this message]
2022-07-13 10:56                 ` Jan Beulich
2022-07-13 11:31                   ` Julien Grall
2022-07-13 12:12                     ` Bertrand Marquis
2022-07-13 12:29                       ` Julien Grall
2022-07-20  9:59                         ` Rahul Singh
2022-07-20 11:16                           ` Julien Grall
2022-07-20 13:34                             ` Jan Beulich
2022-07-21 12:50                             ` Rahul Singh
2022-07-21 13:29                               ` Julien Grall
2022-07-21 15:37                                 ` Rahul Singh
2022-07-26 17:37                                   ` Julien Grall
2022-07-28 15:37                                     ` Rahul Singh
2022-07-28 15:51                                       ` Jan Beulich
2022-07-28 20:50                                       ` Julien Grall
2022-07-29 12:35                                         ` Rahul Singh
2022-06-22 14:38 ` [PATCH 3/8] xen/evtchn: modify evtchn_bind_interdomain " Rahul Singh
2022-07-05 15:11   ` Jan Beulich
2022-07-05 15:22     ` Julien Grall
2022-07-05 15:42       ` Jan Beulich
2022-07-06 11:59         ` Rahul Singh
2022-07-06 11:57       ` Rahul Singh
2022-06-22 14:38 ` [PATCH 4/8] xen/evtchn: modify evtchn_bind_interdomain to pass domain as argument Rahul Singh
2022-07-05 15:13   ` Jan Beulich
2022-07-06 11:54     ` Rahul Singh
2022-06-22 14:38 ` [PATCH 5/8] xen/evtchn: don't close the static event channel Rahul Singh
2022-06-22 15:05   ` Julien Grall
2022-06-23 15:10     ` Rahul Singh
2022-06-23 15:30       ` Julien Grall
2022-06-23 15:33         ` Jan Beulich
2022-06-28 13:53         ` Rahul Singh
2022-06-28 14:26           ` Julien Grall
2022-06-28 14:52             ` Bertrand Marquis
2022-06-28 15:18               ` Julien Grall
2022-06-28 15:20                 ` Jan Beulich
2022-07-05 13:28                 ` Rahul Singh
2022-07-05 13:56                   ` Julien Grall
2022-07-06 10:42                     ` Rahul Singh
2022-07-06 11:04                       ` Julien Grall
2022-07-06 11:33                         ` Juergen Gross
2022-07-07 12:45                           ` Rahul Singh
2022-07-05 15:17   ` Jan Beulich
2022-07-05 15:26   ` Jan Beulich
2022-07-05 15:33     ` Jan Beulich
2022-06-22 14:38 ` [PATCH 6/8] xen/evtchn: don't set notification in evtchn_bind_interdomain() Rahul Singh
2022-07-05 15:23   ` Jan Beulich
2022-06-22 14:38 ` [PATCH 7/8] xen: introduce xen-evtchn dom0less property Rahul Singh
2022-08-05 16:10   ` Rahul Singh
2022-08-05 16:14     ` Julien Grall
2022-08-08  9:17       ` Rahul Singh
2022-06-22 14:38 ` [PATCH 8/8] xen/arm: introduce new xen,enhanced property value Rahul Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=758779b3-ef39-aa95-15c9-9b84b952e80b@xen.org \
    --to=julien@xen.org \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Rahul.Singh@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.