From patchwork Thu Nov 5 11:52:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenz Bauer X-Patchwork-Id: 11884009 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 199D1C4741F for ; Thu, 5 Nov 2020 11:53:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD94222210 for ; Thu, 5 Nov 2020 11:53:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="zGTLcxiZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730232AbgKELxP (ORCPT ); Thu, 5 Nov 2020 06:53:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730258AbgKELxL (ORCPT ); Thu, 5 Nov 2020 06:53:11 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0612C0613D3 for ; Thu, 5 Nov 2020 03:53:10 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id g12so1409521wrp.10 for ; Thu, 05 Nov 2020 03:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GXF1SqOriWJ7aOraSXefzzIqR43tkx0ONzj50WfCuDg=; b=zGTLcxiZZV78qsG3GcPQhbs6hZm9UW+qwSl1J9Rc4mi0VpXJEpe9I/xGZ+PmvUDj1Q eHQEBduQhpnLeffenHiQUpr7Psk+RKNcSMVhvUv/VE2CgLiGsalgOjAVXwPl3lzVxLgk ysd/6nRrijW0em5Tj92Aku24eVxfTorX8oNkY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GXF1SqOriWJ7aOraSXefzzIqR43tkx0ONzj50WfCuDg=; b=DXCW9NfqzD0zqMISka0vEihHPP5uFtx17J5zhj82A9Edf5MHinn/OhuIr01qcaK04l ghQ3WHSI9n/QEgwa7xoHcVKuSbBHWAIgbpJYYmFrNGi+DWNCgs4EcOavb6Eig1wUvAU4 J2ujrkx3K9gkaFTsqeivNVvyYqfE7Cp2Wsblyd3DP8xV+GgW9iwAH9lup/JwxFGIU5lG UDmP1lR6Jb4z+xSooxtG/ABJnMA/+ymc9Fhq9HYS1PobtO2CLrNN9h+ojKT2Sxf/wQ9s BiRZeBBkd44OA7rBShqv5jRnPo+cqMtaRYsHyDZyDPY4QPm3v1YY62NRGAWPDzezH6Yd c2Uw== X-Gm-Message-State: AOAM532zzQdaO59xBi1d+qnRgUhqD2r510mlEvF7EodFpn8utoTGBP7S NCTlJp3uKlStzNuY/VMRiyMRZw== X-Google-Smtp-Source: ABdhPJzzNkmxfb9gJuURyKkFNJ0rPyrbz1mHyaZcFFdgejmsCf3LvQME3YFn2QGfmCcxQxs7+t/AEg== X-Received: by 2002:a5d:4207:: with SMTP id n7mr2466805wrq.76.1604577189172; Thu, 05 Nov 2020 03:53:09 -0800 (PST) Received: from antares.lan (b.f.7.4.3.0.f.a.d.b.3.c.e.c.d.3.f.f.6.2.a.5.a.7.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:7a5a:26ff:3dce:c3bd:af03:47fb]) by smtp.gmail.com with ESMTPSA id r10sm2264214wmg.16.2020.11.05.03.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 03:53:08 -0800 (PST) From: Lorenz Bauer To: Alexei Starovoitov , Daniel Borkmann , Lorenz Bauer Cc: kernel-team@cloudflare.com, Jiri Benc , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf] tools/bpftool: fix attaching flow dissector Date: Thu, 5 Nov 2020 11:52:30 +0000 Message-Id: <20201105115230.296657-1-lmb@cloudflare.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net My earlier patch to reject non-zero arguments to flow dissector attach broke attaching via bpftool. Instead of 0 it uses -1 for target_fd. Fix this by passing a zero argument when attaching the flow dissector. Fixes: 1b514239e859 ("bpf: flow_dissector: Check value of unused flags to BPF_PROG_ATTACH") Reported-by: Jiri Benc Signed-off-by: Lorenz Bauer Acked-by: Song Liu --- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index d942c1e3372c..acdb2c245f0a 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -940,7 +940,7 @@ static int parse_attach_detach_args(int argc, char **argv, int *progfd, } if (*attach_type == BPF_FLOW_DISSECTOR) { - *mapfd = -1; + *mapfd = 0; return 0; }