Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2743793ybd; Thu, 27 Jun 2019 18:52:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdgy6ix7Fy6FZVsd8qRKy8xsDKUobWMykg7TpCLjhnFb6cj1m2pCi2SQPW2CjkeXMrntzs X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr9648506pjr.92.1561686751453; Thu, 27 Jun 2019 18:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561686751; cv=none; d=google.com; s=arc-20160816; b=r1khauiv1sWi+8aE2IkkxlwLWsIRjSCVB5PRm9ImOtKRwPh6jJqB2/el003h7JGnOW jZZtupIBvv7c8HuV0JTDx7I1GtT7D8EkDlsmLUFtty8dfwxFt2dVYZOUggQFSGLH90Y2 FxNWrbJQrt1HUAPp2CVnfJqcWKcfmH7fNV9ZJUjXEFg2PSTIqW6Rjw/1Trm/nVeFF0XL uAoy2Wfjd6/y+BJyhG2+i2Co5xdmRt7MQtKqhG0EOsnJun0Qr1i8ODKTXQmeez7A+9SH niLKvdUxT/H98ROkl9ZUwyaIRw3IzNZQ+YNuzi/9wx8XZFq2fqzkY9g3zVFeMiq/gl4k Ocqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5r3KBMvZMzm71MY3j0+zLkHiI6S4MrRtrbIx95MH8rw=; b=o4EkBUpoBTWwgNxcoEE7tB18wIwe18bGKsoEF6ow5lgguS/bJi93tqOo+ci4c8b56I 2Eg07pEGDjWk7NKgMKHRG1nKgXZBuuVcwEhidmYu+f9U5791jyuSypbT9yHCv2Un50+m xTIYm9DX+MiPPNivd5F3RXcvtHanyJ89jUcPgoFME/IE+/NhSSMGmD8oWf/nHXCGS42b a2qWJUdSeQAkd7HEUs54PJnG0ZOeeM0fuIIRwefHC0WNfLG6K9R/uc/5VSUTTBJSzkSH EP+LIg6ppX4t2hEkRFMPp7QZIZ1NFKmnxHlsUoMKb+5W+LGWzNjKTaqgyLn6mpMFyfVY n6AQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si616872plo.170.2019.06.27.18.52.15; Thu, 27 Jun 2019 18:52:31 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbfF1Bvk (ORCPT + 99 others); Thu, 27 Jun 2019 21:51:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46364 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbfF1Bvj (ORCPT ); Thu, 27 Jun 2019 21:51:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 046438666F; Fri, 28 Jun 2019 01:51:39 +0000 (UTC) Received: from treble.redhat.com (ovpn-126-66.rdu2.redhat.com [10.10.126.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D08819C70; Fri, 28 Jun 2019 01:51:35 +0000 (UTC) From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Song Liu , Kairui Song , Steven Rostedt , Thomas Gleixner , Borislav Petkov , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH v4 2/2] bpf: Fix ORC unwinding in non-JIT BPF code Date: Thu, 27 Jun 2019 20:50:47 -0500 Message-Id: <881939122b88f32be4c374d248c09d7527a87e35.1561685471.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 28 Jun 2019 01:51:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Objtool previously ignored ___bpf_prog_run() because it didn't understand the jump table. This resulted in the ORC unwinder not being able to unwind through non-JIT BPF code. Now that objtool knows how to read jump tables, remove the whitelist and annotate the jump table so objtool can recognize it. Also add an additional "const" to the jump table definition to clarify that the text pointers are constant. Otherwise GCC sets the section writable flag and the assembler spits out warnings. Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER") Reported-by: Song Liu Signed-off-by: Josh Poimboeuf --- kernel/bpf/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 7c473f208a10..45456a796d7f 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1299,7 +1299,7 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) { #define BPF_INSN_2_LBL(x, y) [BPF_##x | BPF_##y] = &&x##_##y #define BPF_INSN_3_LBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z - static const void *jumptable[256] = { + static const void * const jumptable[256] __annotate_jump_table = { [0 ... 255] = &&default_label, /* Now overwrite non-defaults ... */ BPF_INSN_MAP(BPF_INSN_2_LBL, BPF_INSN_3_LBL), @@ -1558,7 +1558,6 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) BUG_ON(1); return 0; } -STACK_FRAME_NON_STANDARD(___bpf_prog_run); /* jump table */ #define PROG_NAME(stack_size) __bpf_prog_run##stack_size #define DEFINE_BPF_PROG_RUN(stack_size) \ -- 2.20.1