[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 04/65] x86/hypercall: Annotate fnptr targets
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |