From patchwork Fri Oct 27 08:57:05 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: 13438396 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 56D84156C8 for ; Fri, 27 Oct 2023 08:57:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aC+hqYxc" Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2079.outbound.protection.outlook.com [40.107.8.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F0D186 for ; Fri, 27 Oct 2023 01:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DCdDuUFC00B0ILzVDcgHQA6WJIrsrPwUBSPMz2RUSC+leC0FljVsBLA/fQ+5CVFWZJ0EkmGhB9KQ/ckxHZd8+32g/9Gt/DcUTcyO1zg2w1elnmla7SEymyiWGYRKF0iCFwahp2TZwcI6r55GCor/CJAQchsrpuTgRpA7lfnSegF53ww8cCD3TiyaRqLo6LjUKbfkHzb68qVmo6lytKN0PnBGkilcufNJxmuirsq2/C2NrWaExUuN/AFn50A7ic2N1KxhD8D73CCY2PE3oLEfL4ZvjYIyg3aKmjYEGM7l5Vep7jfSQIUbfzixWcb0mG7da6GCFS2PpMZfo1teuo6mww== 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=yIiI9qsQ8Xuw4D4R5MFosCNUwOX2WmcjdGock7dwE54=; b=lC5Ca+KzCyEBe0gwQ2mWqYj/Y7ju0GCOrBU9wp/7b/zZlYSfrs2eIkPf7Ja4aWPufSw1+oDZ8K0aK44ZvmbsE884GragBzzJ63xjs3EmvQHpnRWzFucBZ3xb7KOdy0dfzOUpDLrDW9/PEcQZI6/mjivgNPTdvzHenQtmIIKBOn4dJgQwjyBYXE6Wd5D2YcpKeBoXgsSJIdz2MDoxFgnXjXYmkVzorFFXtc9O2HVKatu9MKqs8q76uAKAKUDSdYPY5FtHu57Agzv2ODxEF847TDy76k+QywxMmp4sbby/J4Jmcf20aQTyzO3crOnO0dEB61zuksw+qD5DFWcO9t8GmQ== 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=yIiI9qsQ8Xuw4D4R5MFosCNUwOX2WmcjdGock7dwE54=; b=aC+hqYxcpiGgLwAejPvGr0uCaZh6xEmbnj2Cst8A/X/1+Oh997j3kxiO9PNSFAJgwxTUtVTde10dJfFmjs4r1GAonbdEArVJe1JG0ZlQxe/HA/DbiZH/Al/2qRXaOn19uQ/O0EaWOTlGWxHR3mIU1NBC9H3BoJT17RsCN6UUUhTTld6fBaLSI7BXpGCjIJcIwD6NFKYaRNky1HrQLXNxLIejhmYcbuuTcAcqhcgv2EwrJZ9YFxVlcMGrp4Cb08s9M6WzLK7LBy00Yn0dkzr63eBie+LeMFrw2Rxo7+fAkzZ9LuqteTrNeJ87sem9Mxx6PKWSM+933VyDAy1rzqjOjw== 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 PAXPR04MB9303.eurprd04.prod.outlook.com (2603:10a6:102:2b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.8; Fri, 27 Oct 2023 08:57:36 +0000 Received: from AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::9f3e:3b47:5ccd:c47c]) by AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::9f3e:3b47:5ccd:c47c%6]) with mapi id 15.20.6954.008; Fri, 27 Oct 2023 08:57:36 +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?= , dsahern@gmail.com Subject: [PATCH iproute2-next v2 1/2] libbpf: set kernel_log_level when available Date: Fri, 27 Oct 2023 16:57:05 +0800 Message-ID: <20231027085706.25718-2-shung-hsi.yu@suse.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231027085706.25718-1-shung-hsi.yu@suse.com> References: <20231027085706.25718-1-shung-hsi.yu@suse.com> X-ClientProxiedBy: TY2PR02CA0018.apcprd02.prod.outlook.com (2603:1096:404:56::30) 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_|PAXPR04MB9303:EE_ X-MS-Office365-Filtering-Correlation-Id: 98d2e6f9-5c9e-485f-c2ee-08dbd6cac3cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DcJYT0sRnhR8s46vdktQIZkIneVZcGndNsccZD3S408TIBfc3NwZ9M/6qjle3ykNaTKLXo3vmNVUO5feV8kedMqYlgLxkBr3gRUpLO+s5fNzLnUczSSmLFF4iu/vXQ+ehiHRVko0yRrc0lEF0LRo2y1qu6AocbEYDj5TZMTRR2jnBYuZSUh3lzgLe6KXVybTDOibucmwlfbyhKCK4jospW30g+EA43XGywpcfDcYUXFgAn0TozDSxiJPlsSoVlzC68HdWsS4KbGJUlgmFDKDD9PRgKiOFUjKIHV8qMSeUJqiDsB32IV95xlVUTWD6XGOEGZPay8r1c1uIPvyYTa63UeGlALfPsQbWlRIFUrZoWB4AHBJKF4FQ1LrkLwjIw+SqJfChNExPcVIttOjJsPYMQYPTD6fSDqX+CEjsBuIx2ORksXk69sc8R2mcvb+KJYX7LBZFPbg9KYIzq+8X+haLyzsifVKnGqdzVHWUu+rMCuRNvJ4vpJv6L3WS65hRDUIu/DcBPneIalKJPOSS01u3eW2QjBO5jeetMKGqQRj5gExXa/dUh/905r2P7T5qjgg 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)(376002)(346002)(39860400002)(396003)(366004)(136003)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(2906002)(4744005)(41300700001)(478600001)(4326008)(8936002)(8676002)(6486002)(66946007)(66556008)(54906003)(5660300002)(86362001)(316002)(6916009)(66476007)(6666004)(38100700002)(2616005)(1076003)(6506007)(36756003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J6T8Ff1+L0tmq0aOn/dOhADirnY6nDP+Jkfk0yGo+aY1/KuQFADCkiOlLIkahcK4YpxxXY/YJSj07d1l5YGyoXQ9RHZ6e5LTtPkgMOflNQjpXqu4CQ6xSpW9gnDOoKW7jR5pbVX41EXj+Zh7m40qAjSB9NcLK5OCWF5+F/AcjJlHhejCjfSncFczl/9zavPiIRHGAL5aum7in8m52zKxkJ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B2Yec5OtXe7MLduHSvYSsPqZnx9w2q/VMh0FkXEE+TQ/1zG9L51I7BbjGIhREITzzjIWoykd3YccGZy+8F1yAKm20OWL49BNCsONMdms0d6mFqx3HgXHa2oOWwghtud3SvGeTzkLXsR3ynPrv8gLiKG/HBxnEap1Ebgu5jBwtdVpUcJwpjC6rZRzliLVSh+MO9tRKzDM+HFYG5d4E5YIH1Ea9AagIIM7ZF2GPD0YxqD60It1uD7PnBWDlA/O4ictaC5c0+GyEMY4PYeQZ1RmMB+1OEsUzsvCAuxDVYoyyacAX7QwARohHWLqbbzzW72NEiuQewfq+oZ736D/9G8RZ7mjs0zGbdnpGkjsINbB+fEZXhGklFfu1E3UfRTi3tOTpi7Wbpbg== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98d2e6f9-5c9e-485f-c2ee-08dbd6cac3cc X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 08:57:36.0534 (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: AkxlPQiMfThacebKsMjgog0clWLpTAkAQJJ8chXemI2COej7qXl5Jg6+/NbDXusI86FmzTedLRyAZiEmfW/uHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9303 X-Patchwork-Delegate: dsahern@gmail.com libbpf allows setting the log_level in struct bpf_object_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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index e1c211a1..4a8a2032 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -287,6 +287,10 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) .pin_root_path = root_path, ); +#if (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7) + open_opts.kernel_log_level = 1; +#endif + obj = bpf_object__open_file(cfg->object, &open_opts); if (libbpf_get_error(obj)) { fprintf(stderr, "ERROR: opening BPF object file failed\n"); From patchwork Fri Oct 27 08:57:06 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: 13438397 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 C653F156C8 for ; Fri, 27 Oct 2023 08:57:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="KCXNUyLG" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E7E91B8 for ; Fri, 27 Oct 2023 01:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RqqZuJ6LS+WHYT46t84RF75vTREuDO16JebfUja4/h2ztXZgyIIdFPDpH1z0/lJ3WmWQjTfiS6aveqHBYc2gP1rAHdUrHWvoEjECFOamFMzT+ZEbQ6mPXMyZIn1IidDFFDUBAMoQxR7W5SKMY3StOKHDhkzeAO6ZPMovErdwqaAjsp0RBVZ1X3TCdq8pJh1ap5n6zLQ5V+52ZMSp5c+SjNSYp3gFzX8is1PbIrexNendqjtg5iiZWMOto7c88NtMtM+hBiA9/1eA+dElZUBWMnkB5cDLPMc2XdfjSZJi1WeKIo/7OKrEcxmW9eTjev4nXVmmH32vN7+46ejD5LOogA== 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=ZxBLQjK2h3m8WjqlDWt3n/kU/r/6GeiauIe/yMtvt4k=; b=TWh5xXYZL/aCmhdXjix+9USwwC8d50812RXsDiu0vjFrEV63Obr6JlXJABJQS0FtFImzIySroBxUFCWwl7xupu2r1GzWpahq+n8D0lNHjHMlVNOhX9uEZ9kk49/8sb31GzRGS7py7YG3V6l55JPoHaTqG5tCKs9bo0nNxNpiBnh/z7QE0cS4XUp7m2MAJVED07KctfFNDdlsEKcJMQOfxjKTX/5XD+MkzQcy1bBtI/9gPIMo7ADBJ6427xhrITZRO2L5M42XE/EGW9kuA2mmagfoLsQKd9HiiMHzosoE1ObgtqM6hAhRLsna/LD+TTw2rArKP4wW+iLmAkMsBHplWQ== 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=ZxBLQjK2h3m8WjqlDWt3n/kU/r/6GeiauIe/yMtvt4k=; b=KCXNUyLGqjEeWvvaR+Qo8jmjgwOxmhtp1wHbpFEco3+SOkBSYnujkxzWKvluV83g7Xhp7AhTXZfW2uRzoFu8+TDeAcQWKXN7oe3FXhIsfYnb9pbIiUJOacgdRtFbs3BxEeqACQS4k6UASIU0vhg/l+nGejTmlLgrsHcnlYLqY9gDWHycTnYIEZM6ppSk3C+uyGTqyKQ3t2G+C5KLYhJO+FgP9z4x/IsO09qExUbM5JgGF5g4CSva2P1u9ffPwie1+IHdxzsJ0e0iq7u2uqoY+ZW7M2EnkkYUEmZu6wHpd/SsFvF1gI+lTE7Ib4uQHpcFh2b5ien+eUQQtvgPGRdzlQ== 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 PAXPR04MB9303.eurprd04.prod.outlook.com (2603:10a6:102:2b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.8; Fri, 27 Oct 2023 08:57:48 +0000 Received: from AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::9f3e:3b47:5ccd:c47c]) by AS8PR04MB9510.eurprd04.prod.outlook.com ([fe80::9f3e:3b47:5ccd:c47c%6]) with mapi id 15.20.6954.008; Fri, 27 Oct 2023 08:57:48 +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?= , dsahern@gmail.com Subject: [PATCH iproute2-next v2 2/2] bpf: increase verifier verbosity when in verbose mode Date: Fri, 27 Oct 2023 16:57:06 +0800 Message-ID: <20231027085706.25718-3-shung-hsi.yu@suse.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231027085706.25718-1-shung-hsi.yu@suse.com> References: <20231027085706.25718-1-shung-hsi.yu@suse.com> X-ClientProxiedBy: TYAPR03CA0015.apcprd03.prod.outlook.com (2603:1096:404:14::27) 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_|PAXPR04MB9303:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e96e3a6-4c1b-41c8-4c64-08dbd6cacaea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XGH+XdKN2gxYX0ctJQbqROJO+bvLybW0cK6xkYRSnVtBMPPzYxUNEQmqL3dRF1lfUsR3NG7kLHKqmbmt98/gy5Z4I+wgPdGwrlfoiLFUquLBSyMKYMB69Mn192ZuVvjZmLGb2sT3Ot/QZfDhQLFDMzMRjW5GN2VcmRarxxzWdOMaD1sOq0Mh3hxs19cZX6eYrQYKHgk2CuR4OmYD3sePyGHQ2pHzgCPMNgZ/Xm11+WM2F/hwsfn/SyytR97aTOjMB+9Cs6UThDpnSd8eGHCLL8CrKv4IBy0CcRX/wNqTOWhCJr6VeS1c4VQz3NEDpE/e4+tjH9prViWx/+ZDs51ZTjcfbJEKBeGtEA/OdAfuoPfAz3LxKMNO/Z9NFHfDrgn/D9qQKZ8+C/5Szwh/DtVa5FTPpOrEYfVa4BcxyGp6kDz7UoK2PmaMYGTZdHqi/ATn3jM3y5IE1ynhZXMvPZ8NxSV5OPR20n8HJXC1900SgqfIBx4nAxpPXmgBgJfdAPrYpXxt5sh96rGS4SKceWR7qUD67Ts1iLaZMJPFAqWr9TY2MoR+M6PGyIkowt3GsUQz 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)(376002)(346002)(39860400002)(396003)(366004)(136003)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(2906002)(41300700001)(83380400001)(478600001)(4326008)(8936002)(8676002)(6486002)(66946007)(66556008)(54906003)(5660300002)(86362001)(316002)(6916009)(66476007)(6666004)(38100700002)(2616005)(1076003)(6506007)(36756003)(6512007);DIR:OUT;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rosPpYMMyL6IA4JXOpXQg13BHBKCjJPFKtBqyJdR6trpF/HGBf9l5K2vl/JokhI9hKJ33xvwg2wiZ1qrrPxfkH93up49HW8PEu5JuWs0N1NHCu7kzPohVPOeTOTMaAsd1n1LDAZep5pytw9RcyKASQW3IWjHTJ0W5D2iKPNAVEHzsDtAZEev3KvHUfc69QL8JEjRf+MeTX07r7B3700G9PFgcKUkr5Ti9yXvuNc3667J/u+WzLxkYUChnixObLZQ3+ORrUqg0U5RNjt8e9H2XOeEFlJTB64C12xj61zozW9ISkpw8WFBKWvIlhDkevrFFMIMC9jf9a/D74cCNJ1dmAVilROy8myUAR1zqhlHakJgCp9IOGZN6bnnrzt+y42Nc2aKUbgyVSB/rIuuD4S6aV+QlJFYUIENJot6pbfsq1BhkQ4ZeYuZAtpomHQ3vYpw16n/+lWrRpHhQKMmtiS4cXt2kRMf6xgQzERcQNSoqSLrNJZRBR24F/a9nhhm5qB26J+WWWLizdA27x/34XGPItvVdN8pbN9jIjm2hSbr1R8NB0Ol6mS1nbYB/lLr9kwsg63nQ+t8JSjHfk6XeDsFawwf0OVT9xem+mw1hl2EF7JOlmm9JsWhjAyUsplEKFb6M3CzTiMvcA3pUczbcMC7KrR/vu3knXXSJ3Rqg== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e96e3a6-4c1b-41c8-4c64-08dbd6cacaea X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 08:57:48.2153 (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: iDglTuD6WkynjMvKhEqB+KqLRto6EAPGU0JHXkN7AUoIy4qAu411yDMu6BoHi52AhcsNy3pEd4W8OnCadNkvzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9303 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 on BPF program that loads successfully (but should not have passed the verifier in the first place). Increase the BPF verifier log level 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 | 2 ++ 4 files changed, 12 insertions(+), 7 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 4a8a2032..08692d30 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -289,6 +289,8 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) #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);