From patchwork Wed Oct 18 06:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shung-Hsi Yu X-Patchwork-Id: 13426485 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86E29BE5D for ; Wed, 18 Oct 2023 06:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="EU/SoIHm" Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2051.outbound.protection.outlook.com [40.107.6.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DD119B4 for ; Tue, 17 Oct 2023 23:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjQy0vAtydbz4cQDS3ENunGNL0TFYus2wkNPX0YK/kMxssc1o8x0ZVX25lhsq/oDlQrpDlXaEWJpnJYHTAaIVrc5KVV12yt9Pbcyp13g0UkNV+0BFVjLb96wr2c5sOdOjn7pVuJQoISQ4GsUi7X/bqFuiXFpNiZ8X51dDhSrtsSZ9K3JVVcTLBW4D66754rFO4HncPPnX3qsRjc/st0YRJNHsebeM8GqRtxU0b4S78EowSQMyv+t/4W6zUP3g0RQIqWZywVL3SZluamYNeGxZpTvXqxkOqTL+PvOS7uL/3GhNYhkiyBk5/4M62E6NBkwkBDhWSVw2KlaT1lIzN5X8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jsk7n667X1+bbFH1+881aR7KrBz9RB0nv2fFFJP6jcw=; b=SnHZCz8dwQYWKPeQdZqurOT2xt2psiYnDPIPtd2aEh8eHaeQQ/zk5WykcFZm9213xq9xjjN+uFy9qDtDd2+LvDXn7hdgOzVaCh2rumPWXcUFfs+2B6IL1WQ+yn+WHeQDf0aKHyvaBl/OMbNJZ6CZhjJl8cALKsaspt+luUSVuGcZB9dUtgQ8sq6OMRcKdnfJZvkNn65rLVc/yC7qGRj6bbn6rOlGu6wfF2sjX9YJgdg48PtwA+WbGTebLopOb7JHsQARZV8hV1TMq60YL0exgX/cygK5R5aFNJYpmWKsuQA60bLo8QCTmkaSt3blViURvL0Y5+xYKmaD9Zh6tK8xNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jsk7n667X1+bbFH1+881aR7KrBz9RB0nv2fFFJP6jcw=; b=EU/SoIHm0dtLQXACUCba9X/LvlaugIfOsNMqbFxVyZjlN2GpSqyJzxL4Clw3nsI1+SpXThwWQQe5x4BoxNMYZCrgupIlwNykNsmPEeCUqRMZXqiCTBlil+WTSLgx/Hhuc4giiVOQEOWrLxChZEcA2VytCi66Nbo+Fmr/wfxMRKn4uIBO7CM9NHWV9vOJqmWFXk9Hze54CLBRaaz7MDeMe2PiMux3II+L4MvzQy7gyCRQG1YZ9JJbR5YI5IABYd/U0tQUjAC8bKTNBQ78J/ZJFWlnMAshFjvGoY859Vvd4EraM39pRFVqzSa6+ZVPkpd7yCze8OyRS6ULtCMYMbWdog== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from AS8PR04MB9510.eurprd04.prod.outlook.com (2603:10a6:20b:44a::11) by DU2PR04MB9193.eurprd04.prod.outlook.com (2603:10a6:10:2f8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 06:23:09 +0000 Received: from AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::d87f:b654:d14c:c54a]) by AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::d87f:b654:d14c:c54a%3]) with mapi id 15.20.6907.022; Wed, 18 Oct 2023 06:23:09 +0000 From: Shung-Hsi Yu To: netdev@vger.kernel.org Cc: Shung-Hsi Yu , Stephen Hemminger , David Ahern , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgense?= =?utf-8?q?n?= Subject: [PATCH iproute2-next 1/2] libbpf: set kernel_log_level when available Date: Wed, 18 Oct 2023 14:22:33 +0800 Message-ID: <20231018062234.20492-2-shung-hsi.yu@suse.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231018062234.20492-1-shung-hsi.yu@suse.com> References: <20231018062234.20492-1-shung-hsi.yu@suse.com> X-ClientProxiedBy: FR3P281CA0097.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a1::15) To AS8PR04MB9510.eurprd04.prod.outlook.com (2603:10a6:20b:44a::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9510:EE_|DU2PR04MB9193:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ae7d536-19e6-48d4-4baa-08dbcfa2b294 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mNnfbzrQ7l5kcebMXwbidVzO+DwtyuFv8G8dfH2yVrk4vQzevidag5pU++wwldSVRpk3tYDbC8oOfez3j9QDg3DTDoJMJ/XYUErOjZUgdJvNC7QyAMxWWUh6odlfr1825PhLCDp2uDxPyWBtlk2dlzYpjYTVJHeXubhUYGhkM5e/QfDj+fCASbePUs4BuX5RSpw3j48Fg30FjaHQokcS0NA9a3NxDewz0xK50cZ7dKTtXIfAnBI7nAFS5jwBu9cyd03UcmShOB+lgjReQxLALIv4VTxTLTHiIv4hhzK44T6LoxCGfbuM6io6eLrnZz7DoxfUDqqAQZDu84ORznN2hIbPEwq2FRBdKCmCH/l2+p5LwQy/QJDk0Lsxu/SPw+j9GWbKWAjmYuEJRhBsVRuSeLRgcECDrOiGH7MBI132PK1VudVB3icNuwk9hL6NE+1PVNWKgRFodbv4D6JpUOTsazdnXMBASyapNq/9MZpmzVLRBf0NQtkvSYvJmHGzXHM/5guB5Sdl9AU7+x3rjUhsuX9Xge2jMWYm4OLQhmLA6qW0RQKLqWPs9HVj+LMCPJed X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(396003)(346002)(39860400002)(366004)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(5660300002)(54906003)(8936002)(66946007)(8676002)(4326008)(66556008)(66476007)(41300700001)(316002)(6916009)(2906002)(4744005)(6486002)(478600001)(38100700002)(1076003)(6512007)(2616005)(6506007)(36756003)(86362001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V4DgJ4XJx4VhxG8CL759v47qMSeM3RCUQ6OSVwF6PsxWrYiXBQE1YP9iCfKnT6snyZzCvKwTr9xiOEHsx5je1VAdTnTh2YwvBzLqr6kuvlX/Vc9iubhpsZAMZ1oxw+/9fZc761bWjFK74vupbi5qzKhwl+rlSiOppcHJFClRX77tpVztVmhuY3YQG9jYIv1AalI8fvSqfRa8YQRfu3FM9C9lzIEkQR1BcyjL3ocjX+3oMx7ntmhmBxTSTFRRk9RnXbU2MTNfzFFty0iq2o8lxcz1M6diuxCzYPWVutAEPeJSt5OLRmwIbukf9abk88pMIv+LgvDNb0ZC4tUtEr0JGW0Y4fdXyQfMvLbQYK/R8+1Sh/746eqkwDZ0HKjKmfT72DL4xM90cYAcr3v6fqCMMxCt1c3NDnjH5HAk5n9xNhyDaXj9w0VcpsNEn4NLtb8gjMurkcBD6vbMyHpjb8jQ4FKVzVgh1aI2HZsdcgtpXFoOXOCD8kWh3iWR+7RQJABSdCNFTKiLSI3gNq361vW7FMLlfiwxpHFHzO3HRiak3mm32ObFemH+MmtXC4g+efaFkpO7EQdIZAjNA/h9P9DMZRXF6E3GCTqpaDHMJUhNGOO/+EJEfHmh5Cj/jEAMjIryR4TuvYcS3ShWLMwBsS5ERIhxkzE3Y13++hiiAwvH8Pb93exQ9kkcI1WrlMT320QlMTpSBOzPodoU/VkBJZ0DFHI71rwyw+7WeanjFVgJUBbexQJnDrYPnfZrrXUySpc5xuxaNTbC2ZdzQx902LgijIig2IljQTJ/17kBfZInzgin6Pebecy3bTTUGuMqJENsU3pgLhn+0LFVNHp6KRdz50vh0F8Nix0BAoPstWly2GAi3fsyXDueHa6v6Pp1XFfBcYwj8k+++HXBEoF0CIi9j8cNTa3fPUxu5tcSz3UddpiPYxD6BgERFlTpHYMStXU+aR+AoA+bmTIOlLXL8G/dLMl4bfP+CCdYB1qekUkwT4gicIBcGM53fFfCpaHLsc3I78JPHYWwhNFq4bfg4stzSMOAT3PXp+noO9Jiontscd7kciB59AnE71yk/wsF5ExEFGsATYBGJX7Hkxm1KqMFX3gB3W21ym8j3vpEOU0LLZcBrxOfePTto9lnW+zvVO4N/fRABRMi1ZEfeOpbMhGx4z3hBQ7yxP07zq/8r7bJmAmK3PGxyfwqwoW3isVTU1jofRX8Nxpv4TAYHotWKTvuI1ganEV+vo7a46qkiRHNwt7JMzkDwsa3lmpse3UFwIUh+mHVonFuLvDJx6q+N4VgoWaUKwvFG3+nIh/JrQOIBt+/ba7mOit3N1L+w7gPzKt9mg6NbpsOO9PwCcp+OrO7U2NO2zkeVtObOEnuY9DVpR76xfxuTpcDaaDK5iWF2PDVDtceo6gSGSCVK0vYPMtuNdGkmtNGYA2jcwBNBPA4l9gqP+t/pkcppCG/h4XjYy9RSEXo7vLV+50kdEesuafNpeJFmJ1NJAF3GwolIflFm/MBnlA1dUZ/Od6NrE1KrIDOW2TBsDObbjRAfR1NTd7V3sOXL3dN0Ti89c3d9R9G5Xx6lO8BXt3KSMDv12MbMgLDFYZ4aV/u8U9A3/6sIBkw849UCvVPPQEXllQU0VnjWPHd8Jqlf+Grv6pPYVU9e3wJ X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ae7d536-19e6-48d4-4baa-08dbcfa2b294 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 06:23:09.3284 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YdZSm8LObZGgsxnc65Aoxr6fg6afM604RlTA0iDwBAhaPAG+W8XmqvX5Re7mv5MPEqSv0j1ZLl/lVnWqPe9pGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9193 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com libbpf allows setting the log_level in struct bpf_open_opts through the kernel_log_level field since v0.7, use it to set log level to align with bpf_prog_load_dev() and bpf_btf_load(). Signed-off-by: Shung-Hsi Yu --- lib/bpf_libbpf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index e1c211a1..f678a710 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -285,6 +285,9 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) DECLARE_LIBBPF_OPTS(bpf_object_open_opts, open_opts, .relaxed_maps = true, .pin_root_path = root_path, +#ifdef (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7) + .kernel_log_level = 1, +#endif ); obj = bpf_object__open_file(cfg->object, &open_opts); From patchwork Wed Oct 18 06:22:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shung-Hsi Yu X-Patchwork-Id: 13426486 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B7C9BE5D for ; Wed, 18 Oct 2023 06:23:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="u4upn4wv" Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2051.outbound.protection.outlook.com [40.107.6.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61C2510A for ; Tue, 17 Oct 2023 23:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=id2PRucqkqbaQoEHjxyU2N/UaYMBKp0/uh4BhQfnvY7ugAumkZGVAU5g2YCvnfMFdzahkaoO9Qyp4vqzrG/lP+J5bu8dSa7HafpQsp1F5EWSJdxkB1jHoqWMBj9DFA1yrshmAy/hFmbgUfJQtzCMkm4m6Pj8mMlcr7xA+UvwYDVXApUF5fEOgVS/xZg8hENEOa3oV9tVId4h21KZn/970w+9vfFu/PzulvObubbxzDqEsM/gd7RIi2N5yrNEh+G7+sfAUGnv1ZI7o9JFmD9kED91dcHtO6Ea0JhQv6KuPTVlvAvILcsrbTCG8FSUHA9QRJpc8fSyPlk4hy/Fmq6Y3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kyCmhZnsdvlFq/T2M1B7FczIE69TTjPx+pmELzJkyfA=; b=eXcLlxq5zoe8WVQw2EXlcGKlz+HcCu+DdbcJ/9C2OIkWJRjY+PZg/Gug5Svvv4PZlteHe+jQxE03Ts8YoQwNiYILr27WY+AEi6MCvGzaMhVajRFqAdE4Q4jcObRzjeP8jknusyK1bsOhhAZsNBS9m3Ug8et+pQb9myHKhJ9Iu8+pczM3RitWBSXEluidOvz0ZXb5zuyzjExA2P62i/mqOXRhTobTxSaKcwgnhzlpZMvn+iUJkrTol9EFkYqHtgLBAEp7dQI87yf9Ul1DTHf2QrhQ0u0EuhspyJjFyiQ9aLZFjJrFNU4rWx/F3vrlz77Z3KL6r/Oj/3t7x2naRv3WUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kyCmhZnsdvlFq/T2M1B7FczIE69TTjPx+pmELzJkyfA=; b=u4upn4wv2XZMB9yj/ta7dzbBsbYa1znQ7kCdGPkTTkakA1f1cpPIzo4pjk0sUm5FX+PaZCQtNy0594JEVFEV1mb4EjC6o4kYTTiLWOYNUwa4o1OPTnzrJjQJ4OUsIFAVzW31xxn21iRkAHYcLUjoBzUsVV5rnwdJ2mWzxRI6CKuv3siNarDUe9Ueql2lDC8crucq9AKT6azT8h5p3qckfBoA5xYrgow8CXMy4REYZhyOVEMvQUrwAxzTRJM3WSwdiTXOyoRKwe5i6r6DvY3T1Ui6fCm0wDGwViDHcDj1xysUkAxj/QMMpidPc0eWCd2nuEQ+exXOl8Oou0VW5arI2Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from AS8PR04MB9510.eurprd04.prod.outlook.com (2603:10a6:20b:44a::11) by DU2PR04MB9193.eurprd04.prod.outlook.com (2603:10a6:10:2f8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 06:23:16 +0000 Received: from AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::d87f:b654:d14c:c54a]) by AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::d87f:b654:d14c:c54a%3]) with mapi id 15.20.6907.022; Wed, 18 Oct 2023 06:23:16 +0000 From: Shung-Hsi Yu To: netdev@vger.kernel.org Cc: Shung-Hsi Yu , Stephen Hemminger , David Ahern , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgense?= =?utf-8?q?n?= Subject: [PATCH iproute2-next 2/2] bpf: increase verifier verbosity when in verbose mode Date: Wed, 18 Oct 2023 14:22:34 +0800 Message-ID: <20231018062234.20492-3-shung-hsi.yu@suse.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231018062234.20492-1-shung-hsi.yu@suse.com> References: <20231018062234.20492-1-shung-hsi.yu@suse.com> X-ClientProxiedBy: FR2P281CA0137.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::12) To AS8PR04MB9510.eurprd04.prod.outlook.com (2603:10a6:20b:44a::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9510:EE_|DU2PR04MB9193:EE_ X-MS-Office365-Filtering-Correlation-Id: c9b78a7b-280a-43dd-5b34-08dbcfa2b68e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /UGTITLpt+AYlR06+vi8X467cUYcbuTg6YHQTC0LrTdt0xaMOJMEvxENBqfSQ7ln147N8szgWr3C/tAfSp2lyM/ZdPeGEVWgnuD9n7feWPqlTq9tXKuavoRNO3k/V8Pbk7yWMCjosy5rv55SoyCcCNLNPSY7Hpni3itcaYNHH7CaN65sRCWdwYCn7ZdlSTlHvIn2pyAB6+/tJbTlyLqzt9Kcpwd8Jewl0N6JiZqQcAOqeiNGaKzJuDuXq6pc9iqkLJ9c/riDCB5OT1auALIMDKu/94QVPUixTXwbdiAH6VhcBL9OW0t36+1f+BLjF+5Tbe65WMGH70HVU5Q7O/SRvrzGDgiGljZh3kZ4UAnbqpyF1mhqIxVLQye4K5MW6SMi1xLrxd/uvQEdJ9tlMDes4g13LNZaNh0WsSZrwtTPVAwE1GrKRW6SZpCQJK7okKj+7CnP4eb0joxiAjJGV10PUpVl10Zxo4nIJR1Bkt1ktVMrBZMFP+sGuNw9sHyNkF+bMveyKCdoN7s4rB+u+Tu9Oq4RneQFL68hzUXSUGccK+N7bNsGzlhj7Ed06m9/Oje5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(396003)(346002)(39860400002)(366004)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(5660300002)(54906003)(8936002)(66946007)(8676002)(4326008)(66556008)(66476007)(41300700001)(316002)(6916009)(83380400001)(2906002)(6486002)(478600001)(38100700002)(1076003)(6512007)(2616005)(6506007)(36756003)(86362001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mc8zUUbQWVBYpTQSjZkoR4Sgsjc1EuVWeQojpkxKDzQTHGmfxQ1xbNIG0z96nAUxt2g3lvSzp92OjThE0Mk0ZlKHDlFR4Sf6Jq8QmwWg82rUYZTDsGliLkmaGELLMiaBBFP4Qfs3H7FxdkfyfLtJWk3PbZ2uUyoXPNRfiHO+6psSNeg1RjWsFqtoX7kWrJbXa60ZiRJZgf1zykgsDypyXX5nIpEj5LvMg3paiDzDerzczc3UOtjl1klnKAyloFeCvOmoYEUQCD48W0JLTeAbRgDkjXjL27xYfkBWshzGSjDuKdblm5z6p5JBGPkbYQ+qQu+a+S0cD0Rkmp5e4dq2PQAhFMV7wnbzrfuhGzwf+mwcPwT4IVAiPc9S+feGFMm3D5gFS6jeahJ8rMdEcYYQFhYMUqvxb5GobspIjF62vTd5Mjl5bmgdZqO/q7Tskzl925ghDEvnidezGstEOVg3DRobsueFnHJsnKATbvCW0TSBpfSbg5glAhQ25TAhCqHNTNFWmsyYDFo7ZxBI1Ix8TxeUF2RG0FdncwTAS7WyG6auAphHpCzhF8v1Os2jncyv7UfAQ7rey+OOwgQlGOsG9Wv+hMPODsaPc956WZeJN4DtUbW6tJZC4tJitrr8p1J3m0VIW72yovWKbUz8hoHmxJrPDcbqnkj1FlMOMg8qp3FXLxjOfVqhy4oOwS1tKs7//Ywk9jTtml21M26ESAGT3pm+Ppl1kCeI34IF4FxAR67Cva6y5x7QOUt/QdPEu1L2BJrDqhRhrt2+MZ13Qv8rCcsp2NxmL3IVQEv0tWECiUi5iXU1+jK4AHVnMiZ4O4psso8fNx9a8pwNrns+ywA8LEhhIQQvXGZtpzzaKCgjG3o2stlF/78ruhqjKRbv8g3TjVPTp8KBuEZKHeZ9ecUvYVzIKivpbSzB+FmHj323SwdNzCTG9zyqoIxDsIOM/KVYCSWAbqvidBZM6BPaDiU55p+OT21S/cAFvbdUxxBKFBUkLBDKIMG4oJZDLtNWsz1kM6+6okgFXycrcYGc/3hfPbCqMknlxXdx4s/Wb0B1wYcmDZua89mEYXqnvRAaUFArwjUTAVk8QAfMhn4RvcpMnMvVTpEhALDYpVcYIHichn682ACj1d8wfnQmA0m6P7zoPfj43PSFcR35Dlv07qwj71FoUFu2u7aXzgJkLdhw6jydYYNdsEr9qINqDydhcREFICRlLUyvzOE88iQKsRBiO5EoGJl7dBdHjsAETfcpITcq3JhKOqVRjuDdL+VobTpLMp5bgUza/H8+xDEXS90A5u8YP5Bn4iJC2UYDitiGNTkmVCIygNiPUldc1/FGM9RBt4qogBz20E7ErBnlt45Hw+YwQ4p4RJ5nn8iQjeFxjrEzguBshsvMb4xHbGAIHgS4SjMZeLON+yFSpp8cMRdg5l66ORbK/7GBdqFjjBOhAUIr1T+ENeEMRJnDZ43VLoinN0SzHAhk9nzy3BO7ozgTBXwxbZZq4gYWVrQ7Biv7SdP4aljTpHO6aimo7YtVUPbsHPvgAHHR7oNxJtjYYNN7DStdxTgfN/wdbAu9KoDXghARZmUnRkvIhpFcQSCSmsxe27U0zDYQi7LltbY4ft3CPb/5FpzWv/OD/YQzcZi7cJmNp8/zUlXMyhwPbsqqwvYV X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9b78a7b-280a-43dd-5b34-08dbcfa2b68e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 06:23:16.0810 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S2fyA7ZYnreuwPKNk0M6XAltCf20AcICVdkieNr2EVXjaoBdwoBI8NIxbjE9Rg9PQ+5gX5ZFadZTClkzVPEfLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9193 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com The BPF verifier allows setting a higher verbosity level, which is helpful when it comes to debugging verifier issue, specially when used to BPF program that loads successfully (but should not have passed the verifier in the first place). Increase the BPF verifier log level in when in verbose mode to help with such cases. Signed-off-by: Shung-Hsi Yu --- include/bpf_util.h | 4 ++-- ip/ipvrf.c | 3 ++- lib/bpf_legacy.c | 10 ++++++---- lib/bpf_libbpf.c | 9 ++++++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/bpf_util.h b/include/bpf_util.h index 1c924f50..8951a5e8 100644 --- a/include/bpf_util.h +++ b/include/bpf_util.h @@ -273,10 +273,10 @@ void bpf_print_ops(struct rtattr *bpf_ops, __u16 len); int bpf_prog_load_dev(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, __u32 ifindex, - char *log, size_t size_log); + char *log, size_t size_log, bool verbose); int bpf_program_load(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, char *log, - size_t size_log); + size_t size_log, bool verbose); int bpf_prog_attach_fd(int prog_fd, int target_fd, enum bpf_attach_type type); int bpf_prog_detach_fd(int target_fd, enum bpf_attach_type type); diff --git a/ip/ipvrf.c b/ip/ipvrf.c index 12beaec3..e7c702ab 100644 --- a/ip/ipvrf.c +++ b/ip/ipvrf.c @@ -253,7 +253,8 @@ static int prog_load(int idx) }; return bpf_program_load(BPF_PROG_TYPE_CGROUP_SOCK, prog, sizeof(prog), - "GPL", bpf_log_buf, sizeof(bpf_log_buf)); + "GPL", bpf_log_buf, sizeof(bpf_log_buf), + false); } static int vrf_configure_cgroup(const char *path, int ifindex) diff --git a/lib/bpf_legacy.c b/lib/bpf_legacy.c index 3542b12f..844974e9 100644 --- a/lib/bpf_legacy.c +++ b/lib/bpf_legacy.c @@ -1098,7 +1098,7 @@ int bpf_prog_detach_fd(int target_fd, enum bpf_attach_type type) int bpf_prog_load_dev(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, __u32 ifindex, - char *log, size_t size_log) + char *log, size_t size_log, bool verbose) { union bpf_attr attr = {}; @@ -1112,6 +1112,8 @@ int bpf_prog_load_dev(enum bpf_prog_type type, const struct bpf_insn *insns, attr.log_buf = bpf_ptr_to_u64(log); attr.log_size = size_log; attr.log_level = 1; + if (verbose) + attr.log_level |= 2; } return bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); @@ -1119,9 +1121,9 @@ int bpf_prog_load_dev(enum bpf_prog_type type, const struct bpf_insn *insns, int bpf_program_load(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, char *log, - size_t size_log) + size_t size_log, bool verbose) { - return bpf_prog_load_dev(type, insns, size_insns, license, 0, log, size_log); + return bpf_prog_load_dev(type, insns, size_insns, license, 0, log, size_log, verbose); } #ifdef HAVE_ELF @@ -1543,7 +1545,7 @@ retry: errno = 0; fd = bpf_prog_load_dev(prog->type, prog->insns, prog->size, prog->license, ctx->ifindex, - ctx->log, ctx->log_size); + ctx->log, ctx->log_size, ctx->verbose); if (fd < 0 || ctx->verbose) { /* The verifier log is pretty chatty, sometimes so chatty * on larger programs, that we could fail to dump everything diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index f678a710..08692d30 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -285,11 +285,14 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) DECLARE_LIBBPF_OPTS(bpf_object_open_opts, open_opts, .relaxed_maps = true, .pin_root_path = root_path, -#ifdef (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7) - .kernel_log_level = 1, -#endif ); +#if (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7) + open_opts.kernel_log_level = 1; + if (cfg->verbose) + open_opts.kernel_log_level |= 2; +#endif + obj = bpf_object__open_file(cfg->object, &open_opts); if (libbpf_get_error(obj)) { fprintf(stderr, "ERROR: opening BPF object file failed\n");