Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3754385pxu; Sun, 11 Oct 2020 23:21:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH7/eT0+T4trtpBF0xuuaFBEb8LYs/4NLfWxgoxL+4gC1C3e8qG1RJh1c9GhOtVNSus9xp X-Received: by 2002:a17:906:696:: with SMTP id u22mr26476099ejb.446.1602483663234; Sun, 11 Oct 2020 23:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602483663; cv=none; d=google.com; s=arc-20160816; b=tZk3VAYWrqiUzlTI4pInDCkA6t6U89GkqHLNy8KwkdEql7efKwm2ZTK8WZebljjkDI qvAOsq4DsioXZ/PQkID0JDIJj2NQLDwHEko5bC4eUNihjij4fTKzfF7vJTRQsQGBOluu JYcSKCIha9CEzBDGX94JJhnmlf3fQIet++WHeKzZGFGccTomMZL31oa7sPYb3WsBSOvG zcyCjCyeruUq9BKCLODyRXttQv2gC6hVV+tCOyBb1FoL9pwJABtNZ3j7FQeb+l5810xm +73KOdixqg7QPgYObFCZvJqvO2ZYljBk1AmU2A2pBrvBRgA2PfvZppOt+4KORJC1/bSl scag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1yI8jYs2/lZFaIWxLZ/rjVvQ+sNLY30huA6J9bKeQWs=; b=nDUGNt7p0+sCnEWmSLdcHWXmWx+nhuu+sRn4cat7csVxnQwnhj2XGGINUw5F8VZjbc zUjQ+m90qO7OUMrpyMf7pVpfwWZ3Nbx+gNO6I8iBXajpDTe1+p0AXwmjYzg+lr4+NWDr Ry3L4sdlAnL89aRy+cfkNgMxcfhfTwKbZGS/LWd5UjXa82gEGXsMuRV9gXASbyQ3L1aH il3PzozoiL6i6Gpg2YhjV0/XaBCpTC7/znhIwQkzff3Gfu6+iDuNsYDErq8SVfaiVWSz JUryWmZFD9MI7akhQ5YLLjgjlisGkVkb0lWLoh7SnLTHegkTEzUzi/isJMe48U7uchdF ereA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RcKAUm7X; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si11838672edm.459.2020.10.11.23.20.39; Sun, 11 Oct 2020 23:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RcKAUm7X; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgJLGEp (ORCPT + 99 others); Mon, 12 Oct 2020 02:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbgJLGEp (ORCPT ); Mon, 12 Oct 2020 02:04:45 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B958C0613D1 for ; Sun, 11 Oct 2020 23:04:45 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id t20so7914337qvv.8 for ; Sun, 11 Oct 2020 23:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1yI8jYs2/lZFaIWxLZ/rjVvQ+sNLY30huA6J9bKeQWs=; b=RcKAUm7XE30LvjwktSIVOpda8L78FHBfTGbVdFcE2/BPz9VprsI9jUKte8aio2Nnen c4VU+029KeHaZBqm3or90rscQ/kZxgV0k2PAXM3VYGsyQNjhuAyPy9BThFX8GcCEQ0In 9eT4oCCNSrRsFOLWOcMv89Qw+YXdmwN91H5maqzG2xCkk9wlKbeSbAYr6hvKgWUfvjqO X9M5okURon1jOYF7xWHWyhCBIRUuHrQPoBs/4yBvwQ5yKv+Ut+8hxwkmp5f4lVUaXKv/ 8HGIZ82BwymAeEUjLbpsSFJIyzoWOcll5IdLRSE4gwprUmA/9OEtXFXT6wcnDbZ0PKYu qDyA== 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=1yI8jYs2/lZFaIWxLZ/rjVvQ+sNLY30huA6J9bKeQWs=; b=gxOH/MC7dSBWzUmP5UwuQsv5vO/qKknNEhJB1zhZ14y2RWIg16/YUhTQGUMhwjTU15 uPo7YpGIasB81zkEvLqs+jjRIQioR5O0klZPVqWA8apV3jp3fSV28bPFB+9HbeIRYaAr qh+jxZSmkhjsjEcJh+Dh4fEwjlReKlQOXlwBxXhxvdRWccUtjLaefAkAXtPFIoG8PQXW Cu/6bWhLgGK19jRJHLI/AywWlgw46WvxnX8b54E1SF2+T3RI3RZIY+JuF4oA8X9D3qXi HaxW4y1+3clvI62LEiCBNckIn9eJu2gZwfxlUEKOgc5GTgMJdIKsywuTOZscNR3EDoFi wTTA== X-Gm-Message-State: AOAM5314XtvKqaFyT8NEIGes1T4ZNNdZZHe+vr8zT4NatQw/ZCypEIQ/ FOQs2xcWhESeYDopwlEUj+acODZsX1dD9ccv7JoqRw== X-Received: by 2002:a05:6214:222:: with SMTP id j2mr24604054qvt.32.1602482684327; Sun, 11 Oct 2020 23:04:44 -0700 (PDT) MIME-Version: 1.0 References: <20201007101726.3149375-1-a.nogikh@gmail.com> <20201007101726.3149375-2-a.nogikh@gmail.com> <20201009161558.57792e1a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20201010081431.1f2d9d0d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20201010081431.1f2d9d0d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Dmitry Vyukov Date: Mon, 12 Oct 2020 08:04:33 +0200 Message-ID: Subject: Re: [PATCH 1/2] net: store KCOV remote handle in sk_buff To: Jakub Kicinski Cc: Aleksandr Nogikh , David Miller , Johannes Berg , Eric Dumazet , Andrey Konovalov , Marco Elver , LKML , netdev , linux-wireless , Aleksandr Nogikh Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sat, Oct 10, 2020 at 5:14 PM Jakub Kicinski wrote: > > On Sat, 10 Oct 2020 09:54:57 +0200 Dmitry Vyukov wrote: > > On Sat, Oct 10, 2020 at 1:16 AM Jakub Kicinski wrote: > > > On Wed, 7 Oct 2020 10:17:25 +0000 Aleksandr Nogikh wrote: > > > > From: Aleksandr Nogikh > > > > > > > > Remote KCOV coverage collection enables coverage-guided fuzzing of the > > > > code that is not reachable during normal system call execution. It is > > > > especially helpful for fuzzing networking subsystems, where it is > > > > common to perform packet handling in separate work queues even for the > > > > packets that originated directly from the user space. > > > > > > > > Enable coverage-guided frame injection by adding a kcov_handle > > > > parameter to sk_buff structure. Initialization in __alloc_skb ensures > > > > that no socket buffer that was generated during a system call will be > > > > missed. > > > > > > > > Code that is of interest and that performs packet processing should be > > > > annotated with kcov_remote_start()/kcov_remote_stop(). > > > > > > > > An alternative approach is to determine kcov_handle solely on the > > > > basis of the device/interface that received the specific socket > > > > buffer. However, in this case it would be impossible to distinguish > > > > between packets that originated from normal background network > > > > processes and those that were intentionally injected from the user > > > > space. > > > > > > > > Signed-off-by: Aleksandr Nogikh > > > > > > Could you use skb_extensions for this? > > > > Why? If for space, this is already under a non-production ifdef. > > I understand, but the skb_ext infra is there for uncommon use cases > like this one. Any particular reason you don't want to use it? > The slight LoC increase? > > Is there any precedent for adding the kcov field to other performance > critical structures? I see. Yes, increase in complexity for no gain. No, KCOV context wasn't added to anything as critical as sk_buff. It seems there is no established practice both ways -- I don't see anything debug-related in sk_buff nor in skb_ext_id...