Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1732524rwd; Wed, 17 May 2023 00:02:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NYTRJFGUBmy6nybEAH+gTVounHs0CGcc23N6vDAP9yw2ykCx9jwVH5AKwki0lnk3Qdans X-Received: by 2002:a05:6a20:7daa:b0:100:ab42:5457 with SMTP id v42-20020a056a207daa00b00100ab425457mr40136125pzj.22.1684306970762; Wed, 17 May 2023 00:02:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684306970; cv=pass; d=google.com; s=arc-20160816; b=CKQSo//a41tfJD/uLVWqir8VmimpUn/xfW+Jv/cGza9iKJ/T5GvszcRqSKFFN2J1Zy uz2uJtXY/m5Tu+rlYcIyIk6plpFt/MXphs+G1X3zZj1qexpQYVOviUYbm8qCZ0/A6ZpC seZPUL87VbTU2OfGRGQe7/cIc3hPvJI7wHzt2calO6zAKMn19geShq7fkDIEdVIFR9Qc 14PlwRKPnHk42pG9CCuQiozW3AlETxIHNsdUascID1KM6ZycLx1xDaFtLZcpL7kRPRPj DkTS1NBO3tEOgNqw1SPrgjaINfczOYvYVI7kOUr06PIuEiVNpBRwNIJAuBH4cLJuJNUu uejg== 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:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature:dkim-signature; bh=7HlQ/hvjBTYxfxKMf9QB/NrCL4m8My7K0TH53DzhVWU=; b=US6FllF1wiz4c2yXMUJvJv+06GKTe23ZJeH1XHaQFA2PQljP9nVkmcBWtnof1RJVkF ieEBJ3WbWYBTjCO6m8YWIEteBZAh+jMmwEO43BLCAs9rXOetB8p1OtF6o+3+NkJYON36 b8yJB92p2WGdFCKW0CRZX8XlMraNbTBPLOwAWSz/BndtnFYnjydlL79brIdlzxBm1wST bL+j86yOSdkNUEHIsCAXPaqOFz1rnUCHcP4U4mjix6Nhq60sj1i9J7UllXtivSwwlwtQ 8+madAN3R5e7De4brlC32p0lJp23UNLo0kod+nrq6f6fpHtvze+VQb26KZFuXyINLHh0 Rq+g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=DTalULef; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lsBc+rA5; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a637118000000b005303b06db67si20018773pgc.638.2023.05.17.00.02.38; Wed, 17 May 2023 00:02:50 -0700 (PDT) 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=@oracle.com header.s=corp-2023-03-30 header.b=DTalULef; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lsBc+rA5; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjEQGeN (ORCPT + 99 others); Wed, 17 May 2023 02:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232388AbjEQGeK (ORCPT ); Wed, 17 May 2023 02:34:10 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4294035A0; Tue, 16 May 2023 23:34:03 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34GJxVmI010616; Wed, 17 May 2023 06:33:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=7HlQ/hvjBTYxfxKMf9QB/NrCL4m8My7K0TH53DzhVWU=; b=DTalULefyVPaT6SYbkWQ6ueEsup7RXnl0aFt6cgaYihLlRVsOmX70IbkOw3xKoBeh99C GDVvmjHbKddk+4jnGe2qu078vv3DBOhuC+mS1R9LtFvzu4xbT/eAfMjfc286m1UC2u4X k10mcmZjQqwcIUKEuc/Bl0JtyBfz6fz6G00W91csdMgXmscShH1kWN3MpR3zZY307now UK0bZ7cz6nj+20sVigG5Sq9SRHNlzaC5rIixitAZxJHmAPMjI9B05RPobrZAYdn+aMub KAjj+X097sK842UU7weTWXR3uTyvKj+4e/gUKBtCCNZcAnLe3MNnDA/rQ1TZ6Qch0n1o xQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qj1fc50k1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 06:33:52 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34H5r7YE036503; Wed, 17 May 2023 06:33:51 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2044.outbound.protection.outlook.com [104.47.74.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qmm0211hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 06:33:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hmuYgFnLqqo1VVN16ACD1hZroDmEHB6OZciBuF5UDpel3L0ldBHFo7zOTA6/nx2SQoqtWF0UmZNPAaGSn1So7Aiz/gFiU3kuFHaQV7Mvjyl6IkL5EB4i6FV44nvGz/6S8ntj83ueQU4ApmiYsDesvIxQEczTHuQfe3nYe3F/Fa3BG7piuAcAyIp2KubZp3IjNgRUKDSE+WtXGXAIdO9msBswKBa3ptqTmVi6jP7iQWO2MrVojgUdbQGEmj4RqZOipOo/zEFUzgSs5g++XGlHin7/zb9SBj88MHv31Wa+AAAyOdiCnuMKBJIkE0sYEr8CJRQR9pwcL82cHubKJwK+/w== 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=7HlQ/hvjBTYxfxKMf9QB/NrCL4m8My7K0TH53DzhVWU=; b=AnwKQ8vWHTNZoAsr6fK6uthBdMvp72rqdylHSOQOU7O5cVeCIjIUqfUvGwg8bMacUjCwd0xgoDnywDolKuJa9gshOixOIdxHbkqqcYlmLoG39Pp96rr6HlwjRFFLxktrANbnBGI05EVv+hAaSQcLkXaS9eiLcL7ad80bwEsDG22i39ZtJ7KKgTzA8yF7/XLofu194QrRkcFxx5SCvQDZcki8kyPiJ7OYonHIkSMJwSHDb7Wiw63XKb/4C0d+HonfQse6jJC3qOt2siku1RAkLeyGURZX3alw3vChGZsL4OtdRUlvo31ZTA6zCRisF0fyG3rckO8n2JpYohfxxLt2ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7HlQ/hvjBTYxfxKMf9QB/NrCL4m8My7K0TH53DzhVWU=; b=lsBc+rA5ssZvptLo6vsjn+IRrYDLaQ2XRgBmd26Qi6r2FFcZVDWfigc0bQY+uiKXleNFp/Q6mJZKYJKic2zr2MJ+7JO0J0yxU5rc7/tkCeBw7Vvbz13jQG/7iOOpy3skfHiD7ZuuyQ+gsJaLV/cw4H8LCtvFk375zb2wuNl3rio= Received: from PH8PR10MB6290.namprd10.prod.outlook.com (2603:10b6:510:1c1::7) by CO1PR10MB4769.namprd10.prod.outlook.com (2603:10b6:303:98::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.32; Wed, 17 May 2023 06:33:49 +0000 Received: from PH8PR10MB6290.namprd10.prod.outlook.com ([fe80::68c5:330c:d234:3834]) by PH8PR10MB6290.namprd10.prod.outlook.com ([fe80::68c5:330c:d234:3834%7]) with mapi id 15.20.6387.032; Wed, 17 May 2023 06:33:49 +0000 Message-ID: Date: Wed, 17 May 2023 12:03:39 +0530 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] module: Fix use-after-free bug in read_file_mod_stats() To: mcgrof@kernel.org, linux-modules@vger.kernel.org Cc: linux-kernel@vger.kernel.org, error27@gmail.com, kernel-janitors@vger.kernel.org, arnd@arndb.de, dan.carpenter@linaro.org References: <20230428055933.2699308-1-harshit.m.mogalapalli@oracle.com> Content-Language: en-US From: Harshit Mogalapalli In-Reply-To: <20230428055933.2699308-1-harshit.m.mogalapalli@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR06CA0238.apcprd06.prod.outlook.com (2603:1096:4:ac::22) To PH8PR10MB6290.namprd10.prod.outlook.com (2603:10b6:510:1c1::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR10MB6290:EE_|CO1PR10MB4769:EE_ X-MS-Office365-Filtering-Correlation-Id: a10ef531-5ce9-4d21-00f8-08db56a0ac4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GH9vm1KQ1ygWHLPO2QJCbJ/gvaaA8S7qE+x13DAa8lRKgZebTkrwACvYmwMOvYsEZbFVWv39nFC4IW4+DSq5ub+K+0LwgUQVdIHt2B+7pN+SVZ2kInbgyuzpZ5KYeO/w41835JsM4gbvW1vZu158d/UjHIFL6klem5HlCPQ6RaJYL+JUZtzT4dd1KxtSgBg+ENeGrVO6b/idgj78Y3YHb8enIHNfdKCIvp9LWAeoWNX7Xy+OgclJAg+58MOOxw4mhyGOZSC++QqDtk1vwyykbsgQgvUJjtre7jUr8RrtA4Wb6cpkEh1/23jndL1Du3oSHKQqp5H84nHYUFyKNNO7yNI0EmAe8BSwZ61neBupuutlmMSThhn0qI/j5+jGOc43sLr2JNyYkctde35QYIVib6fqj74UC/+vODN+kfTNRm89eCHuGn/qetJ2GZeKlUlhN6lT2zbooKAR/s4IsYF3hPhasqYtIqheQnW8IwndjPbjVzOSV/A7OuB920mYadsW2ZbiWgV4/WkCjXZvqtWhgUPX7lffT7+kacxmsbeiey1q/UMOup6xjmO7JWeojCkMAARmd0Dao8XnxtLcm01O2ATeke8i6pr5zkxmw4QVl3Pq3Qr0b96u24LGgDP6yMXaR3x3KjYsiSUmZ2d5MDZ9EQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR10MB6290.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(136003)(39860400002)(376002)(346002)(396003)(451199021)(31686004)(66946007)(4326008)(66556008)(478600001)(66476007)(316002)(31696002)(6486002)(36756003)(86362001)(83380400001)(6512007)(6506007)(186003)(53546011)(26005)(8936002)(5660300002)(2906002)(8676002)(41300700001)(2616005)(6666004)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rnp0Q0VKZHBJL0Qrc2w1MjJEQlZYN1A3WVF0aWNnNU12WmtJVXlrWFlyNENL?= =?utf-8?B?dWtlbU1WYjkvVExGQ1hHUzIyRVRLS1RYdEJOanhoTGpQalBjeDlPMWU2MDMy?= =?utf-8?B?U1l2RkE0WFZ2Vk1FT1VHL0lNb3VvQW8xZTF4MmFxRElUaWRKUGNvOTg2N3BY?= =?utf-8?B?NEtqUE9XMFpWcUZOODIxTU1pWXhaZlc5NURQVVlIY3orM0xnVjFjclhLTzNq?= =?utf-8?B?R3IzUis3QWZTQjh1N2hCR25vVm4rWW1aMVVKL1htdDBaYXJ3aEpIVHZJYk1W?= =?utf-8?B?ZG1BRXZEemIwUzc1aXhEbkw3NkkwS2FPcmFzN3hSekU3KzdKNTdBeG5ZdG1P?= =?utf-8?B?NCs1Zzh1SzkzSEVQMS9rMHlUaTEwdDNQWHJGSXQ1OGdUZ0pUSkgzUEJLZkU3?= =?utf-8?B?aUg0QVYzQlFGOWUvcldyU3QxYWtvTHJxUy9qZWFLaDFVOVl6dWk4endwb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ternalHop-MessageData-0: OpxOG5YWCuS2NKh7wzsye14RFtDnGpCsAkgwSttAvziPmVir0/FjaRIAbwIeDvbpRmcEMFWJcTNgZQ9g+L/5afbNjv+545KHRgoaGp969qer/mWuafN9sAynvIzRHonzloc2tdJRNlCfhAoZCJZoLaYeHpgFJGtF1O+HEZ5riUxdiNdkknFl00vdbRd2i/+TFYkNSWrRVVHE6P8P/4jfh2zhZHlFyqvllggdSFP4TC8GWocRMmyzFliLcmzf/ajTjror1T8aHLd/JpUEGdLYJDdOKraI7BsHpFsm34/nWZuHCt4t3lE/IdJrZ7YRzTDQEs7+8/97I2dkP0tEWbLIdA7pTlQzH6a4cqhlIBBVgr9e2ZaAr+gVasFOCbLQXufH7erQKDdaGHpXPxZE7qCby4cIESEGns/N+C/s/AZ8t+Wuw/vFklgATsp3fa2xE28xpEAEkLgZRtMn9rjCgJvIrj989JEN3z04gPoiNIVgNHnD15GWOkktcL5TnmyNAeY5CBbE2VwY6aQvlK60C5Hawk9uNQLOhgB5X9095YIeUkc7jNS/xgNz53ZQJZ9aCg3z2kuJIW48YkkNjtc03+phIcR56MICCGhUGgG8jO7pFp7y0hK5SlgvPr/ft/EKsXsaNQuiG1+m8ZftefrP4pvR6IHP+s17plZeJjIyWLo41vLznRvmflFjoPLE59BKVFb19UJNJykUMSVVLI+J5hygZgxOMbwf7QIQkgA4Ad7rOv7DWRVMp+iQaXVgrrnkn/IwKPKdYzR39xXzEMTU7LGs/tdyA+5qM+PV3tWLcMCLrcRgTUhJ4+67c6xRSPxlwSRt9WBBVQmVds+oUMunZFEXnVOknW2L0Tn5bJLmhoVYvrU4mn1Hc+ggcZaT3NVM+2lU X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a10ef531-5ce9-4d21-00f8-08db56a0ac4a X-MS-Exchange-CrossTenant-AuthSource: PH8PR10MB6290.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 06:33:49.2062 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oriB9lVz5zbglsAFxTU56A6zvf5Vbv1bU3wREZuKaOOBVpRDOHqI6YCtYm03Rmh60Fuj/qsukUu8XDTNLhWf12gSEBjaK2WQ075p57SVs9ovv6iFm7JzIDNrZ5tZNeQ8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_14,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305170054 X-Proofpoint-ORIG-GUID: 8rh6YiQC9MrEQxFgr3eQMoAVYfjDPx4y X-Proofpoint-GUID: 8rh6YiQC9MrEQxFgr3eQMoAVYfjDPx4y X-Spam-Status: No, score=-5.5 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_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hi, On 28/04/23 11:29 am, Harshit Mogalapalli wrote: > Smatch warns: > kernel/module/stats.c:394 read_file_mod_stats() > warn: passing freed memory 'buf' > > We are passing 'buf' to simple_read_from_buffer() after freeing it. > > Fix this by changing the order of 'simple_read_from_buffer' and 'kfree'. > Friendly reminder to review this patch. Thanks, Harshit > Fixes: df3e764d8e5c ("module: add debug stats to help identify memory pressure") > Signed-off-by: Harshit Mogalapalli > --- > Found with statis analysis, only compile tested. > --- > kernel/module/stats.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/module/stats.c b/kernel/module/stats.c > index ad7b6ada29f2..6ab2c94d6bc3 100644 > --- a/kernel/module/stats.c > +++ b/kernel/module/stats.c > @@ -276,6 +276,7 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf, > struct mod_fail_load *mod_fail; > unsigned int len, size, count_failed = 0; > char *buf; > + int ret; > u32 live_mod_count, fkreads, fdecompress, fbecoming, floads; > unsigned long total_size, text_size, ikread_bytes, ibecoming_bytes, > idecompress_bytes, imod_bytes, total_virtual_lost; > @@ -390,8 +391,9 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf, > out_unlock: > mutex_unlock(&module_mutex); > out: > + ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); > kfree(buf); > - return simple_read_from_buffer(user_buf, count, ppos, buf, len); > + return ret; > } > #undef MAX_PREAMBLE > #undef MAX_FAILED_MOD_PRINT