Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2209669rwb; Thu, 15 Dec 2022 21:54:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf6N0LVk1f02IK6vibb7l+sDRXEDurjpwXirzrka0A43hp9g1SLFbd8iUWs8wjXtLPpHvgSd X-Received: by 2002:a17:907:2a02:b0:7c1:10b8:e6a4 with SMTP id fd2-20020a1709072a0200b007c110b8e6a4mr21537040ejc.19.1671170051822; Thu, 15 Dec 2022 21:54:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671170051; cv=pass; d=google.com; s=arc-20160816; b=yp6n06uxefZa0ONIURL+1EqRbE10uSMI6cSRWKic+zwksYguozIeU+G+kCtEfd+zU6 AiC9/tH4u6762g0mQdgSvcmDjcP7boHFzskYojp450Ux6H0SfXPhW9Tnfq7oVC2oijQ6 ZQN2LG2y5jRgPOXKjbEWG+m/ZswJHLaRvJV0EwrKlCb0mxx3zTmL7XARB3jViGv3kRhu g59A3eEWTBJp9Az+ZTv/EJ1mHeah2yQaH3UwuAKUcoGCH3O2EddHyRVWNLNNEEtNC6+p 7g3dkrTC7+Z55EjBcCBwp0lQqcsF8pJILlgAwa03oBb2ak7aQf+pjX1DVSqpqLW7mdw1 r9Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=TMEK4veVCtb34RKdn8QTQmuK0Gx3r352nY9SeWBsqcQ=; b=BDS1LFlVvJVIWv0niRrjhvktLpuH+CRTuD0zFAc7mpXLInMQN+5JdiC6RxLkmlY/uz g9cdCYmBBrWlkHKWaNtV6UFumiwZCJKsiw4rSEfR1GuMi6L8jTTziNmVqsd+DW1rsTNN If9WSkskem7V5dMI/WzBZy3SFPWYaQtxkt2i5rWG5HpOHONF4g54tDeCgfxWGdwzeuy5 X+skxtps39u0Y7V883RH+DGlMfXhzaIcY4XRzRj/9uuwGmxMrWF87vJaNosVZHMUGRjK BmMQ7JUGBX6i89V3yg3F00A0HZqc2yULsJv0D2mb8QX0toPWl7cWAqfW9kbjhAM9Uwe0 vStg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=M1k3rHVz; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=meta.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id un2-20020a170907cb8200b007c12fc0bd81si1277203ejc.362.2022.12.15.21.53.55; Thu, 15 Dec 2022 21:54:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=M1k3rHVz; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=meta.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbiLPFGp (ORCPT + 69 others); Fri, 16 Dec 2022 00:06:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbiLPFGl (ORCPT ); Fri, 16 Dec 2022 00:06:41 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C574F49B4C; Thu, 15 Dec 2022 21:06:40 -0800 (PST) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BG4YBFL017442; Thu, 15 Dec 2022 21:06:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=s2048-2021-q4; bh=TMEK4veVCtb34RKdn8QTQmuK0Gx3r352nY9SeWBsqcQ=; b=M1k3rHVzF5bfeIL6Bqzh9eOERzX//xP/Zf/0Dz+ho3FqB+yb4oppzCMTTZ/PzIO9kDpS ABWhUutgcLiQI7wF+uhhDZ6olbVIA8eaXB+nkgcadfg/yIUQR89G91YeksLxj9BS3zlJ sGOjS6C0OOX9AxFnhc456moI4F0yAyYM8bHe2VqJ+/2QVC2ypR6AEOQaAUWV5zSnHqWB Nz8tMjENZH/rbJY5kJvogXsCR5HBdjWqw5lGyfo+DNbZ97vouN6keCvhVz24lBOb/r4z jvoksL7dJBpwQwWcckGVeoG3WIIEtHJEPXa8MCuCd1a6uwSGESv+hxt0BaZGfS2zHSu3 CA== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3mg3hhwx8e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 21:06:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RDk85GJKvSQKs7XQ0JDMP4PVoR9cdn5OCaO4Y/MrzRZhNdXlIhsPkC++JtkymNVuNpiul7DOHh7GUEZiu2uw5K2b4XZpeLao/D7vhy9mqhd0h2BW9+VwQpOYZQzIGUCHjHOx6+veOsDRhMXBqSJfsHVRGT3kwg4HYnIPkarJuBBNF8JkqLt6U+gtTiToK9q6T+x2GHUJ/7/FP//cCg5ORMeWBdR79H5ahZWUnUGU9mOd6KvShGNyMocPWuIzMVk/l1QGr4ar/468bTpQaTmrhs6EUJS3tksy57rL89I2xWmDEMZzcftbGaVJoRjnE99NVbq4+YvWob4jJrBnk9jKug== 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=TMEK4veVCtb34RKdn8QTQmuK0Gx3r352nY9SeWBsqcQ=; b=A1Iv5mzOKxiMoEwI14dPXCjNSy4KzwUig3dXrznmnUKTWkI86cW0nToj95CjjGHVuY58Y1DW9y+lmRBI2LQPnPYUVOcesbdsp0Yht1e8wolO3Rb329RVHM/erKiLP4WKCWNSPxRUZgN2uPmpcaPqOFgZ+UY51uK/kXeP5dJ9B85kWMGY2VFUKDhabhIaBaiyg+Qgb0ebtTx1JHpBwYATqC0uWNNnAxRAwM0WA3ZqVQKacx5wVWjAhGHvN0GFyOxv/h4EDrO21vaKuqxI/keQ3QqlfJqNsK2K9p2L9Rn3jWBZ9n+w9T0PIdtVj3f4lmsxG/RiN7cmroH+ffHiUfmkjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=meta.com; dmarc=pass action=none header.from=meta.com; dkim=pass header.d=meta.com; arc=none Received: from SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) by DM5PR15MB1450.namprd15.prod.outlook.com (2603:10b6:3:d0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.12; Fri, 16 Dec 2022 05:06:20 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::3cc9:4d23:d516:59f0]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::3cc9:4d23:d516:59f0%4]) with mapi id 15.20.5924.011; Fri, 16 Dec 2022 05:06:20 +0000 Message-ID: <0fc1e9bd-e70b-28a2-bc09-629414a619b0@meta.com> Date: Thu, 15 Dec 2022 21:06:16 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH bpf-next v2] bpf: btf: limit logging of ignored BTF mismatches Content-Language: en-US To: Connor O'Brien , bpf@vger.kernel.org Cc: Martin KaFai Lau , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , linux-kernel@vger.kernel.org References: <20221215005315.186787-1-connoro@google.com> From: Yonghong Song In-Reply-To: <20221215005315.186787-1-connoro@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed X-ClientProxiedBy: BYAPR11CA0052.namprd11.prod.outlook.com (2603:10b6:a03:80::29) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR1501MB2064:EE_|DM5PR15MB1450:EE_ X-MS-Office365-Filtering-Correlation-Id: db42ae19-dcc6-46bc-8a31-08dadf234512 X-FB-Source: Internal X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gr9DTvIQWqeqC61c2+FHXr6hq4+QqctifMAggkqYYnAZZ6prRUcJTHmVp+e3tTz3+rFkzwbrAi2gYuiQ76fWI2L5hw0O2mD6K4pBguA5ejUjImtj8477lIMfHRYDfhZTtN5G7zLU/YBSeGytJfe6XhiVqfQU9oN19E9Ft/q0SZ/8SZzP/plfiz6yOgGwJCRKmCUG0MYoSuX4U6mXxIbXxM4BJ6BwaOE2081hvNGJxvA7ajykqfoNt0hrDN0fJhFIY+df26MhOWiaYK2JJt7mNSRZez+jntyrNhQtG3YW9QazXL+v587E+4dP/beoW7Y4K4I19bUDQoO37XRzOFRhsBzzIlEWyE1jPVgernP7qjnDQMj5l9TB98OxfG112fEjqb49ecwSUjYb/MNuyDZFdgQ1w3IrUmMXUHhWG44oTDecmqAMSAxW97JcF6asmMYqqlaAmm9b2qEHjO6zzvt7/Ges/2nAScZx8FkbzdsPWnhS8Vuz6LAdFwDbZzhH3gy9LdP2EhDUPXzgHuGyuH32KzTZZPbmFtBra4tslQ5xEOF+iILgQE1MJqcdkOnNfarYJOmKQmhSU8ULarbM4CMjbUotzKEUTYRx7kvRgxAXVQ47M7x9hVvKtLj2BKDs9SRPbGE5qwc6B8uXOVq2UQoYVsv7WojCb4GBya8B1J97ZLpPgqUkXQWH8k/WgYpNjFuQrkiSFdJo8KzYPmYdAyOR9ARIz5TFK3fMIHHtNZ3neCYPCe7VVFc9LQosD8RMqXc2XfHtF8X7L8yCzBPSnXBbpw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR1501MB2064.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(396003)(376002)(39860400002)(136003)(366004)(451199015)(36756003)(31686004)(38100700002)(2906002)(8676002)(66476007)(4326008)(66556008)(66946007)(7416002)(5660300002)(83380400001)(31696002)(8936002)(86362001)(966005)(6486002)(478600001)(316002)(54906003)(41300700001)(6512007)(2616005)(6506007)(53546011)(186003)(6666004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VUZjQ3NRYnY2dHFYNzVjK3dZanRNRXlxbFpNcFVvOHU0and4djBCTU5BZGxF?= =?utf-8?B?b004L0NtU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EVjK0I5?= =?utf-8?B?NFl3dHNtdTV6UmE2QWJNWitVK3hnNFRMV0xSYlpjQWRiU3YvTWlBUWZUclQ2?= =?utf-8?B?WXdWSkY5VURrVVFxUVpOQjhNQU5nOTFWbFllRVhGREVZYUd1Ullzb04rSHZv?= =?utf-8?B?bDVNY0RxWVFJbU5maTZzd25RQ0htb09kZ1pJT0pQWDlPV1JYS2pEU0xXNEdZ?= =?utf-8?B?TkUrTndjTUQ5cWMxQ0Z1S3haOG8xUkhRR3YySWE0RlFjeHY1cXB4aGpRdjVn?= =?utf-8?B?MEJrZkVUcGI4ek5aR0x2QktRMlpqazNndmJIUXFsOW5sMnVNTFdKZVRVMTla?= =?utf-8?B?WXc9PQ==?= X-OriginatorOrg: meta.com X-MS-Exchange-CrossTenant-Network-Message-Id: db42ae19-dcc6-46bc-8a31-08dadf234512 X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2022 05:06:20.4382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RcZy+S0li8GgoDSLr99hdHkQy1BFrzdwDYrUgrQmh5MWp9Wsf2c4IiLshgZyXCyn X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1450 X-Proofpoint-GUID: 1Y0aHOfnMnIUUnQkmu3DMx_ryU3Afejq X-Proofpoint-ORIG-GUID: 1Y0aHOfnMnIUUnQkmu3DMx_ryU3Afejq Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-16_02,2022-12-15_02,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/14/22 4:53 PM, Connor O'Brien wrote: > Enabling CONFIG_MODULE_ALLOW_BTF_MISMATCH is an indication that BTF > mismatches are expected and module loading should proceed > anyway. Logging with pr_warn() on every one of these "benign" > mismatches creates unnecessary noise when many such modules are > loaded. Instead, handle this case with a single log warning that BTF > info may be unavailable. > > Mismatches also result in calls to __btf_verifier_log() via > __btf_verifier_log_type() or btf_verifier_log_member(), adding several > additional lines of logging per mismatched module. Add checks to these > paths to skip logging for module BTF mismatches in the "allow > mismatch" case. > > All existing logging behavior is preserved in the default > CONFIG_MODULE_ALLOW_BTF_MISMATCH=n case. > > Signed-off-by: Connor O'Brien Ack with a few nits below. Acked-by: Yonghong Song > --- > v2: > - Use pr_warn_once instead of skipping logging entirely > - Also skip btf verifier logs for ignored mismatches > > v1: https://lore.kernel.org/bpf/20221109024155.2810410-1-connoro@google.com/ > --- > kernel/bpf/btf.c | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > index f7dd8af06413..16b959b49595 100644 > --- a/kernel/bpf/btf.c > +++ b/kernel/bpf/btf.c > @@ -1404,6 +1404,13 @@ __printf(4, 5) static void __btf_verifier_log_type(struct btf_verifier_env *env, > if (log->level == BPF_LOG_KERNEL && !fmt) > return; > > + /* > + * Skip logging when loading module BTF with mismatches permitted > + */ Just use one line for the above comment. > + if (env->btf->base_btf && env->btf->kernel_btf && > + IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) > + return; I believe env->btf->base_btf alone is enough to test it should be a module btf. If env->btf->base_btf is true, env->btf->kernel_btf should also be true. The other way is not true, env->btf->kernel_btf is true, the btf could be vmlinux (env->btf->base_btf == NULL) or be a module. > + > __btf_verifier_log(log, "[%u] %s %s%s", > env->log_type_id, > btf_type_str(t), > @@ -1443,6 +1450,14 @@ static void btf_verifier_log_member(struct btf_verifier_env *env, > > if (log->level == BPF_LOG_KERNEL && !fmt) > return; > + > + /* > + * Skip logging when loading module BTF with mismatches permitted > + */ Same, just use one line for the above comments. > + if (env->btf->base_btf && env->btf->kernel_btf && > + IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) > + return; > + > /* The CHECK_META phase already did a btf dump. > * > * If member is logged again, it must hit an error in > @@ -7260,11 +7275,14 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op, > } > btf = btf_parse_module(mod->name, mod->btf_data, mod->btf_data_size); > if (IS_ERR(btf)) { > - pr_warn("failed to validate module [%s] BTF: %ld\n", > - mod->name, PTR_ERR(btf)); > kfree(btf_mod); > - if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) > + if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) { > + pr_warn("failed to validate module [%s] BTF: %ld\n", > + mod->name, PTR_ERR(btf)); > err = PTR_ERR(btf); > + } else { > + pr_warn_once("Kernel module BTF mismatch detected, BTF debug info may be unavailable for some modules\n"); > + } > goto out; > } > err = btf_alloc_id(btf);