Re: [PATCH v6 00/11] arm64: untag user pointers passed to the kernel

From: Andrey Konovalov
Date: Thu Aug 30 2018 - 07:48:19 EST

On Thu, Aug 30, 2018 at 1:41 PM, Andrey Konovalov <andreyknvl@xxxxxxxxxx> wrote:
> arm64 has a feature called Top Byte Ignore, which allows to embed pointer
> tags into the top byte of each pointer. Userspace programs (such as
> HWASan, a memory debugging tool [1]) might use this feature and pass
> tagged user pointers to the kernel through syscalls or other interfaces.
> This patch makes a few of the kernel interfaces accept tagged user
> pointers. The kernel is already able to handle user faults with tagged
> pointers and has the untagged_addr macro, which this patchset reuses.
> Thanks!
> [1]
> Changes in v6:
> - Added annotations for user pointer casts found by sparse.

Hi Catalin,

I've added annotations for the user pointer casts pointed by the new
sparse flag -Wcast-from-as as you asked. I've used __force casts
instead of adding specialized macros.

There are also non annotated casts for other pointer types (iomem,
rcu) which are detected with the new flag, should I annotate those as

I'm not sure though what value would that bring though, as there are
~3000 various sparse warnings produced with the default flags anyway.