Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp733183ima; Fri, 15 Mar 2019 12:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1QBLThYl7VyGPAQZdgePZvdMSPjtTDHyRddtvZgVJVvqnPW39jLVz2uokuyscplAfjgi2 X-Received: by 2002:a62:5142:: with SMTP id f63mr3590465pfb.57.1552679637422; Fri, 15 Mar 2019 12:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552679637; cv=none; d=google.com; s=arc-20160816; b=wrwDpfuDtqBU38nsVqbdApDyOO3sCCSoEWr34V5sVm8GUa7DgWLL8AGHaYe0PQLog0 lMPjjTj/X+n/i75V64cTvIH7mIoBmUW27OdM2AuKPAPep2cEb9opTzYghIpPewzeup58 mBW3yMYNs0t6gbPs4rb00iYVuKS3YEzIMUYW5lGrVsqiK+VHSdBKUbuthzQw1CIDhDMc svz7JDuUm3iegwf4bpAS2N1WcquFmIJXHUxRKE0bABr15McqBkYh/AQCSQYbmXsLmwoR 7xMcrH2s+l+oIkxvaDhY0v7ddDxzgNRwnbjINxNo5A/mfoulMsmlZsOm7R/tyJXKR5FA 88Ww== 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=UI7aEl8s0mFedqqMgOc8iwA/qQRORzYcgfY9MOX1Q3Q=; b=UZEB8tp4x1UfPVQZDIP8naV84gIM0o48b6qmv8ztcGttFn7SDfdjsqyhdQf8ZKvuA4 4FaxoVQ4jzFB0VJtm8nAKnhCdfVkJVIlQ/aPBXAw9wcm2I2sRkUGshoXQkydXVJDSO5B NxRcrzBe8s1xF2jIDtoB65ymdOMsvIAG/UMGNxPc/Rq6hJbCvG+dlwLPjDc3UH9RuS3u IkmDhu/rkON267S5Cl6HGezIIZLR9ZZ1X1BriOgug2GQt9DQAzu6VA3aneTVa/192JbZ KSNyHCjXPwRdgPTGB/ktF51U3S4/qxh/nCUOKcj9QUzkCGdBCyQP8Kwo56gj7RytD7jD s6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vfItA5WB; 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 s89si2765571pfa.33.2019.03.15.12.53.41; Fri, 15 Mar 2019 12:53:57 -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=vfItA5WB; 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 S1727640AbfCOTwp (ORCPT + 99 others); Fri, 15 Mar 2019 15:52:45 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:36158 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbfCOTwX (ORCPT ); Fri, 15 Mar 2019 15:52:23 -0400 Received: by mail-yw1-f73.google.com with SMTP id o66so13196276ywc.3 for ; Fri, 15 Mar 2019 12:52:22 -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=UI7aEl8s0mFedqqMgOc8iwA/qQRORzYcgfY9MOX1Q3Q=; b=vfItA5WBR9mxsOR5v/mXd6WRiw4qlJltvNcK03CJ3M5tD9oVwrnLXYPI73iFuFVvAy bStP8xOii4yXjBbLTiAyKSB+txWVCS5HbLg7oCB6RFMjQ5I07jr4SiImmyWLTfMKN0Vo z36zX4CJInXJMuVWsluFJtX4mg9tVYzK2laFJNn9axSKJXusl77n+y3QdI2KYR44uRZK TdwpdeFyx3tJBo/3IPC6BPg3PY4+1i133Q8TRIUuSaS8J+5QIn7rjJkfF42EQR9AUQXB a+dyvkdV6VlmT38t3+1yugNVaOElo8rNqqI8UQ90j7irslaNCh2z5PcCU9Uzw8Cc9GWC No2Q== 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=UI7aEl8s0mFedqqMgOc8iwA/qQRORzYcgfY9MOX1Q3Q=; b=E2lU/r3Gq+Kp3OlYGt7C2cJ+OXMoGt4wWl/ky7a5mUppx3o7tjjHH9U69TBxwgsXiI v01xoEdrInmwMgn7CgnIhb7FO7V6eyNnjejjvkIyG5d9F2ZI4cEg5WUOMnlcWGoXUpcz ImDaUbNOLFIde/e8WgQboCqadvqYSlpYpZnBq6XNWcBMJqh/1mrJx28bfKRxJlMosHHG OOz//oD4RCNuY1JYviwYx9wb03VnUwsS6VZKZF30RDY7tjGjm2UKITLNG2ru1CQoURj/ freV+TNNR8vPGdL/vW0lQEwsgJ0q0KNpiqliE1ZxjlNGQ4nrGKMeCUX9+iodrzokVm7D GRwQ== X-Gm-Message-State: APjAAAWUbVGQXlx6SBOM5N2DVdndjgMKx2GQMXPkaILEYVrQURthj9iz jWgz41u5aiHtelUQY87AiHjbAUabqsvV0/Bg X-Received: by 2002:a5b:44e:: with SMTP id s14mr2709444ybp.100.1552679541907; Fri, 15 Mar 2019 12:52:21 -0700 (PDT) Date: Fri, 15 Mar 2019 20:51:36 +0100 In-Reply-To: Message-Id: <0e1bd7fbde338061ea54234b3b1bd5ab6102381e.1552679409.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.360.g471c308f928-goog Subject: [PATCH v11 12/14] bpf, arm64: untag user pointers in stack_map_get_build_id_offset 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. stack_map_get_build_id_offset() uses provided user pointers for vma lookups, which can only by done with untagged pointers. Untag the user pointer in this function for doing the lookup and calculating the offset, but save as is into the bpf_stack_build_id struct. Signed-off-by: Andrey Konovalov --- kernel/bpf/stackmap.c | 6 ++++-- p | 45 ------------------------------------------- 2 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 p diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index 950ab2f28922..bb89341d3faf 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -320,7 +320,9 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, } for (i = 0; i < trace_nr; i++) { - vma = find_vma(current->mm, ips[i]); + u64 untagged_ip = untagged_addr(ips[i]); + + vma = find_vma(current->mm, untagged_ip); if (!vma || stack_map_get_build_id(vma, id_offs[i].build_id)) { /* per entry fall back to ips */ id_offs[i].status = BPF_STACK_BUILD_ID_IP; @@ -328,7 +330,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE); continue; } - id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i] + id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + untagged_ip - vma->vm_start; id_offs[i].status = BPF_STACK_BUILD_ID_VALID; } diff --git a/p b/p deleted file mode 100644 index 9d6fa5386e55..000000000000 --- a/p +++ /dev/null @@ -1,45 +0,0 @@ -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