Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5926898ybl; Tue, 10 Dec 2019 13:54:42 -0800 (PST) X-Google-Smtp-Source: APXvYqx8TVBoZ0jnbCqt+1hbSzlecv2NhDrkawETzVSRe/QD+fJspADb31ummINju95HRUwvbeDO X-Received: by 2002:aca:a9cc:: with SMTP id s195mr172405oie.158.1576014882262; Tue, 10 Dec 2019 13:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576014882; cv=none; d=google.com; s=arc-20160816; b=BC6Gdq1eC8/KEC0jWFTDvYhQx++YVOJrAW5QgnS7xoPPS+s1jIq21xQpa6BkFgY3wl VaDn7sYBzjOEHRwYrEGIw7Xhql7mNBYUrfGMBZxvj3X7gOPCi8XV3OoAAAL3PSEy9b96 tspDQJ9gGFZxP6V25Nt9pwd+T9sYF3zJOx5pcgWOK4PJGrTVxEZvEgxA2BbWA3SRx3nX tyzc2ZA5NMlu7/3jR95vOobiUqD6oIANyoYOyiMv/Evyq4wECiv1HWun7GiWUPWaCYcF q1JrL9O8lGhNicUd+fQ85PCnHLCeEZiixpd5MO3gEcRm1R7rPsyHTETHkZGPpU1svyO/ 02vw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=x1llI4VQgR/NNv9VK0TWAuEng4/7tgvnedskGQElizQ=; b=tDzUqoUOptZCc/UR68LvJY3XWMdQMusC9w89LsABh0S9c0iBP0Tx0cHJe15WBTaTzM axjl4MPpFgBr/zzz3NyuTUkkQadDzTuYyeiOhb6eI6/hlJ+Omu4oYqftj80fH3o2cMD8 a4IX3Kr0kTNniJ9/O215uC5OV8yCb0tu5CLPY0gFfoZzFXl/fYJ0SdyaUoaRDQsNztI6 VrafmBySFTdPbtP4olkEQHqOfHXoqqc9IbosueDxUxLrw/5rP2nk5z/ckeeLKtMfDt1u sa5C6JRgGIuWGGKBD8HwVJDSgJLIqS6vO7ETZE16ScBPAcwtfyY0voTjgsZdTCmOs/mB GEBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="TN/QOr87"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si2746402otr.178.2019.12.10.13.54.29; Tue, 10 Dec 2019 13:54:42 -0800 (PST) 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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="TN/QOr87"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbfLJVwN (ORCPT + 99 others); Tue, 10 Dec 2019 16:52:13 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33514 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729780AbfLJVwK (ORCPT ); Tue, 10 Dec 2019 16:52:10 -0500 Received: by mail-pg1-f196.google.com with SMTP id 6so9542004pgk.0 for ; Tue, 10 Dec 2019 13:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=x1llI4VQgR/NNv9VK0TWAuEng4/7tgvnedskGQElizQ=; b=TN/QOr87yPqhW/2lzNiPS+Jz3xhAwg45MFbe+8DISDcdLzuEBd561ejk5h0oCDb20M cyLB2KMxESf4Ub5nYgtAAseJcF8JrG2TpoOOK8qfqxLY6L6KKBaLA7FApvFfMTJYJ/nD rzvsG3Hy5V1bVEoDwP+bo3VLKfoUq4aXJ0+Xo3Cp173dvNPBZF+DAqX8e0nbD2CZKk9O p8kMwBsQHh50nLmmwHguAwJKH8eve5hwTsj2EHRkq2Yn4/MIPkhixNEv6PV5mPIdAWdX BfndNieAlydYIPORzdzVGct5J8O1VK1nNaPidFt04JpeZqNZDd0NoNb9YkalSivZSsmd CHKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=x1llI4VQgR/NNv9VK0TWAuEng4/7tgvnedskGQElizQ=; b=tH+G/j6RbBvbksIQ/e219BV8vqD3JrN7forRcm9ebS0zV1HGekGJDZAN9VHaOJdHH/ s/uYUTFqWGzy57YADRgPU94KkyPuOc0OsWf+PoNVsOf2t86MMMmSZGuc1G1ohL4wdIk8 dm3nw/ob+kdo49StCU8kJbJv7zqMIdofMzpQbR/eI0q/zquu7Ud8fgOD0gQJ29g9L0Ie BwVlnjiULrMN8LNBVET8b3PwPYefL67VxFHsHCx9Xkh9XhZ/Jy88PvFP5YGA9LHdw6bw Sn0q1gC82+Ji0loTRneB7U7lH9IR7qBpPlIG3A/5SVP6DgNUb14JjBkyXBnkOZnGYAFx Oa7A== X-Gm-Message-State: APjAAAVJm4ib1Gbals3b0+PonZ/8KslhQuceHkuEypfIHoJmEtFnj55B Y/YeIyZTHkQ+jpwh8u0EwPMOvw== X-Received: by 2002:a63:213:: with SMTP id 19mr329909pgc.160.1576014729720; Tue, 10 Dec 2019 13:52:09 -0800 (PST) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id z13sm3865986pjz.15.2019.12.10.13.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 13:52:09 -0800 (PST) Date: Tue, 10 Dec 2019 13:52:05 -0800 From: Jakub Kicinski To: Alexei Starovoitov Cc: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , Daniel Borkmann , lkml , netdev@vger.kernel.org, bpf@vger.kernel.org, Martin Lau Subject: Re: [PATCH bpf v2] bpftool: Don't crash on missing jited insns or ksyms Message-ID: <20191210135205.529044a4@cakuba.netronome.com> In-Reply-To: <20191210213148.kqd6xdvqjkh3zxst@ast-mbp.dhcp.thefacebook.com> References: <20191210181412.151226-1-toke@redhat.com> <20191210125457.13f7821a@cakuba.netronome.com> <87eexbhopo.fsf@toke.dk> <20191210132428.4470a7b0@cakuba.netronome.com> <20191210213148.kqd6xdvqjkh3zxst@ast-mbp.dhcp.thefacebook.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Dec 2019 13:31:50 -0800, Alexei Starovoitov wrote: > On Tue, Dec 10, 2019 at 01:24:28PM -0800, Jakub Kicinski wrote: > > On Tue, 10 Dec 2019 22:09:55 +0100, Toke H=C3=B8iland-J=C3=B8rgensen wr= ote: =20 > > > Jakub Kicinski writes: =20 > > > > On Tue, 10 Dec 2019 19:14:12 +0100, Toke H=C3=B8iland-J=C3=B8rgense= n wrote: =20 > > > >> When the kptr_restrict sysctl is set, the kernel can fail to return > > > >> jited_ksyms or jited_prog_insns, but still have positive values in > > > >> nr_jited_ksyms and jited_prog_len. This causes bpftool to crash wh= en trying > > > >> to dump the program because it only checks the len fields not the = actual > > > >> pointers to the instructions and ksyms. > > > >>=20 > > > >> Fix this by adding the missing checks. > > > >>=20 > > > >> Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen = =20 > > > > > > > > Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool") > > > > > > > > and > > > > > > > > Fixes: f84192ee00b7 ("tools: bpftool: resolve calls without using i= mm field") > > > > > > > > ? =20 > > >=20 > > > Yeah, guess so? Although I must admit it's not quite clear to me whet= her > > > bpftool gets stable backports, or if it follows the "only moving > > > forward" credo of libbpf? =20 > >=20 > > bpftool does not have a GH repo, and seeing strength of Alexei's > > arguments in the recent discussion - I don't think it will. So no > > reason for bpftool to be "special" =20 >=20 > bpftool always was and will be a special user of libbpf. There we go again. Making proclamations without any justification or explanation. Maybe there is a language barrier between us, but I wrote the initial bpftool code, so I don't see how you (who authored one patch) can say what it was or is. Do you mean to say what you intend to make it? bpftool was intended to be a CLI to BPF _kernel_ interface. libbpf was just the library that we all agreed to use moving forward for ELF loading. I'm not going to argue with you again. You kept bad mouthing iproute2 and then your only argument was the reviews sometimes take longer than 24 hours. Which I'm sure you have a lot of experience with: iproute2$ git log --author=3DStarov --oneline=20 4bfe68253670 iptnl: add support for collect_md flag in IPv4 and IPv6 tunnels iproute2$ git log --author=3Dfb.com --oneline=20 3da6d055d93f bpf: add btf func and func_proto kind support 7a04dd84a7f9 bpf: check map symbol type properly with newer llvm compiler 73451259daaa tc: fix ipv6 filter selector attribute for some prefix lengths 0b4ea60b5a48 bpf: Add support for IFLA_XDP_PROG_ID 4bfe68253670 iptnl: add support for collect_md flag in IPv4 and IPv6 tunnels 414aeec90f82 ss: Add tcp_info fields data_segs_in/out 409998c5a4eb iproute: ip-gue/ip-fou manpages Upstreaming bpftool was a big mistake, but we live and we learn.