Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5907767ybl; Tue, 10 Dec 2019 13:33:16 -0800 (PST) X-Google-Smtp-Source: APXvYqypXHbBt3BpQs+jFwNKErIVormqcaM6ZjALaEXIUNZmwSGL7NDfezOp2cMOA3p5cuq4RFGy X-Received: by 2002:aca:6186:: with SMTP id v128mr91885oib.17.1576013596214; Tue, 10 Dec 2019 13:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576013596; cv=none; d=google.com; s=arc-20160816; b=pDG48qMcVq9I6i/dhBodihH/lmqebgo8sKzkQYUPUh2MCczfz/wqH6HXfC4cZyyDGe hD4mC1Eoo7YpHbW+JWui3y+NJePNT4zaoTB6XcTpMQybIYBRKapPuDCY09QW+wE9dNhW 7uP/bYtehzVwlX+1YoKSMD8JzsrCm1G6CAAssK8AFbWQKtO2NCWUv6XT+z41q/GbU3Zj bS9Fabd66d+6wKuiQrKRhIDwrPwmZ02vrjtKDEnBBP3so7F+k3gEvop9dip03yKkayhR k9ENxbFW5HJovHPuKLg/kgtP7RctyQw97T2NhnjNxloDvv1Y/p5pfKYgZqWT04w1lk8o IfQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WtDhoZ5ivvcVrikLoCcOpbuCN5K2xI6ePb8PHhBX/qY=; b=Snp65VEfnfZK/mtcqj7fhs47wb9csNz3cxdiwCRXoF2xCQDeUO+4tCxNfECiVDy+DS 298UuXgRqfym7aOwXgtuMzN4Hdl1GWLnI7UDyYGAd1xO9S2DpG0gVUeeaduGddoZe7tu UJmJKZ1PJPYOp0QpP9ckODB9TKHXIAKHD7lUl5avYxqLNxmhmesVPk2/db2HCjyUEcTi znLR3sp0Y+SyTBYgXeWVC2T3mT2ZVV65btIIwQ7SgbUSESirDraU2xQRUg8JN7eQ1g90 1Qhsg+++4ITpiJWY1VR6yIkpPm6kABmtA+Bx8XyyxXRR1A52cxFT3M7xG27VoMmcbWCZ 0YSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bNBHfHD0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190si2601479oib.113.2019.12.10.13.33.04; Tue, 10 Dec 2019 13:33:16 -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=@gmail.com header.s=20161025 header.b=bNBHfHD0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbfLJVb5 (ORCPT + 99 others); Tue, 10 Dec 2019 16:31:57 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39079 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727166AbfLJVbw (ORCPT ); Tue, 10 Dec 2019 16:31:52 -0500 Received: by mail-pl1-f193.google.com with SMTP id o9so376161plk.6; Tue, 10 Dec 2019 13:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=WtDhoZ5ivvcVrikLoCcOpbuCN5K2xI6ePb8PHhBX/qY=; b=bNBHfHD03h3hmMV1w1mftAhHlsANzeRmCm5ntICoRhmQwAgj90TCYu0exwqE/pdhgE GdNZfSlxmS9+MnUMV7dWFoxBeYeAAQf7p2crlgBjwXDwXG1sXMJ6b1MjtryjbQIVfa8o 1SX/XqQOGXbyT71gHQYIa2IRm8lwQVeIcfLSC6L0EJSb4weQ0dZWQ4IVIG1HfR5u32U9 aDDBA5mO5vSpt3tWu9JReI7ZfKo8J0rhq/a1azkAzqGLiHXA4pg5d+2U8UoGB8QCy25N AU5WmUYt1keRgOs0PN80AM32Fz5sEXch3w0CfnU5IBM5wCHJ0QTur7PEqplqQGIDlFXt Nzbw== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=WtDhoZ5ivvcVrikLoCcOpbuCN5K2xI6ePb8PHhBX/qY=; b=PthU7trMwPI5ZXqCmeKtyLsdZcrh3Vdx/4PWVmPDTk7pykpqLeJ5f6edfbu68Pgu// mvHgnVpqNyt7vc5pFeIVCFqV00U0W4yyQNZC/RiqTcY+fOvhUN7rK8PwU1B/yuG9wA3w rV7LU7w/C7tG9oJE/++LjXGJ1c5hhUWl/M3uraws3F6+XaTeXA4toUyKohpEQlxW0dfo 5NAHc+qnOSBc7Gj7w+9EA9/qCt+TF+RGhK2wiOBTwzqHkZrs92X0Nv/7nhVQ/g1WMr+L mykBDZafrk6q1+OkV+Tm4HZWQ6rUEWUJUZGs/ss7CHBHatziXGQbm0IPSzO8cMJeOVdH +N2g== X-Gm-Message-State: APjAAAVM48o/V+aK1nBZihPzmCeW8GgP+hTYVksQKsUtqqvIEYXNJfjr WdiAOY3Ro7Gfmpgp1PzWeE4= X-Received: by 2002:a17:90a:8986:: with SMTP id v6mr7783380pjn.63.1576013511889; Tue, 10 Dec 2019 13:31:51 -0800 (PST) Received: from ast-mbp.dhcp.thefacebook.com ([2620:10d:c090:200::3:a25c]) by smtp.gmail.com with ESMTPSA id o3sm3613026pju.13.2019.12.10.13.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2019 13:31:51 -0800 (PST) Date: Tue, 10 Dec 2019 13:31:50 -0800 From: Alexei Starovoitov To: Jakub Kicinski Cc: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , 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: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191210132428.4470a7b0@cakuba.netronome.com> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 01:24:28PM -0800, Jakub Kicinski wrote: > On Tue, 10 Dec 2019 22:09:55 +0100, Toke H?iland-J?rgensen wrote: > > Jakub Kicinski writes: > > > On Tue, 10 Dec 2019 19:14:12 +0100, Toke H?iland-J?rgensen wrote: > > >> 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 when trying > > >> to dump the program because it only checks the len fields not the actual > > >> pointers to the instructions and ksyms. > > >> > > >> Fix this by adding the missing checks. > > >> > > >> Signed-off-by: Toke H?iland-J?rgensen > > > > > > Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool") > > > > > > and > > > > > > Fixes: f84192ee00b7 ("tools: bpftool: resolve calls without using imm field") > > > > > > ? > > > > Yeah, guess so? Although I must admit it's not quite clear to me whether > > bpftool gets stable backports, or if it follows the "only moving > > forward" credo of libbpf? > > 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" bpftool always was and will be a special user of libbpf.