From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 6A7F7C433DF for ; Tue, 19 May 2020 00:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A02820578 for ; Tue, 19 May 2020 00:15:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eTT7Rr21" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgESAPw (ORCPT ); Mon, 18 May 2020 20:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbgESAPw (ORCPT ); Mon, 18 May 2020 20:15:52 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52812C061A0C; Mon, 18 May 2020 17:15:51 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id t25so9788516qtc.0; Mon, 18 May 2020 17:15:51 -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=LSQ6bbK5QmZwJYC9jpLIrNTbJNjUMjJ5eQzgUn+LHiw=; b=eTT7Rr21sjGUotCwrUVISAfchfQWCiQ9yrJYlbMSF6liSgYlBIPz/l5fHjmqlL4c4w WMrbsSofwyJf/AnyRF9aV8MrqIQ6NcBrOEJ28mltRJh1Z5u+wLtJIQJ5aba+jKEZdv8M FtN0bmM8tTX7vaCRmvchx5hKoO0c+UA3KZawa7JVl2sCPMj6D4D7qh7jFS+9jUonALdW 5wFGrn/m8syprshKI4qc5CfzksRNgkyfXX/3M0Csok8UIAD7BIJiwwnT80KWmrpoMcg0 RBafdg0/7S2I5ceRa6Puur+IGTAcjj+hJpcFZNtF5PMp3YvCCF45FeUCS24V+a6uBqNf GBMg== 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=LSQ6bbK5QmZwJYC9jpLIrNTbJNjUMjJ5eQzgUn+LHiw=; b=fZyBaOyZv8sbI8x4gtsoUIuV6HemeZmtLSKz1OYCa9jKM8DNaLD0lI/y2WmR8715P5 7LOCW65K/Xpir1M3Kp6Jfpg7edVxZIf7aFkRt/ftbE7wXQa+yEEXBoP9hELasIkODdrO cJDoS/4arZCe3YDsyqw79Sxg2ysbc94yI1dabJhouXkcnjz2YWI96IkHbiMs8ZK29NuZ PQ/vppMT1JiC8cANsE1aNhcLWaUYEJp5Cu/oXqiqI16/jYZpaOtjgrP8qvsE4mHlUy0p PM7IxaGZVG9V1IIkvUP2KwERg2UwC1jq1Zfky4OPaYoahkTEvctALYL/Rp3bK5y9ucsl pXZw== X-Gm-Message-State: AOAM530paCQhOGO4LdzZc1gRlVhMYDF5VKbzee1jQHENfk3mqIR0C8iM 4zVuhT7lHEX662XNpduwTwVZ52VRsk064dXZgqc= X-Google-Smtp-Source: ABdhPJz5rEWsMFhUBy4xS7xqMbRblS3+sZNU6SFhpT7v4u3/aqpCrpy3O0lHJLntkvFQ6C4BnXEyCfQsnuDDQpammU0= X-Received: by 2002:ac8:1ae7:: with SMTP id h36mr19053242qtk.59.1589847350333; Mon, 18 May 2020 17:15:50 -0700 (PDT) MIME-Version: 1.0 References: <158980712729.256597.6115007718472928659.stgit@firesoul> In-Reply-To: <158980712729.256597.6115007718472928659.stgit@firesoul> From: Andrii Nakryiko Date: Mon, 18 May 2020 17:15:39 -0700 Message-ID: Subject: Re: [PATCH bpf-next] bpf: fix too large copy from user in bpf_test_init To: Jesper Dangaard Brouer Cc: Networking , bpf , Daniel Borkmann , Alexei Starovoitov , "David S. Miller" Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, May 18, 2020 at 6:08 AM Jesper Dangaard Brouer wrote: > > Commit bc56c919fce7 ("bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().") > recently changed bpf_prog_test_run_xdp() to use larger frames for XDP in > order to test tail growing frames (via bpf_xdp_adjust_tail) and to have > memory backing frame better resemble drivers. > > The commit contains a bug, as it tries to copy the max data size from > userspace, instead of the size provided by userspace. This cause XDP > unit tests to fail sporadically with EFAULT, an unfortunate behavior. > The fix is to only copy the size specified by userspace. > > Fixes: bc56c919fce7 ("bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().") > Signed-off-by: Jesper Dangaard Brouer > --- LGTM. Acked-by: Andrii Nakryiko > net/bpf/test_run.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > [...]