Re: [PATCH v2 1/3] bcm-vk: add bcm_vk UAPI

From: Kees Cook
Date: Thu Aug 20 2020 - 16:55:27 EST


On Thu, Aug 20, 2020 at 09:37:46AM -0700, Scott Branden wrote:
> On 2020-08-19 12:00 a.m., Greg Kroah-Hartman wrote:
> > On Tue, Aug 18, 2020 at 05:35:04PM -0700, Scott Branden wrote:
> >>
> >> On 2020-08-18 10:44 a.m., Greg Kroah-Hartman wrote:
> >>> On Tue, Aug 18, 2020 at 10:23:42AM -0700, Scott Branden wrote:
> >>>>>> +#define VK_FWSTS_RELOCATION_ENTRY BIT(0)
> >>>>> <snip>
> >>>>>
> >>>>> I thought BIT() was not allowed in uapi .h files, this really works
> >>>>> properly???
> >>>> I did some investigation and it looks like a few other header files in include/uapi also use the BIT() macro:
> >>>> include/uapi/misc/uacce/uacce.h
> >>>> include/uapi/linux/psci.h
> >>>> include/uapi/linux/v4l2-subdev.h
> >>> Does the header install test target now fail for these?
> >> I do not understand the question above.  make headers_install works.
> >> But I guess the above headers would have similar issue with the BIT macro.
> > Try enabling CONFIG_UAPI_HEADER_TEST and see what happens :)
> I enabled CONFIG_UAPI_HEADER_TEST and then
> built using "make" and "make headers_install".
>
> There didn't appear to be any issue with the BIT macro in the headers.

FWIW, other subsystems have not been so lucky:

https://git.kernel.org/linus/23b2c96fad21886c53f5e1a4ffedd45ddd2e85ba

It may just be better to avoid BIT(), even if it works "by accident"(?)
for some header combinations...

--
Kees Cook