From patchwork Fri Mar 15 19:51:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10855525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88F0C13B5 for ; Fri, 15 Mar 2019 19:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 738052AC54 for ; Fri, 15 Mar 2019 19:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65DA12AC57; Fri, 15 Mar 2019 19:52:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D702AC54 for ; Fri, 15 Mar 2019 19:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727530AbfCOTwT (ORCPT ); Fri, 15 Mar 2019 15:52:19 -0400 Received: from mail-it1-f201.google.com ([209.85.166.201]:35804 "EHLO mail-it1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727502AbfCOTwQ (ORCPT ); Fri, 15 Mar 2019 15:52:16 -0400 Received: by mail-it1-f201.google.com with SMTP id o68so2064370itb.0 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=XnWEJF+GN4CRUdp0nztSXj4ysWyqtycKttJTOGVA6f9xATsDOwe/Fs5n0Dxv1uwRuv rorfZ1fbt5AjIqo79iI/9qOQXJ0zag6FsZRqIY323+gXVYHvucjqklSN3Z+pGCaOQV6S kK9LPCqgrGoVeQYep/bYnnku8zKpsPH14UCT/AtwubXu6offFUmyG/P+57k2HWqkUTni Is40y2xZKEb7lxQja+R6+qNWI0cQg6wjDC1eIGim9p6QAXqJEdwAL4d6e2Gx4C8qLnvi 9bDEyCnmx+8fPBOrgFbj6ADZERPvd0t9FaOwEiNy9xdSODnUfyrW0llOvN0T+bo1/smE vt+w== X-Gm-Message-State: APjAAAU7f+EDqLf2ZWhma/b4MhXdyDdRiFpJRuC+81DJPjYprZYXSQZs nTCdZz8urmCGn4SOJFkP9uv3t3GK69J/xgVB X-Google-Smtp-Source: APXvYqz+GmruJTwbh+y6ScEKk8ZO6w3sULpD4k9iq4Qem8c0s9TmhOALFGnTHkcM6tlN06h5Rlqmfno2APVO8t8L 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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;