[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 10:38:00 +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=2Bi1BQoraXlfbqkB17JzrsZbnAi0QmH6TcGduMLGh20=; b=UH3P2wTcGeN2/Qg754BS4EIEYjWMLT2JfmufLeEwL+Ia5qsfeImGge18X4lUyPH9HeZzY0KBJM01uXyW2+Z7Rs4HrBNYEn5tjbAOisQrWm5MynqArxeArtTES4TbBXW6ONzX4I/2Oj/6ZzY5XY5N7V0bIWIMyRJT9VcGho798ig1DhpRd1g/j3ugkD9kFhCHgL0/LhbhePw3GMgiRC4rjpQyL1IF092GlUlxGOIhX1jMU+Y9kYcDY/MZyaquAn/S9rlIKeptZ+yCTJ6xXwpEGc+ZqLfoiuDCQxER3+DqpbhE8Pmi6VUhkV/goT46uIjt8FHdnvsHktGaURIPgC7lwg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VpLkqNb4qO61xblaW1J3+2xZfjvSLdKP9LrPgmAhP5ZhhCW38iRCc8nyO7eBmpw+c+OOUhX7Knhhn6NtnM44rrJfnrsOvXa8cS8LxuOzEHql9EuTpYcorIRsgTZcQT8HjVJTv7iOahlrUwZw6viZJdyvRD4DkZ7s5yyaaj0gd8DLzApQeGeknvIatDcW0u9uKv0I6ByhGb2H4wihhZAsMPtSQd0MtKmQ6J4gfGw9guVxiwz+oBLODIRYHqvxUIMlFV35LVfeBjUmlZ/vlgkUymsngxn0afo6QX8od+M90rNyA4Ns9hEjgja68xDiAxW2HD6NSyBPQMYv0cqtYF0s4Q==
  • 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 09:38:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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:
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> I understand there's not much to say here, but the title saying just
>> "annotate" without any context as to the purpose of the annotation
>> is too little information imo. I guess this then goes for many more
>> titles in this series.
> 
> I really couldn't think of anything useful to say.  Lots of these
> patches are entirely mechanical.

Them being mechanical is imo unrelated to having a subject which is
halfway meaningful even if one looks at a shortlog in a couple of
years time. All it would take to disambiguate the titles would look
to be "...: Annotate fnptr targets for CET-IBT". Arguably this arch-
specific feature may be a little odd to encounter in common code
logs, but that's still better than being entirely unspecific about
the purpose of the annotations.

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

Jan




 


Rackspace

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