Message ID | 665632a911273ab537ded9acb78f4bafd91cbc19.1553093421.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: untag user pointers passed to the kernel | expand |
On Wed, Mar 20, 2019 at 03:51:32PM +0100, Andrey Konovalov wrote: > This patch is a part of a series that extends arm64 kernel ABI to allow to > pass tagged user pointers (with the top byte set to something else other > than 0x00) as syscall arguments. > > check_mem_type() uses provided user pointers for vma lookups (via > __check_mem_type()), which can only by done with untagged pointers. > > Untag user pointers in this function. > > Signed-off-by: Andrey Konovalov <andreyknvl@google.com> > --- > drivers/tee/optee/call.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c > index a5afbe6dee68..e3be20264092 100644 > --- a/drivers/tee/optee/call.c > +++ b/drivers/tee/optee/call.c > @@ -563,6 +563,7 @@ static int check_mem_type(unsigned long start, size_t num_pages) > int rc; > > down_read(&mm->mmap_sem); > + start = untagged_addr(start); > rc = __check_mem_type(find_vma(mm, start), > start + num_pages * PAGE_SIZE); > up_read(&mm->mmap_sem); I guess we could just untag this in tee_shm_register(). The tag is not relevant to a TEE implementation (firmware) anyway.
On Fri, Mar 22, 2019 at 5:22 PM Catalin Marinas <catalin.marinas@arm.com> wrote: > > On Wed, Mar 20, 2019 at 03:51:32PM +0100, Andrey Konovalov wrote: > > This patch is a part of a series that extends arm64 kernel ABI to allow to > > pass tagged user pointers (with the top byte set to something else other > > than 0x00) as syscall arguments. > > > > check_mem_type() uses provided user pointers for vma lookups (via > > __check_mem_type()), which can only by done with untagged pointers. > > > > Untag user pointers in this function. > > > > Signed-off-by: Andrey Konovalov <andreyknvl@google.com> > > --- > > drivers/tee/optee/call.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c > > index a5afbe6dee68..e3be20264092 100644 > > --- a/drivers/tee/optee/call.c > > +++ b/drivers/tee/optee/call.c > > @@ -563,6 +563,7 @@ static int check_mem_type(unsigned long start, size_t num_pages) > > int rc; > > > > down_read(&mm->mmap_sem); > > + start = untagged_addr(start); > > rc = __check_mem_type(find_vma(mm, start), > > start + num_pages * PAGE_SIZE); > > up_read(&mm->mmap_sem); > > I guess we could just untag this in tee_shm_register(). The tag is not > relevant to a TEE implementation (firmware) anyway. Will do in v14, thanks! > > -- > Catalin
diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index a5afbe6dee68..e3be20264092 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -563,6 +563,7 @@ static int check_mem_type(unsigned long start, size_t num_pages) int rc; down_read(&mm->mmap_sem); + start = untagged_addr(start); rc = __check_mem_type(find_vma(mm, start), start + num_pages * PAGE_SIZE); up_read(&mm->mmap_sem);
This patch is a part of a series that extends arm64 kernel ABI to allow to pass tagged user pointers (with the top byte set to something else other than 0x00) as syscall arguments. check_mem_type() uses provided user pointers for vma lookups (via __check_mem_type()), which can only by done with untagged pointers. Untag user pointers in this function. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- drivers/tee/optee/call.c | 1 + 1 file changed, 1 insertion(+)