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

Re: [PATCH v2] xen: Work around Clang-IAS macro \@ expansion bug


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 24 Feb 2023 08:14:50 +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=XGbfGEBunhTlr9zfh0yNRITe5jjsmtEzlDmrXf0QWtA=; b=Xxpgl5C12PvGp0YjclrJvmXrdWgy6gdFIEOT+58yoAhhnQhDlsV30D/bkXsMfLrnpekAm9QmW7rrUEITBOi3+6/+sQG+dAQempYrmYh8X5FCgvRtFSB9wE+D1PnCDXrAiswbTVZtiFcjYCpbDBEy7dHyLNYsu1I7hEH9uY8rK/5fr+bHsLm6JmWPAvKOFa13e/Svi3LSNJyhFSR92ZvDbdIBiUQu01vQzq+6jJzH4rcXpCdOh/klZuCukR88nECHF/B1PnAmYuftuiAgw16GkyHlTMW4m6IDwC7sZZafyqhylMj9wCAlskyGZ9buqNMg5GgRi6CW1CjVxrf30aM/PA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyyLPK4P++HO56at5riagvcmw/roAYgjWypnyFPkIsO4a7ZzVRqXMuvafuTu8+srKKu06VJgA2fO/c0yP9X2Y6/k5RRLJKAHl2911xZP4URJlQY8TBcXlDDSY8cDhYOI9gBzpJLbb2fLobCg3yp1Pq+RDG8CBaBLtTWdiA7emrTg8Wmr52Hh2KC9HIcofxwAqZVMWs3ePXbB1j9JuAPH3ZSqKZLiLuxa/JjX6dgmZ5ZOQ2NXp9AYfuYj5iZZojwo+iW6Cp062gB2M0CKDMyNioAXd+PS0yM2KDgpuabm7Crv+NmdxbP2P/7o9/szwo3xno4BAnDsnQ2HKy366Nk4nQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 24 Feb 2023 07:15:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.02.2023 21:36, Andrew Cooper wrote:
> https://github.com/llvm/llvm-project/issues/60792
> 
> It turns out that Clang-IAS does not expand \@ uniquely in a translaition
> unit, and the XSA-426 change tickles this bug:
> 
>   <instantiation>:4:1: error: invalid symbol redefinition
>   .L1_fill_rsb_loop:
>   ^
>   make[3]: *** [Rules.mk:247: arch/x86/acpi/cpu_idle.o] Error 1
> 
> Extend DO_OVERWRITE_RSB with an optional parameter so C callers can mix %= in
> too, which Clang does seem to expand properly.
> 
> Fixes: 63305e5392ec ("x86/spec-ctrl: Mitigate Cross-Thread Return Address 
> Predictions")
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

A little hesitantly
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> --- a/xen/arch/x86/include/asm/spec_ctrl.h
> +++ b/xen/arch/x86/include/asm/spec_ctrl.h
> @@ -83,7 +83,7 @@ static always_inline void spec_ctrl_new_guest_context(void)
>      wrmsrl(MSR_PRED_CMD, PRED_CMD_IBPB);
>  
>      /* (ab)use alternative_input() to specify clobbers. */
> -    alternative_input("", "DO_OVERWRITE_RSB", X86_BUG_IBPB_NO_RET,
> +    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_BUG_IBPB_NO_RET,

Especially with there possibly appearing more cases where we need to
add such, wrapping the extra parameter in a C macro continues to
seem better to me, for having a minimal level of documentation (I
has CLANG in the suggested name for exactly this purpose) right at
the place of use. The way you have it you force readers to go look
up the assembler macro and read through the commentary there in order
to find any explanation for the oddity.

Jan



 


Rackspace

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