Re: [PATCH 08/21] binder: keep vma addresses type as unsigned long

From: Carlos Llamas
Date: Fri Dec 01 2023 - 02:01:33 EST


On Tue, Nov 07, 2023 at 09:08:13AM +0000, Alice Ryhl wrote:
> Carlos Llamas <cmllamas@xxxxxxxxxx> writes:
> > - seq_printf(m, " size %zd:%zd data %pK\n",
> > + seq_printf(m, " size %zd:%zd data %lx\n",
> > buffer->data_size, buffer->offsets_size,
> > buffer->user_data);
>
> This changes all of the print operations to use %lx instead of %pK,
> which means that the addresses are no longer being hidden when using
> kptr_restrict.
>
> Since the pointers are all userspace pointers, it's not clear to me what
> the consequences of this are. However, I'd like to confirm whether this
> is an intentional change?

I confirm the change was intentional, we are giving the impression that
these are kernel pointers when they are not. However, I do think your
concern is valid. I've added a patch to v2 to deal with this.

I can tell you we are already logging the unhashed userspace addresses
in other places and we should probably fix those too.

--
Carlos Llamas