Re: [PATCH v10 00/12] arm64: untag user pointers passed to the kernel

From: Dave Hansen
Date: Tue Feb 26 2019 - 12:35:29 EST


On 2/26/19 9:18 AM, Andrey Konovalov wrote:
>> This seems like something
>> where we would ideally add an __tagged annotation (or something) to the
>> source tree and then have sparse rules that can look for missed untags.
> This has been suggested before, search for __untagged here [1].
> However there are many places in the kernel where a __user pointer is
> casted into unsigned long and passed further. I'm not sure if it's
> possible apply a __tagged/__untagged kind of attribute to non-pointer
> types, is it?
>
> [1] https://patchwork.kernel.org/patch/10581535/

I believe we have sparse checking __GFP_* flags. We also have a gfp_t
for them and I'm unsure whether the sparse support is tied to _that_ or
whether it's just by tagging the type itself as being part of a discrete
address space.