Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp667778yba; Fri, 12 Apr 2019 11:10:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCeUvRZwF3Jhg2d3BjLjkAFICcY/lZQYHqaj9Vq3LvlebJLfo6ojoLh1ntGCGGyMkvfDe0 X-Received: by 2002:a65:62c3:: with SMTP id m3mr54295879pgv.159.1555092603378; Fri, 12 Apr 2019 11:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555092603; cv=none; d=google.com; s=arc-20160816; b=eyNjwqf0LiYksfcxHtdH9elkagyMX7Lm9dd+Mq9VS14Vc+Uqb1RgsDcep0FysIGdoF f68RrG0hl2t3jMUmNChBnbNjcCVBm5WzGCiIihZFXgsZG9f1MgwU3QFwenYxzRESoi3z 2lahHofPx0hFIbz6anrdcGAqyydJsMIOY7yOrEpg6hCSJAj8fOl8T/nkjCjAehvCFvha L44H4yGNLdi71kqOHW7Ia8FNEA7dEO4h/dS8I2B2qtmCGPp1VS2f2XDht6cG0DRxICHH Upx3Aon5o2s58jo7pKvqeGlysD+3amGRwMuNNZ5zqDLbSuXdsOCGq8jaMvof1sUV71WT G1Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pp9ClMaBMXR/SmhwrxlZqs/SXnIO6aLteUAuDWQUrl4=; b=B2CYHwU+neffFs+DLwPoKWuspTvw4DyVm1SWF3E2AvWlLwFRhCfkAo+O+sAX6VqXZh PNe0MGO4Z1fj/GFj3/iV8zUyfsxlHvRp+hSNrrfgTNrFnWGJKj1bwqhpioMeit0MH1MS xrkIezS1UpiRpOmlwBo/sfAXgrOthXEOgrcCiNEIcw/Pc+ARvWzbUKD6vJCqRK3zZ5e2 u3CABjcO6hy5mMBHf1k9fHH06QxJb3xrVAJ4thrD7wAT29lxDEueeflUE2sYEWjN//t4 zU8ZkE+ycFYjdwmHkFfUzunDCidRkJchqbZjdOmbAJe+Kw/ixxq6V92w9V729oaGx0TM RWFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eHixQhHw; 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 q61si39583985plb.245.2019.04.12.11.09.46; Fri, 12 Apr 2019 11:10:03 -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=@gmail.com header.s=20161025 header.b=eHixQhHw; 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 S1726926AbfDLSHq (ORCPT + 99 others); Fri, 12 Apr 2019 14:07:46 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46284 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726685AbfDLSHq (ORCPT ); Fri, 12 Apr 2019 14:07:46 -0400 Received: by mail-qt1-f196.google.com with SMTP id z17so12215763qts.13; Fri, 12 Apr 2019 11:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pp9ClMaBMXR/SmhwrxlZqs/SXnIO6aLteUAuDWQUrl4=; b=eHixQhHw8Ps0tY3JzGNX4Oox6mL596mtYp6fPgksOLoa6Gke74ltjf3kso3o004VRF R7j/TOg6DhnGSocSqBxADitmtOrj6LfhtUOJeBSl8XQ9InXd/Qar146t9jbhVwCLNhQH Aqs88wrUCMkJ/ikvDprJawyJxeTZKHdM4al4YdilpGS1zoEMSks4QEE+aW+mdvmlKaPy Ca7xgqYfhT9hXkd2gH46yXTqVzdVlwghiiDesUBd9Eq4nF/cEosrPOtGEhJU9F0EFWAx QHxwAm33Dgr3CfMh5AtsPhzGTWf53s3dSf0NqkWrbl1FYsVpY//Qt9oeUDIGqljmswn1 ThfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pp9ClMaBMXR/SmhwrxlZqs/SXnIO6aLteUAuDWQUrl4=; b=ZkIt2TZQEbysCGiFQ0xL2NnBEHIQOYL/8JFFO4NBIFt+CgSsHkXGnP8AAcWr22WW/j RknKXetcfcLqrA9WATVZlLVJZt86ta7/zQo0OgskZH9oLpV+J7HBto66M47ChXSPh+OB OAZ+8x39Esmv6J9DquYZiyLZumO+IkGMOOtA2n/4imdzBXJjU0lzTx7RywVcxFHQGW+6 uYMT/g0l7B5vIszpqzg3ZOnOoS1gJc+gyeY8bIP7f5ONxbJBmoB0bE6H1k3DvtFkHTmi l9+z0a54akGU+tv6wHgqpRIxlAmFZwocxG2DC9NasQZ8O7MRxx8vG4eQ2vkhF2TvZ2au at+A== X-Gm-Message-State: APjAAAUP/U2fwRyE/RxfNb7MvQkhnSljvhLlX08QphUvMClEmMT1ds0+ OPt6IdHvPur3yQpZm+WUh16Komra9p6s7E25+tM= X-Received: by 2002:ac8:1876:: with SMTP id n51mr48097546qtk.234.1555092465264; Fri, 12 Apr 2019 11:07:45 -0700 (PDT) MIME-Version: 1.0 References: <20190412124050.32120-1-alban@kinvolk.io> <8fb1d2e0-f8c0-4e01-ddf8-158c9e80558c@netronome.com> In-Reply-To: <8fb1d2e0-f8c0-4e01-ddf8-158c9e80558c@netronome.com> From: Song Liu Date: Fri, 12 Apr 2019 11:07:34 -0700 Message-ID: Subject: Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create To: Quentin Monnet Cc: Alban Crequy , Alexei Starovoitov , Daniel Borkmann , bpf , Networking , open list , alban@kinvolk.io, iago@kinvolk.io 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 On Fri, Apr 12, 2019 at 6:21 AM Quentin Monnet wrote: > > 2019-04-12 14:40 UTC+0200 ~ Alban Crequy > > From: Alban Crequy > > > > "bpftool map create" has an infinite loop on "while (argc)". The error > > case is missing. > > > > Symptoms: when forgetting to type the keyword 'type' in front of 'hash': > > $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128 > > (infinite loop, taking all the CPU) > > ^C > > > > After the patch: > > $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128 > > Error: unknown arg hash > > > > Fixes: 0b592b5a01be ("tools: bpftool: add map create command") > > Signed-off-by: Alban Crequy Acked-by: Song Liu Thanks for the fix! > > > > --- > > > > Changes in v2: > > - Explain the cause of the bug in commitmsg > > - Add the "fixes" line in the commitmsg (Jakub's review) > > - Rebase on the bpf tree > > > > v1 was initially based on bpf-next and submitted on > > https://marc.info/?l=linux-kernel&m=155310327709613&w=2 > > --- > > tools/bpf/bpftool/map.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c > > index 05b029b934a6..1ccc38718458 100644 > > --- a/tools/bpf/bpftool/map.c > > +++ b/tools/bpf/bpftool/map.c > > @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv) > > return -1; > > } > > NEXT_ARG(); > > + } else { > > + p_err("unknown arg %s", *argv); > > + return -1; > > } > > } > > > > > > Reviewed-by: Quentin Monnet > > Thanks Alban!