Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp733412ima; Fri, 15 Mar 2019 12:54:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvVlnyUDn+s2kR45y3DF/I20cviE5NM1NCaN99jpLR5Dn3vUKvZWm7pNFKV5U3AOA547WB X-Received: by 2002:a63:ea48:: with SMTP id l8mr4982291pgk.431.1552679659200; Fri, 15 Mar 2019 12:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552679659; cv=none; d=google.com; s=arc-20160816; b=A8jOFLtvtOUMbiNeNdcCS7sOACq+AaWMFDze+4oV/SddlAtpFH/QqFW2Kqy5tY2F7T dQKbGDxwf6fhftOMZOvk9Z3Q9aGggcBVfksQq7e0AMeATbcZFyi3YBHRod4buHzf3xdF pUK2eRQK/jgBxWlToG9Zi6a1oe5xaOun7Huww3IZ2qFO9Mugo19tdbp+VTgXOHThcVay En+NejgZjP6/b7IveNQNauPwufLJNOu71qpQk2KuIMu7FhWJe4HOX61MyTSrL7FQrGGy wu/QVDlmexcLwz00SoLUT+9S0Pgo1f4Uhs0uJZWenVkBw3e1NLOnCiGLp0ahK91JB06c v63A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=xQk3LhthwaCSqxwCcTkNdlxSKZFnDFG1SS+E3EAFA9Q=; b=0LLq/fD8SPXfcaOH2RqAyVSDGT2QkkJrw6bLmHKe1BW2ycdyK47Z+8VAF+Zkj0945Z p/vaaFmci7BLF4L7d9JfK7/TyGsckqjGxsu2Y8lKXMqgYbUx+fMbGLu1ZM2epjRsbdgm 8d4cLMB2fcpjiNOx514faxCsFoy9m5z/3aPbLO/WNZYY2nGB14Aa6Uyz0GD7NZrr9gKq oRTY+aVE0LbDbmz/L/H7KxGJzu1whsIFIHChmhZLtVsD0v9W3KE6w34U42aZ1u9mDCnI B8cxcYB0RHGj0G3UuUy6FqZMOKJTB3JM5JQYq4zDY8fA/78Xw8Zi/9ald+JsXkvdNr9c tQRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=erlzrsrP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si2650693plb.330.2019.03.15.12.54.03; Fri, 15 Mar 2019 12:54:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=erlzrsrP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbfCOTxE (ORCPT + 99 others); Fri, 15 Mar 2019 15:53:04 -0400 Received: from mail-io1-f74.google.com ([209.85.166.74]:51712 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbfCOTwQ (ORCPT ); Fri, 15 Mar 2019 15:52:16 -0400 Received: by mail-io1-f74.google.com with SMTP id k24so7785452ioa.18 for ; Fri, 15 Mar 2019 12:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=xQk3LhthwaCSqxwCcTkNdlxSKZFnDFG1SS+E3EAFA9Q=; b=erlzrsrP8VxBF8HsFBwQbTIFhbizEW/LsVQAb4sB9lxRiyqjhT4uCp2723IUY/w0as JDSkvwBZ2J/k/0Gr8MvYLy9+lPaE5Mbr5BxZqaj+B32fmuQao+20kq6UQFBqlr7iQum4 OAinUJ/2Tst5Nnic/IJVxsAPWJiUr5ue6Sg3ulcVoob/1X/OiS7RpGt905f6Qew6MgNY JEYORaq1c6WpaRg5DMZPoFljR7vI3/R+mQc61CKtUt4qxBTghm37TZV9KMnlkevHn6ql TPeg6qjkBgZQMlJkzr6XuOqDJLnou/KO5tmMMN3Tj/QArlELFQfSt7I9wSsT8s02fKRi 2vzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=xQk3LhthwaCSqxwCcTkNdlxSKZFnDFG1SS+E3EAFA9Q=; b=ppmDSUmaZf+vZZC6iBD7F4fKzhfKP9gUnCAmUQKPY/SqTJgbWLp59RJhz3/jMNTHho gJYT/D7I+uqnBjTtfND+fF4mk1rXVDNdUN2MG+SWmA4c7mZ0CSf21DF67juvBkrGR7E2 YsAO2dYCkeIl73txmi3XL4eO0L0m0L5C3xQOhBYLJ1pi86OY2h5nk5J3fFq2oqUvfUdR 9WcXxV1mBcKnzSUkIiHFXCSj4U1rEat/VWRkEZ8y0ODsB3dmmR2jWpkb0zaP/hV2lAxs IgJ+M6cbZHR6QW71BbDRndS2g9aXIv9PybiYChoc0Ntyh1eQ3K4jUBGpR4NFBDgVl9vv bR9w== X-Gm-Message-State: APjAAAWepJpQztLdrz/XFryoo8W4txI0s/k1eARID+t6+o1VyDVmTY4i gPBfB7+796kpKWqmvKlyyCqtD10cMkqqNxoB X-Received: by 2002:a24:2b45:: with SMTP id h66mr677136ita.28.1552679535681; Fri, 15 Mar 2019 12:52:15 -0700 (PDT) Date: Fri, 15 Mar 2019 20:51:34 +0100 In-Reply-To: Message-Id: <355e7c0dadaa2bb79d22e0b7aac7e4efc1114d49.1552679409.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.360.g471c308f928-goog Subject: [PATCH v11 10/14] tracing, arm64: untag user pointers in seq_print_user_ip From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Kevin Brodsky , Szabolcs Nagy , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/trace/trace_output.c | 5 +++-- p | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 p 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); } diff --git a/p b/p new file mode 100644 index 000000000000..9d6fa5386e55 --- /dev/null +++ b/p @@ -0,0 +1,45 @@ +commit 1fa6fadf644859e8a6a8ecce258444b49be8c7ee +Author: Andrey Konovalov +Date: Mon Mar 4 17:20:32 2019 +0100 + + kasan: fix coccinelle warnings in kasan_p*_table + + kasan_p4d_table, kasan_pmd_table and kasan_pud_table are declared as + returning bool, but return 0 instead of false, which produces a coccinelle + warning. Fix it. + + Fixes: 0207df4fa1a8 ("kernel/memremap, kasan: make ZONE_DEVICE with work with KASAN") + Reported-by: kbuild test robot + Signed-off-by: Andrey Konovalov + +diff --git a/mm/kasan/init.c b/mm/kasan/init.c +index 45a1b5e38e1e..fcaa1ca03175 100644 +--- a/mm/kasan/init.c ++++ b/mm/kasan/init.c +@@ -42,7 +42,7 @@ static inline bool kasan_p4d_table(pgd_t pgd) + #else + static inline bool kasan_p4d_table(pgd_t pgd) + { +- return 0; ++ return false; + } + #endif + #if CONFIG_PGTABLE_LEVELS > 3 +@@ -54,7 +54,7 @@ static inline bool kasan_pud_table(p4d_t p4d) + #else + static inline bool kasan_pud_table(p4d_t p4d) + { +- return 0; ++ return false; + } + #endif + #if CONFIG_PGTABLE_LEVELS > 2 +@@ -66,7 +66,7 @@ static inline bool kasan_pmd_table(pud_t pud) + #else + static inline bool kasan_pmd_table(pud_t pud) + { +- return 0; ++ return false; + } + #endif + pte_t kasan_early_shadow_pte[PTRS_PER_PTE] __page_aligned_bss; -- 2.21.0.360.g471c308f928-goog