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

Re: [PATCH] x86: guard against port I/O overlapping the RTC/CMOS range


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 24 Jul 2020 13:11:18 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 24 Jul 2020 12:11:37 +0000
  • Ironport-sdr: sxJRq5KY/C4CEE2PXaJ8Mbtme54zkvMBY+7ZCHnQ5L/1e4W1eFXsIeAADadGEaoJbDIRdGiwIm XaazKwkCMwHRkzT0ZlpWIVCe49dcchAl6GmOB3eGMlnZYjc8J6TqAcJJ39QMJTWvTsxMt69ty7 Lzzwp0tdjfv7rm8RGrSEryYBGwDGC014F5d7quuNVNMZQDiEPOSZY8rWVFjRCQ/ZN7gAkpF2e7 wOs0GxVZ1+JUZerQc3z/YHkVLaR9bjPfg3b1bBSkwSXDqDhsT2STyY/L7915oU0EhjjY8/hSfS TZA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
>
> --- 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.

~Andrew



 


Rackspace

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