All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Ping: [PATCH] x86: guard against port I/O overlapping the RTC/CMOS range
Date: Mon, 24 Aug 2020 14:32:56 +0200	[thread overview]
Message-ID: <062a7505-eb35-cf15-3663-9890fbd50d4b@suse.com> (raw)
In-Reply-To: <f192793d-d074-990a-190d-67f48ccda87a@suse.com>

On 24.07.2020 16:19, Jan Beulich wrote:
> On 24.07.2020 14:11, Andrew Cooper wrote:
>> On 17/07/2020 14:10, Jan Beulich wrote:
>>> Since we intercept RTC/CMOS port accesses, let's do so consistently in
>>> all cases, i.e. also for e.g. a dword access to [006E,0071]. To avoid
>>> the risk of unintended impact on Dom0 code actually doing so (despite
>>> the belief that none ought to exist), also extend
>>> guest_io_{read,write}() to decompose accesses where some ports are
>>> allowed to be directly accessed and some aren't.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>>
>>> --- a/xen/arch/x86/pv/emul-priv-op.c
>>> +++ b/xen/arch/x86/pv/emul-priv-op.c
>>> @@ -210,7 +210,7 @@ static bool admin_io_okay(unsigned int p
>>>          return false;
>>>  
>>>      /* We also never permit direct access to the RTC/CMOS registers. */
>>> -    if ( ((port & ~1) == RTC_PORT(0)) )
>>> +    if ( port <= RTC_PORT(1) && port + bytes > RTC_PORT(0) )
>>>          return false;
>>
>> This first hunk is fine.
>>
>> However, why decompose anything?  Any disallowed port in the range
>> terminates the entire access, and doesn't internally shrink the access.
> 
> What tells you that adjacent ports (e.g. 006E and 006F to match
> the example in the description) are disallowed? The typical
> case here is Dom0 (as mentioned in the description), which has
> access to most of the ports.

Are you okay with this answer, and hence may I commit the change
with Roger's R-b (and the cosmetic adjustments he did ask for)?
(Unless I hear otherwise within the next day or two, I guess I'll
assume so.)

Jan


      reply	other threads:[~2020-08-24 12:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17 13:10 [PATCH] x86: guard against port I/O overlapping the RTC/CMOS range Jan Beulich
2020-07-20 10:52 ` Roger Pau Monné
2020-07-20 11:58   ` Jan Beulich
2020-07-20 13:22     ` Roger Pau Monné
2020-07-24 12:11 ` Andrew Cooper
2020-07-24 14:19   ` Jan Beulich
2020-08-24 12:32     ` Jan Beulich [this message]

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=062a7505-eb35-cf15-3663-9890fbd50d4b@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --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.