From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5552C4332F for ; Mon, 30 Oct 2023 11:32:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D8856B019F; Mon, 30 Oct 2023 07:32:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 361B06B01A0; Mon, 30 Oct 2023 07:32:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DAE26B01A1; Mon, 30 Oct 2023 07:32:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 070B76B019F for ; Mon, 30 Oct 2023 07:32:53 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D43C81205C5 for ; Mon, 30 Oct 2023 11:32:52 +0000 (UTC) X-FDA: 81401915784.10.4084687 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2104.outbound.protection.outlook.com [40.92.74.104]) by imf28.hostedemail.com (Postfix) with ESMTP id 21A45C001A for ; Mon, 30 Oct 2023 11:32:49 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=mE8jRvB8; dmarc=pass (policy=none) header.from=outlook.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of juntong.deng@outlook.com designates 40.92.74.104 as permitted sender) smtp.mailfrom=juntong.deng@outlook.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698665570; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=P0sbShoVaCxZ4fIRI5i+82yMZNf2ZLJdT22vPfLNN+o=; b=LBo9eAWvftSKEC7vH+1FPFTEdZsC0TN9q9PSwlpOyqkvwNJ5tOCgYsKbKjGgitcqh5XSrT imQZqsrovosHzoCibGz4ZdXcDGxSGZXtKrcZpZS1PB7+qcdBnwhr1OmOAANcfyZlLNX9DD bAhqVDJ1LWNi1y5DQdLPJQqO6887078= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=mE8jRvB8; dmarc=pass (policy=none) header.from=outlook.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of juntong.deng@outlook.com designates 40.92.74.104 as permitted sender) smtp.mailfrom=juntong.deng@outlook.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1698665570; a=rsa-sha256; cv=pass; b=5H+peQceCkkVHCGHhoG9HaL3OA4JMGVFt6QuKCYZgWRAQlvMzUenA3oGXrhchM5Cn2+HP6 EBj1/NY41SR8rsqB2zBsLvsi3OOYtByVmBvCyTHb2RTXjTM5IWfGytuLt8X+SV8nD+CDV0 jkDk6Dcw9wXqy1T242+4ae+LYZ08W9c= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bps1KWIhO6j3xEawxDykhW6Jd9Q9N6IJwllIFdSZWKkMhh5bImXzSFYWZKhBTKF0OZeq5aECQ5VcIJCah3oqhzeBj+oGfrAh0KWxYF/rvrOunUcGDh7+rtp9bfEzBsWDyOZj4+HzbsvOPm15irjMQTExKqjQ6IgtPxwlhFCaY8yDtxVSLtUj02ARKlJVOpWgXuHQDIOOuvT9XUowjUIpqFLDh/7Z8LCV8iOu+wTtYr5JObtnK8BmzwHk2I9H9vLRQUOe4D18fdn7EnK53nzCqfqM6TjiBWbmmDPnHqPophBLa/zzwF71f2v4lxGKgQlhed9opCRYZwkX3NkMwoMD7Q== 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=P0sbShoVaCxZ4fIRI5i+82yMZNf2ZLJdT22vPfLNN+o=; b=WWLvtRX1AJupGvWef8XFuDee1tBw3g3lfEhAgGzuPvIdhFSVPNjihTt2pFQLVn/PnBhJzb2qYs4yMEqFU/80j4kTg8RD3qKueSyNOjfcEWjsKiiGMzLHf1+9CJj2b0/Diuka5GSKG95BNRehajhuhfsZYK3bVH12u1teGDhun6572HPhaPeDJjnt53Qc+xYovG5LAG2CXL47hWhzJN8VGJ6hTgpwWEiOenJPyto4ILxqY7GD5TBXiYXSmcoxDIywx5rSSiPyH1xJZ+J66sLKN7DHmzvqTPR8fbj2QhNDmAW5Ao9qcIbaE83mQBOtxSK7r6d3c36aWQdiAzCpyE5UkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P0sbShoVaCxZ4fIRI5i+82yMZNf2ZLJdT22vPfLNN+o=; b=mE8jRvB8VCuHMzUG2Y1DXb7bEE7LHBQ2WuD3D2zBdH1Ltiwa1OQLe44pAZilVMOS8B3DyRYzyI9WPGmzXamDeqJz3I5CdwSUccZBAEfEY6To3EY37gKTRTU6we+PjxxOWUJf82Hj8DaoT9cuvOddI3NMhAbHwPdS9H4qRCA4/j4itWocHrGXTtIldLB6iRC61FOcfkxiVuvqEFllGnweAbkp+OFCQHjubimIXDJzxh86GMCTq6D+XtgdY7/A8EE4AFGxMOw4DnF6LTi1UEnu8P0xwWYVANpSUIhodHdSUvsUA4/EUlB0ecEwdXsQ6J8Td9u6WbBZIilwlG4EuBwBWA== Received: from VI1P193MB0752.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:32::19) by PR3P193MB0976.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:a0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.28; Mon, 30 Oct 2023 11:32:47 +0000 Received: from VI1P193MB0752.EURP193.PROD.OUTLOOK.COM ([fe80::2db3:2c11:bb43:c6e]) by VI1P193MB0752.EURP193.PROD.OUTLOOK.COM ([fe80::2db3:2c11:bb43:c6e%5]) with mapi id 15.20.6933.027; Mon, 30 Oct 2023 11:32:47 +0000 Message-ID: Date: Mon, 30 Oct 2023 19:32:46 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] mm/kasan: Add Allocation, Free, Error timestamps to KASAN report To: Dmitry Vyukov Cc: Andrey Konovalov , ryabinin.a.a@gmail.com, glider@google.com, vincenzo.frascino@arm.com, akpm@linux-foundation.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, "linux-kernel@vger.kernel.org" , "linux-kernel-mentees@lists.linuxfoundation.org" References: From: Juntong Deng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TMN: [OqsKE/zsmXY4SJnsYIcDvATGT24dPw4u] X-ClientProxiedBy: LO4P123CA0556.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:33b::6) To VI1P193MB0752.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:32::19) X-Microsoft-Original-Message-ID: <50303875-57fc-4012-ace7-38dfca2c3be1@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1P193MB0752:EE_|PR3P193MB0976:EE_ X-MS-Office365-Filtering-Correlation-Id: 31628e30-aa93-4b27-a5b1-08dbd93bf0c1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uLvzONZU1cAG7w0PNz9V0zus3sIg3ZrbkfjO3+L4n9cVgAebTjVEX1PsZAivn5jK/a7pbDBmzV4TQHvKbg3kNstjA0uqkK8vNM6dnpwH+fUX1Nji34zvy1In39ZDrFzbWmmKWiGhZMMBVfnfOYNm5ib/SWsuHCbykH/AQuZ/KiCtnaCPlzsQavqTxeY5revHKE6Erozjt31TwvUdSP6CpzeS1WlujoHihyr2bn+JBvE44W3c70Pq0WvLL/3Yljc0H0NihA+9IWr2l/+8BJTfmRPThdQlB/JrLkmTXZa0o7csblLXrf1z26Z5s9gO2FGdKqnmoeHV1PgF30ydi6lrmNOJxwzmWPcDeUgmVRBN+uhbpQHjzcbYcTktG7qTevqQd+5k0FyoBIWpyE8+ZQ8fm5Azvub8bf7GEk0V7i2Dvxlm7NAnnG6mTEPWLr99usDh2NV0LhPukc+nu5ULEEvW6SHd+K7BIfoWDRnXSk9Dn/YhGvwCIatgq1nmLsJknBJ5b3IhPgR9QBQPNUBiFLK86z6OrkCW8rtsI/wvpcc+QUyjlax5zIznx0o47c1tkY14oh6vksY8fXuC2LpJT16P3wOqJtV/xL5JJFEP8Y2/OA8= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N2lGVk9kSk9kUWxjSE1XVFR6cG5SSlNrbStuMnI3SndHdjBqWVhjVk9KS3JO?= =?utf-8?B?S1dBMzRNODI4ekxDVG1vVTg2NFFRZFo3TWd2ajFpMjZnditGa21XckR3SWRm?= =?utf-8?B?VnFlNFdyaEc3UVRMb0k2UFZ0RkVVZ2NYb1RINlhaTTIzN0Qwa0t1YUxCbkNX?= =?utf-8?B?VVZxS0RrT25ZOHAxSkFTWld3WmJ5SCttOVoxQVJLQ0dpQVZyQlNXd0greGdp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XFYWHNzQlFuK0c0NmFzUDVWK0JT?= =?utf-8?B?Um9BSHJtQWZ1SEtYZGlNYldnMWxQdmdxK05IVDJKckZhQzVlVFFXZENKd0xY?= =?utf-8?B?TXk0QlNMckhqVDNFOUttS0VWYndwN3VvRXFYbnR5ZTJwU1FuaUFaWlRpV3o3?= =?utf-8?B?ektsNDhLSWw4a1NBdHlXSkZmTGd4T0hXRHY4YWJLbER5L1hIczRUcUExbVNr?= =?utf-8?B?UzZvZGtpeU1iMWdxTFZSSWJLeWY3UmRIczF2OGxOYURVc1lNQUxBQzZ3S1hL?= =?utf-8?B?Q0oybFJMSndrYld6SVdVblo2VTBta2Y1U3B3aHdxdEI0a1lsWG4zdlU0Myt6?= =?utf-8?B?NGh5bTMvMjNvQUJSajl4bEtvK1BjQ09JV1RGdVZWODRxMjQxWGNjRzNJaSsr?= =?utf-8?B?MWJhU2lxdndCRzg3eTgyc1pGbU54bW9QMG5rU0NPVHFEV3lpb0lwUG9RbHJ2?= =?utf-8?B?UWh5T3p6ZVRRWHg4Q1poMWFSTmZUK2x5SVdFNEtCVysvb3c5bGc4amljOUZK?= =?utf-8?Q?R/ujq4WvnGQtE6GJaS4ZOSr7CC22kEWVvT6gKixGMKfI=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31628e30-aa93-4b27-a5b1-08dbd93bf0c1 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0752.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 11:32:47.1352 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P193MB0976 X-Rspam-User: X-Stat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rmPegMFSgVpwkWj Z9pJCeys RxqzZvbhuCStj9OfWz2JkurRMzcD0rjtuoJZ9edjAh6vla5UeMdi1JVmhy2NQo4C/jqIBoeg3Yi7O8oxWn8P53Qcu1v4wFlf9kpixRe9/1S7yoxFjaMy3F29jDhPfukxuk6ujz/4fRrtXqeW6C95qiW0I546TreFUfGFxCdBpQ2G5uPUKAjtNLHL+Z2p5or+CdtVkItyKQCX2HNwYhDTFjBA4rVjFzsN3iu0vcL2xmwwDJ5w5XrppjLD6U3MbPRQbB498cFJ2bb+gTBmR5gXwGscGu7m7N0Opl/I2itjhcpGgOr6DzGK2Im3NDo/rJhLq0VG45dRyVmqoI4/d2BMbWwthaEnf4HlTNQ8XBEB1W830lzeGwOwRKmsCCca/QMhT5148L9T8SRRvf20KCf22JELo/V9eSFeK091w1hsY69MwbJZ+GnlyXy0qDBTYelfPDLR6BWj6OBzf0VXt9qGNO613RxmqNlM0zjSakOXL8FMkc1I48UV7e4cZyss3ntsr2X4NycqJlatmfNqFlZFa2+UtNbmLBDZmVPHIDpos4hWT5AKv9uFRdtelkKtE7qZa7JN3+17p1AfblVJKR3P7mD2oLS+7xrOQPnwfctoNEESIt8sac1Xbh1nHX7cQ1Q9oIcmmXh1N3IrF/hc3thU+XLAUvxVVTEaWP7pUozuFTffOyGrGWxhsu9+MTtYZ+rOGibOhH4oLU6GIkdMNUqfKpLDG63+ibF5gXqbnMvtORqbMCy4UsnuO/3ywRegnz5XYStKcwMH/3teSHgybUAn5VlDpBw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.131666, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2023/10/30 18:10, Dmitry Vyukov wrote: > On Mon, 30 Oct 2023 at 10:28, Juntong Deng wrote: >> >> On 2023/10/30 14:29, Dmitry Vyukov wrote: >>> On Sun, 29 Oct 2023 at 10:05, Juntong Deng wrote: >>>> >>>> On 2023/10/26 3:22, Andrey Konovalov wrote: >>>>> On Tue, Oct 17, 2023 at 9:40 PM Juntong Deng wrote: >>>>>> >>>>>> The idea came from the bug I was fixing recently, >>>>>> 'KASAN: slab-use-after-free Read in tls_encrypt_done'. >>>>>> >>>>>> This bug is caused by subtle race condition, where the data structure >>>>>> is freed early on another CPU, resulting in use-after-free. >>>>>> >>>>>> Like this bug, some of the use-after-free bugs are caused by race >>>>>> condition, but it is not easy to quickly conclude that the cause of the >>>>>> use-after-free is race condition if only looking at the stack trace. >>>>>> >>>>>> I did not think this use-after-free was caused by race condition at the >>>>>> beginning, it took me some time to read the source code carefully and >>>>>> think about it to determine that it was caused by race condition. >>>>>> >>>>>> By adding timestamps for Allocation, Free, and Error to the KASAN >>>>>> report, it will be much easier to determine if use-after-free is >>>>>> caused by race condition. >>>>> >>>>> An alternative would be to add the CPU number to the alloc/free stack >>>>> traces. Something like: >>>>> >>>>> Allocated by task 42 on CPU 2: >>>>> (stack trace) >>>>> >>>>> The bad access stack trace already prints the CPU number. >>>> >>>> Yes, that is a great idea and the CPU number would help a lot. >>>> >>>> But I think the CPU number cannot completely replace the free timestamp, >>>> because some freeing really should be done at another CPU. >>>> >>>> We need the free timestamp to help us distinguish whether it was freed >>>> a long time ago or whether it was caused to be freed during the >>>> current operation. >>>> >>>> I think both the CPU number and the timestamp should be displayed, more >>>> information would help us find the real cause of the error faster. >>>> >>>> Should I implement these features? >>> >>> Hi Juntong, >>> >>> There is also an aspect of memory consumption. KASAN headers increase >>> the size of every heap object. So we tried to keep them as compact as >>> possible. At some point CPU numbers and timestamps (IIRC) were already >>> part of the header, but we removed them to shrink the header to 16 >>> bytes. >>> PID gives a good approximation of potential races. I usually look at >>> PIDs to understand if it's a "plain old single-threaded >>> use-after-free", or free and access happened in different threads. >>> Re timestamps, I see you referenced a syzbot report. With syzkaller >>> most timestamps will be very close even for non-racing case. >>> So if this is added, this should be added at least under a separate config. >>> >>> If you are looking for potential KASAN improvements, here is a good list: >>> https://bugzilla.kernel.org/buglist.cgi?bug_status=__open__&component=Sanitizers&list_id=1134168&product=Memory%20Management >> >> Hi Dmitry, >> >> I think PID cannot completely replace timestamp for reason similar to >> CPU number, some frees really should be done in another thread, but it >> is difficult for us to distinguish if it is a free that was done some >> time ago, or under subtle race conditions. > > I agree it's not a complete replacement, it just does not consume > additional memory. > >> As to whether most of the timestamps will be very close even for >> non-racing case, this I am not sure, because I do not have >> enough samples. >> >> I agree that these features should be in a separate config and >> the user should be free to choose whether to enable them or not. >> >> We can divide KASAN into normal mode and depth mode. Normal mode >> records only minimal critical information, while depth mode records >> more potentially useful information. >> >> Also, honestly, I think a small amount of extra memory consumption >> should not stop us from recording more information. >> >> Because if someone enables KASAN for debugging, then memory consumption >> and performance are no longer his main concern. > > There are a number of debugging tools created with the "performance > does not matter" attitude. They tend to be barely usable, not usable > in wide scale testing, not usable in canaries, etc. > All of sanitizers were created with lots of attention to performance, > attention on the level of the most performance critical production > code (sanitizer code is hotter than any production piece of code). > That's what made them so widely used. Think of interactive uses, > smaller devices, etc. Please let's keep this attitude. Yes, I agree that debugging tools used at a wide scale need to have more rigorous performance considerations. Do you think it is worth using the extra bytes to record more information? If this is a user-configurable feature.