Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3523463pxv; Mon, 19 Jul 2021 02:15:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwae0fe6bPMFnMvFc+2uyJH8YQiY/eKcd6gkBOi/rXUO2/dOxe+DGCuyfUHzaR947QobAoT X-Received: by 2002:a92:d251:: with SMTP id v17mr15809086ilg.283.1626686126597; Mon, 19 Jul 2021 02:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626686126; cv=none; d=google.com; s=arc-20160816; b=jt4IN55N/ZIPi3Hb64bvh+VfHQBdRAk/6FVuQUymDseeUZx6FIN6ofL5b42w8oy5KF nwldtrEm6U0XBo6XFcAP9TdahFd3DBIFmSd9CUU0HLQNpJsa4ECo0F9aWbn7cV5QWr51 ble7nVjPjAoY5jbJEq/mqBfEdrstRIsTdSq6xzURE9x7VxVIRmZ2ufdLazDenO9Oa+ss 26o3uYe0ymEThNzKzxh/kIYEun6XL6IE1oB73Jj44i6xozG7mhfp3QU3sGXqOptt2SYy hxyNhMomTxXYBGHp4D4zj6j8/lDoJRE/LueUXbg7+ILli6aQ06rOPQRyw6+/D3Gj5wFG OPUg== 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=u5FkYygAP5aYXKhiToJncjQ4pnqt1axbUfxSA6M106E=; b=IP2Omo4M1VafXxMwIbAJBLQwFJPngCcxkffxKFgkvS/i6JpOdz3pSBT/Q9KNp0sDal mUfGw6dEwf333ZX2sIUDx1Rt+3oOp7hDUpaYRNGG4pycaCp167g7yQd4OFxp0+UUe+tU Mv5/TBqU1gdCytEICuHwvxA4ad7ymOmz2QKgzZBjIz2mgy5KdkjR071b7HQ0RQPehNDh 3sYKqsvH81TDJUDniocMcC09x0OuWmdOA3pOQxixT61XBogRI+rxkU6b5S9P6DTFj4ql MKMcjTdLx0pen4OTBvDpMLTB8XZ3kaGmZwf0QNagXV5JlWnONKFgElnFH4qPiiw0BkDl kKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=RUoz3S+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si20866506jad.35.2021.07.19.02.15.15; Mon, 19 Jul 2021 02:15:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@cloudflare.com header.s=google header.b=RUoz3S+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235677AbhGSIdD (ORCPT + 99 others); Mon, 19 Jul 2021 04:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235329AbhGSIdC (ORCPT ); Mon, 19 Jul 2021 04:33:02 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E593FC061574 for ; Mon, 19 Jul 2021 01:14:45 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id hd33so27485477ejc.9 for ; Mon, 19 Jul 2021 02:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u5FkYygAP5aYXKhiToJncjQ4pnqt1axbUfxSA6M106E=; b=RUoz3S+OzJer2hQ2zynaEh0ahbOByD6Ye2U9E+aySsu09fb59vHB8xqBnMBTNjooXK J48srP6gvu9447896+hKmxhF7Yn3jmLZiyQCnSf7eqMm4aPtsMJWS8efN62jjFn9mbAr AQL95z7CfrzZnBYbnITt4xTYVjHmXWcnLWPNA= 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=u5FkYygAP5aYXKhiToJncjQ4pnqt1axbUfxSA6M106E=; b=Gkc+yvLwu5gMDRi6oToVtVLs4uMbHp3yfign4ibk0Xy6D1i2sp4eKKBcQlwkeiwtm0 79abqweW3rS6nr2tdKpL3geKGPrpGr2HH8n+g2NIzj0feSDWKtw16NrylHqDIycHbAlW xTknbn2kfWuS36i5vT59jW+iOQeV/IyDKdDBIQ8dAjueai4V0tlKzCLNG3REM60aX+pf LYtKlUCDVxMmaU6dWe7cmnYCtwZ6fQcTykVn/k3NBcqL0RhIDMtW9bcwmnJuVBVxbwA4 QOhNWGHRVwI3yOgWXodv+LxhfE29rfno/WCGKgKzOsAc6/qYDY6DYvdYMujU5kPHPxId twMg== X-Gm-Message-State: AOAM532gkEp7aA+xpoOwxDoxbaMfrfPnDqMAr2hmSCMqG2cR8R/BA/kA hBhFB9xqyABLQWoH2iTuGRm1X8bk1bY0cPPXx41H6UVSc0o= X-Received: by 2002:ac2:43d4:: with SMTP id u20mr17544633lfl.451.1626684328396; Mon, 19 Jul 2021 01:45:28 -0700 (PDT) MIME-Version: 1.0 References: <20210716100452.113652-1-lmb@cloudflare.com> In-Reply-To: From: Lorenz Bauer Date: Mon, 19 Jul 2021 09:45:16 +0100 Message-ID: Subject: Re: [PATCH bpf] bpf: fix OOB read when printing XDP link fdinfo To: Andrii Nakryiko Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , kernel-team , Andrii Nakryiko , Networking , bpf , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Jul 2021 at 21:44, Andrii Nakryiko wrote: > > Well, oops. Thanks for the fix! > > Acked-by: Andrii Nakryiko > > It would be great to have a compilation error for something like this. > I wonder if we can do something to detect this going forward? I had a second patch that introduced MAX_BPF_LINK_TYPE, etc. and then added explicit array initializers: [MAX_BPF_LINK_TYPE] = NULL, That turns the OOB read into a NULL read. But it has to be done for every inclusion of bpf_types.h so it's a bit cumbersome. Maybe add MAX_BPF_LINK_TYPE and then add an entry in bpf_types.h for it as well? -- Lorenz Bauer | Systems Engineer 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK www.cloudflare.com