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

Re: [PATCH 04/65] x86/hypercall: Annotate fnptr targets


  • To: Andrew Cooper <amc96@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 29 Nov 2021 11:00:21 +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=aZKBDxTqKsls/uh0vURMMbSNeSqGv9vY49BuzjTpkOM=; b=AVgejFsl6qc3KFKZbi5WT7fEUgYwzN2u8Rn2eyS/N64JwjKrOUmdGEH5+00y7hl1pTh1nLIGDVCwnHNn5dGxlsznjR7FkgmJQBbcBHicHlyADTp38jkAdnpOAPwWnQLMYIVwQRV7Lo2Nm0q25ILx1pecgVgESf47+mT6Ca8zx+QJf9N37BanlXLvOhL93UIAweJn82zV4Ya0OYnMXPgspkcaQuYcl1oNi2DmcHu17NR9FBNdS5Oc/oD/Q0PUQCu1Y43CB9L4f5SYp4TQCAsgYsous4oF5KOjUcOAYYt1ZwX1GnHucGLhYi30eNH5lSTYa5lqNoFreqPMbY8ZQYb1bg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWwY7z0ziOIx2vEk7x7edFdjhChzGQpFsAawWZq58a6jZlvmUxGETlaR7X3DpvPSW6EYsHP+lf27aTYjUBAbjtFh1PRpj0LkkPy71fOJicjl/aj6jLAMlmXsnZDtQWHcyD0EaNVGhG26g4ke1AmP18qXkxkhyvyQFgfzgesAq8yStmQRF167xUhJjncsrQfDGj6AiEDzYbdyplKO4bWmTDgRy1K1Wtzr/Q4Tinb+j9X6YfOaVKO67191sHnVgugT5LsSZZIovwB52eSePUl5vrIe9VD0b4Uq70cC1Bq7BPW6aqIcq2hm1p5dUX1iZ5YJ10q3VWBpOdnK2xzD1bx+5g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 29 Nov 2021 10:00:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.11.2021 10:38, Jan Beulich wrote:
> On 26.11.2021 15:28, Andrew Cooper wrote:
>> On 26/11/2021 14:21, Jan Beulich wrote:
>>> On 26.11.2021 13:33, Andrew Cooper wrote:
>>>> --- a/xen/include/xen/hypercall.h
>>>> +++ b/xen/include/xen/hypercall.h
>>>> @@ -18,12 +18,12 @@
>>>>  #include <asm/hypercall.h>
>>>>  #include <xsm/xsm.h>
>>>>  
>>>> -extern long
>>>> +extern long cf_check
>>>>  do_sched_op(
>>>>      int cmd,
>>>>      XEN_GUEST_HANDLE_PARAM(void) arg);
>>> What purpose does the attribute serve on a declaration? On the surface
>>> I would consider it meaningful only on definitions, like e.g. __init.
>>
>> Because GCC treats cf_check (and nocf_check) as part of the function
>> type.  Simply getting it wrong will yield a "definition doesn't match
>> prototype" error.
>>
>> Furthermore, it needs to be visible across translation units so one TU
>> can spot (and complain at) creating a function pointer to a non-local
>> non-endbr'd function.
> 
> Hmm, it might well be that way, but that's not what the doc (for 11.2)
> says. While suggesting things are along the lines of what you say for
> "nocf_check", for "cf_check" it really only talks about code generation:
> "The cf_check attribute on a function is used to inform the compiler
> that ENDBR instruction should be placed at the function entry when
> ‘-fcf-protection=branch’ is enabled." And even for "nocf_check" it talks
> about extra compile time checks only when the attribute is applied to a
> function pointer variable/field, not when applied to a function.

The two attributes looks to indeed be as different as the doc suggests,
after some experimenting. But I now understand that's what patch 56 is
about.

Jan




 


Rackspace

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