On Fri, Mar 22, 2019 at 4:45 PM Catalin Marinas catalin.marinas@arm.com wrote:
On Wed, Mar 20, 2019 at 03:51:25PM +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.
seq_print_user_ip() uses provided user pointers for vma lookups, which can only by done with untagged pointers.
Untag user pointers in this function.
Signed-off-by: Andrey Konovalov andreyknvl@google.com
kernel/trace/trace_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 54373d93e251..6376bee93c84 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -370,6 +370,7 @@ static int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm, { struct file *file = NULL; unsigned long vmstart = 0;
unsigned long untagged_ip = untagged_addr(ip); int ret = 1; if (s->full)
@@ -379,7 +380,7 @@ static int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm, const struct vm_area_struct *vma;
down_read(&mm->mmap_sem);
vma = find_vma(mm, ip);
vma = find_vma(mm, untagged_ip); if (vma) { file = vma->vm_file; vmstart = vma->vm_start;
@@ -388,7 +389,7 @@ static int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm, ret = trace_seq_path(s, &file->f_path); if (ret) trace_seq_printf(s, "[+0x%lx]",
ip - vmstart);
untagged_ip - vmstart); } up_read(&mm->mmap_sem); }
How would we end up with a tagged address here? Does "ip" here imply instruction pointer, which we wouldn't tag?
Yes, it's the instruction pointer. I think I got confused and decided that it's OK to have instruction pointer tagged, but I guess it's not a part of this ABI relaxation. I'll drop the patches that untag instruction pointers.