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

Re: [PATCH 4/5] xen/xsm: Improve fallback handling in xsm_fixup_ops()


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 8 Nov 2021 10:04:55 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=l9BR3w1qtteb7SAYw/dVKzJhDj+0XA2h2ePAIPCzzSA=; b=dlY5swpIIjQmgxs83SEZLDuyDkAXRkSUclM9/8D7Txv+3e8aoKL0vhvpbmxxjRC8f3ReTBWfeM7PhLBBXlrcbh0sgneMhrcMhSP3GEhn0uU1QFLMP2SZoggk6rn4/aF+KfNeS1mW/Qt+W2T9/pmsSud/Jc0IeQGjui2CZnw0DyQcCnrMohACUgNq0lUJVF+ycsLCJW6qjf9PWzngQ8LHUX0xZJrgzdZcKo5/rST1iqjFj6xJdXlRJ/nduOhapm79mqkjdqcIPWg2FR1lc5BnpkBxifhhw43TLBCk56c3E7rwLNb8zGwQjXt6mPvfWIxwuCqbWfu12N9DXBO/Hlqmkw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VXLWoUvnut7rigO3IL3zUAWfhGnkef4xCeXq49MXq60JZLLHYTUzSReqg3vZzCRbDZfD77BF9vNtfktAtazOXwHOZOGpRcyZXcljMIotvUI0BOLKViTGDBz3UaCtJt0x5cqUsPjCtT6XHzYZbud19Gfvn0fH786Z5Rle5K0SWxOTDFk9AhTh1D+DOk8arSndykt2k5t5aqbBvy/JTvXUjh2tA7e8fbTi00ocT0ACFJGbzhQqoxgOd4I1h9RDmddFi/qZ+t1MLjEkmvJ6MdmovG7JgZZXpmhc8HPTi5bXQ79743G50l9qDfvftLQPtgTA6VHjq9v2M5JEqm6Nvx5JzA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 08 Nov 2021 09:05:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.11.2021 14:55, Andrew Cooper wrote:
> +void __init xsm_fixup_ops(struct xsm_ops *ops)
> +{
> +    /*
> +     * We make some simplifying assumptions about struct xsm_ops; that it is
> +     * made exclusively of function pointers to non-init text.
> +     *
> +     * This allows us to walk over struct xsm_ops as if it were an array of
> +     * unsigned longs.
> +     */
> +    unsigned long *dst = _p(ops);
> +    unsigned long *src = _p(&dummy_ops);

I'm afraid I consider this an abuse of _p(): It hides casting when
that would better not be hidden (and there's then also a pointless
step through "unsigned long" in the casting). I suppose this is
also why "src" didn't end up "const unsigned long *" - with spelled
out casts the casting away of const might have been more noticable.

> +    for ( ; dst < (unsigned long *)(ops + 1); src++, dst++ )
> +    {
> +        /*
> +         * If you encounter this BUG(), then you've most likely added a new
> +         * XSM hook but failed to provide the default implementation in
> +         * dummy_ops.
> +         *
> +         * If not, then perhaps a function pointer to an init function, or
> +         * something which isn't a function pointer at all.
> +         */
> +        BUG_ON(!is_kernel_text(*src));

Just as a remark, not a request to change anything: A cause of this
triggering may also be is_kernel_text() not covering all text
sections. Some of what recently we've been talking about informally
may lead to new text section variants appearing, and whether those
would sensibly end up inside [_stext,_etext) is uncertain.

Jan




 


Rackspace

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