Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3269220lfo; Mon, 23 May 2022 00:21:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylLtBWe7nOa24hTA2yeax+kR56rwdHT0zA9q6LZfE/0/r5iWrq1+dfKXTNP5iNaB95EIre X-Received: by 2002:a05:6a00:729:b0:4f7:77ed:c256 with SMTP id 9-20020a056a00072900b004f777edc256mr22445446pfm.1.1653290480590; Mon, 23 May 2022 00:21:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653290480; cv=pass; d=google.com; s=arc-20160816; b=XlxPHGtehea9U0GsCbhigUsCr/UAQ2w5G/nrQFoMS6muHRWXIF1nQyhpzmXZwtHmYD aN2SjhfQ7O1MWh+2gF2G8gPzRZDhLOV+olsJC7gTQ87GGC0IRxnJmCWYkoBWRz8F0P+M zsChM6i8vN+4F/RtgUOyot4xr9D/ivzl7rwjrJtsLRL1EWVchZ6BF7/CxprZMU0Jll5d 7fS9hscQstmG6ca0/3BkZ3uC3KzRt5Y8UI7+f4BC5IIydJ9/53M2W3GnUh/vKoCmLS91 N5dK4VDhjLRN1vqjWmEd/f7Ghplib20OKPyoexykdnAmJeBDxLQFoI+3x0WfWZKqRBxI c88g== 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=OCuP9AJFWibYyS4g5LXxl9JwFI24fVP4FXZew0h1idk=; b=NoNdH544HcvsaAAvr8XWFf7vk7ZTI3T07LBqxao0Lc2iqPaQrA7vDJ/fWiDFZxyiGh 0OpJbrm8/Ho2LSMKDsZF1TOu973U3ve0bodfeFlTaPcLEmFnFYNuzfIZV41u52a/s6HF OX628j1deQ3bLGbjzEpC2PE6Ss3P1PUJx3T1Plcbsbadvjw8kwqNz/lRKIMGP7si1HFt 7XeuHJsbkTFA6okYU5u2tONrvROu6+UOYZO7uTzweWbJHnrJzuGWGH+/qhlf/d2PbzvW iJvXMLtBG8HRFymZlQoAsfJgHpB1XtdkLZjHb/IfwNua1qdWpQEIJg8eP9Bwo+fxagxq 4ZHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=i78oqq9B; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a185-20020a6390c2000000b003f84816d04fsi9394183pge.8.2022.05.23.00.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:21:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=i78oqq9B; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C95719020; Sun, 22 May 2022 23:37:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244508AbiESTXP (ORCPT + 99 others); Thu, 19 May 2022 15:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241726AbiESTXG (ORCPT ); Thu, 19 May 2022 15:23:06 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DA354F99; Thu, 19 May 2022 12:23:05 -0700 (PDT) Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24JFGAMU007916; Thu, 19 May 2022 12:22:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=facebook; bh=OCuP9AJFWibYyS4g5LXxl9JwFI24fVP4FXZew0h1idk=; b=i78oqq9BbfxCc52syQ8EsMOL0p+EIXXqPKLkk7jrFdIW88iBS7lrL24yroHKTbsgXew2 39Iyh6kfH922LTnCSA63O7bqvWlRC1VhPhJtVh4F7SvBbxrczqwfplwblMg0F/PRwPwX pA6djil6+Iahb76yNDOA93pjhAFY/HQWAhY= Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2046.outbound.protection.outlook.com [104.47.74.46]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3g5pj4tsg9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 May 2022 12:22:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vw9Fsz93dbnDd5sQamBh90XjYzmWuk0XVhL1jEKtmaZnmR7oixQTv8LPRSf0c3pgzRjA4ybTQAjyNoCIG9njLgzXlxoyt2tGk8R7vajTcrD1z2IRn+XPO0ZD2mHDTfPeQBogoc3ynVI8uqXecQ20xrJL7HMN6y68IgaIvnQfOdPbn1ZkN3wlEm12LtaQTLdYKVegAPeNCF3kQ3usLj5oINDmKEzICoQX1sGvbD8Ysw5g/N0XNOc5if5SNhwVbxVn72YwG/Vm1sMjP1fUyY7nFaZLSLXYsoDTtxhwx1u46fWhWmFZEe1pWFQv7iYK1BhhARW7ZSYXkovRYy16pHEaLw== 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=OCuP9AJFWibYyS4g5LXxl9JwFI24fVP4FXZew0h1idk=; b=Jf8AAVFPqD0A65Y2RkRPHXY2P1V30nOA6Z8bZQjaORvbeGkBN6ectgVF33RlLnxZFcsnHSxaNmwKuv1tUBmcqmen7CGCpf6ilVwsiWfJyScAy80Xp65YRA5hLCGvJ4zpe2wI+y+rpfCYCSLznbqz4XiEMP76Mq3ekVKftcSNk0g7icLKkInS7TFGchCFNDY6UGEzIbQKGMrgUV1Op1oMyi1KZXGypGB+jqCtUzSRVbUTkrJ/AOQiz9tZiLXPOSYo0yyTrjmtMYlY+NCcc4y3F0wV01oUErSwwKscrLf8rwfQ++gIJ6i6aG949a4UxILWMuWoDJeez2qjm0GogSCmEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none Received: from SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) by BL1PR15MB5338.namprd15.prod.outlook.com (2603:10b6:208:385::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Thu, 19 May 2022 19:22:45 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::5811:4996:bbfd:3c53]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::5811:4996:bbfd:3c53%7]) with mapi id 15.20.5273.015; Thu, 19 May 2022 19:22:45 +0000 Message-ID: <333c515e-8b52-0e50-c5d2-529f5fcf0553@fb.com> Date: Thu, 19 May 2022 12:22:42 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH bpf v4 1/3] bpf_trace: check size for overflow in bpf_kprobe_multi_link_attach Content-Language: en-US To: Eugene Syromiatnikov , Jiri Olsa , Masami Hiramatsu , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann Cc: Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org References: <399e634781822329e856103cddba975f58f0498c.1652982525.git.esyr@redhat.com> From: Yonghong Song In-Reply-To: <399e634781822329e856103cddba975f58f0498c.1652982525.git.esyr@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed X-ClientProxiedBy: SJ0PR03CA0091.namprd03.prod.outlook.com (2603:10b6:a03:333::6) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0bf9b879-2448-4bd1-05f7-08da39ccf3d4 X-MS-TrafficTypeDiagnostic: BL1PR15MB5338:EE_ X-Microsoft-Antispam-PRVS: 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: +uFQ/ZutKvljpDV7f2V1C0Bv4/J9qg4GIaIdFelW9nIKwGZcOMOnHW6bMAOzN9dLi1sZRi/kq+O7byrIoHn5MSkUZWarWP+uUPFlJXfs232AZxeEBoFtwTWKrWztMzduUF4y4apjxu0aQCdTgnWM6CQQppRdiSS+W9tc4F15T79IH2c6YWiBU0/RlyNbZCGFUKjMMXoen/XVV853ItmgSqKkFKF5Uz7UNbyvd84lfCFbCdUoO1rOdBconJPME0VJ6CzjQHYocsKbJp0s0IFHrh84uJnYm84YsZ85Mkh+i4MP4EQkbZUftCKckOYE3CdRGowF2Y08A71fZ4G6MLN0lk6+GEX5866adzZf5LbBucomxlX+USYR16yYB78qhTkFUXIFUGUdPTNCoq/baAuDM3/lyj4JmsTXD/3f8OsJm2Vc4RepEkNkDGQcx541/5ezzJ1pi9VZ//7IeXBPeU7yP8iVcb+PVyZt8wdjGSHJeDiekvkL7PB6bTWo8+1OXkXHwrQUUPaov24MxRrlcgCJt+SNpyZfJL0DNdiYE1HFBQLffbORjzfL8gQ9mJW5iMFxEAUfO9WMVcK6+XY7g2yCOR0a5cFVTPtMUjyBhfHpWw/QeSUX99/rhJC97C4/jm6cGZv+raHTcAi856kmYDuAlc21FDwtK15jimuvTThageJOxcAKPdvtUL6mmyrCxLgHMeNlKpae5VRWtsWqOHYR9sh4gwjU1ukRPlymYs+mKxICdTVQdRrbBE7V7Y69WSrsQfvSTZlbl2Zc8gJvnCOQPTpXtvS+v8vT3Y962kCkeqz9NuXoJmp1pkRTYkGPalnw 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:(13230001)(4636009)(366004)(508600001)(2906002)(38100700002)(31696002)(86362001)(966005)(6486002)(54906003)(110136005)(5660300002)(4744005)(7416002)(316002)(8936002)(83380400001)(6512007)(36756003)(66476007)(66556008)(31686004)(6506007)(8676002)(2616005)(53546011)(52116002)(186003)(6666004)(4326008)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bko4QUZzVVlOb3Bpb2hVRUlCalJncnlrR1dBUFF5RHVOT1BNSHY5STlxL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0YzR1RCeWErQWN1eXU1Ym1RYjgvWnZieGJtKzM0R3hmMGRo?= =?utf-8?B?Mm1NVmZIS0ZNYy96QTZTdGVrNEc2dkxicEtERHNPMkNGTzQ0bnlPWHlPQ1lO?= =?utf-8?B?LzdTb1V3dmJ6Yk9NMmUyUTV4LzdSKzR0U0lzdlRUT1BlMkR1dFZJV3VWS0c0?= =?utf-8?B?ek81UnpnMWtmemtPYXlJbWN5NmNBc0ZOdzVUeGZOeEdlL015OGh6eHNPeFBH?= =?utf-8?B?eDRBbXRPNVJnVFFISjBGNTdPV0VMZitDSGFFU1lrY0Vmc0RNbHN4aHlCalpQ?= =?utf-8?B?d3phTDhIUGo5cjRia2dJYUdSVXBVS3E5ZW1MQzdUd2RWSTRFVWhLMWZrV2Uz?= =?utf-8?B?ajQwQUNHZysveDFzWHg2dDZQc3p3Y3FHK0N1M2l6RkxjaFRucXlrRWZOK20w?= =?utf-8?B?ckE5Q2tFTUd6NDJLVXczby9Lb2ptcFNTditsRkxFNzlOemVBYWF1U282ZzRG?= =?utf-8?B?U2dZV2xrbnZZdHp4UnBicHhvNmxYdU9veXBvM3d3b0hhMUpKMFRwV1hZYXRw?= =?utf-8?Q?y6uKRZuzdNYLiI/0=3D?= X-OriginatorOrg: fb.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf9b879-2448-4bd1-05f7-08da39ccf3d4 X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 19:22:45.4935 (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: hRHCABzrC8SruhGtj9aybYf58S0Gc13gkGRf7Z54cesJLrEIC6JwEFRpiCh6OMUJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR15MB5338 X-Proofpoint-GUID: q4FCuXNh0vHxMHVF7w7BN5704gQguKjc X-Proofpoint-ORIG-GUID: q4FCuXNh0vHxMHVF7w7BN5704gQguKjc 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.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-19_06,2022-05-19_03,2022-02-23_01 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/19/22 11:14 AM, Eugene Syromiatnikov wrote: > Check that size would not overflow before calculation (and return > -EOVERFLOW if it will), to prevent potential out-of-bounds write > with the following copy_from_user. Add the same check > to kprobe_multi_resolve_syms in case it will be called from elsewhere > in the future. The INT_MAX checks are performed in order to avoid > triggering kvmalloc_node warning [1]. > > [1] https://lore.kernel.org/lkml/cfe6abea-8d00-8f8c-f84c-e6f27753b5d1@fb.com/ > > Fixes: 0dcac272540613d4 ("bpf: Add multi kprobe link") > Signed-off-by: Eugene Syromiatnikov Acked-by: Yonghong Song