Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp781902imm; Wed, 23 May 2018 05:34:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo1gBHKf/rQYp3esLgXC2xdSlwveqzuzACH3dGSeshXC9uf/Z1O8CMv3e3BdUm+WhGH3qZQ X-Received: by 2002:a17:902:b087:: with SMTP id p7-v6mr2772322plr.227.1527078852394; Wed, 23 May 2018 05:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527078852; cv=none; d=google.com; s=arc-20160816; b=P6Nax1kz7kyZZ2idocnLp515xLIECbaK1KCKSY7u/T9qDo6q71Xx/XSbt2+RKBvd44 c+x4QHQACh7lDbGECFL2elvQmEBag8mlspEbi838njLrfw1Kbh/hZXkZnm6BJD2LexBr csOGCQ4lKOdLJvcvDDkjMor499eejQHXmlx9v4zrjIo7fkctQqYTVJdA+4utDt4Y1yI2 UAn3kRrlRnXjNn+F2+dJz+0Emgs1pS6umpzWfHZoTuG1Encp7QxO8edI3CojKa92XXkk H97v521SrEc9FkoWVVDhI/kWWm8p0ccExYB+qz32eqCBUdc76lXK3t6swyFB3SBFMNS4 6P0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=U01klOlooLdKqkXLi9WPj8wKbR4NPdQuRj2VGFu2Ilc=; b=YV3O8KenFjkm0jORqt/KtR4Q9qFvuyhBEji9jFLhg98N6sxHhssnAQnh4kZnBuUcm9 flXjG6Iq0k/u50ngZnRPi26EtuZEKzKLJY/M++P6CCR7Cdq5+rI+XmwRfJSiCOrBfezW ugc1H4oVtgAVWj1WJr9/wpzTGBSJ4DHUmVj1wdoZ0d/kJTTvE9JY4EnIDT8gbmE3Fq94 DtFsmfeYuqy9NjrcBYivXsqyAXqO1/K/FYj4hWht2y9oWdgY9l34eZVFo4h7thLjroCx TkbeI3mM6UgnOzE4wO4eherMeuYcjwHAZAV+oN9v3o1YWB8ST0Gi3WsAy22Kcl1zdjZS Wnzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=AqmcTsJe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4-v6si14641046pgp.336.2018.05.23.05.33.57; Wed, 23 May 2018 05:34:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=AqmcTsJe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932800AbeEWMcY (ORCPT + 99 others); Wed, 23 May 2018 08:32:24 -0400 Received: from mail-db5eur01on0104.outbound.protection.outlook.com ([104.47.2.104]:22888 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932081AbeEWMcV (ORCPT ); Wed, 23 May 2018 08:32:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U01klOlooLdKqkXLi9WPj8wKbR4NPdQuRj2VGFu2Ilc=; b=AqmcTsJeYulfvD6c4FHC5xE/cwdYY/dbaxwY1DUARc449JqrSIrLRX0knmVXQ2hfTF2OCz/+xzmWInnmfgfrMOjrg7Zk4v5UYFegvvbWxqh2iMAAgbF7yYu+NQx/5fQmCuE/M6IZYUIO5xTHtIVGH0BGrlMeRtz5097Mm+c5C5Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from [172.16.25.12] (195.214.232.6) by VI1PR08MB3263.eurprd08.prod.outlook.com (2603:10a6:803:3d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Wed, 23 May 2018 12:32:17 +0000 Subject: Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area. To: Andrew Morton Cc: Paul Menzel , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Matthew Wilcox References: <12c9e499-9c11-d248-6a3f-14ec8c4e07f1@molgen.mpg.de> <20180201163349.8700-1-aryabinin@virtuozzo.com> <4fc394ae-65e8-7c51-112a-81bee0fb8429@virtuozzo.com> <20180522140305.5e0f8c62dcc2d735ed4ee84c@linux-foundation.org> From: Andrey Ryabinin Message-ID: Date: Wed, 23 May 2018 15:33:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180522140305.5e0f8c62dcc2d735ed4ee84c@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0701CA0078.eurprd07.prod.outlook.com (2603:10a6:3:64::22) To VI1PR08MB3263.eurprd08.prod.outlook.com (2603:10a6:803:3d::18) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:VI1PR08MB3263; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3263;3:GQKOVPMTOVehZIze3vTeKzWs1AwHnucXGZuK3XGFjNHxhEB0g099COLcvAKCl/2nQ7Wx2IAoTLpVtIIoy87DaxB7cRvQV15crxWZEe2uF+TlCzeK7J7jJ/uQrHtWjVLsh6bdJqExZULMl5KtFxU0AVn5b77jmvnnA2Pe4u4kJj1WkL6Xq2qkSKfsvZm+xQWGQd8DajfwlpCx35Ij1tSrsJMJdrOOzEvNpCTkIrAYk/jqzluyQUd0WjsYXamYMUhD;25:iVKsSELP3XWFTyXgThHTx6S5gvFrbjF7SNkIukYZX0YelGHOiGrUPXqMYRWjJSzu1NfL8eODWbFv4STmxyOFtjsSRgQNps2Qq4TenscEEG2Wubli+ueQZ8ze2aZ6xyuCpDFwniZ56iLPK3ObrosNSVamGRWN195YGLi6T0mzpafX8BU0WsDFZ4gT60dxdvXx1cpffw0mces1TojHkw83NKpbWZ9d8PxSqGcd4NGx+1E3BaSUC2VmR/Juo9bdrzwo2/XPlDai8EwrQAPgEchJR4wgmHCgSWHZ6A/6pJt/W5jqgGyJTrR7BQ+ACxtB0QCPR9Cc6wfWn849zDVImL4Z/Q==;31:oSOt18SUj8qeJ6+nwSqQ032oS06v3VikdRPAREqtUEPRtCvAqxhMqw0CzHNXS09ajyrKnVzMSFPvTchKl8VBqUduEfhvbSKr+FOWbYs7cWrNoumTKkLnw4M+sajNxaoJu5xuiPusc8ysW9D0DMyFMtIWDKTTn0oec/A5fYQ44VyquBl0vA/G8yvSVmD3Eym3eXFioKUaNEafejv9j5j2AAEOlznvuz1LS/Mwdmzuu2g= X-MS-TrafficTypeDiagnostic: VI1PR08MB3263: X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3263;20:/XEIoy1lHgcRFyWv2c1VxjpYOjnr6dIvUpkq+thSIwRE85ey5IlLMtTXMU5znCZympLHYmG02jybHTTeK8uWfSbx4I02+LOvAGPwsyAYgaDKSleIJVOwW+mdJCJ4ShjBVRSh3xnJ/mWa2LMf903Fw8dMJo2aUl6/ndryU+8958pskHytEphZQRt+sPOvzUOiQyYZ1BseN9ct9qNUj1KmpICLmD0j2uNyOqErAkpJgT5XnWeuOxvCUQBqyggai9RQXbrpJas9O8exQVhcfSLydaL1yyqsnill8hiJGLjXAZSjZ9DhvLQ2Euc4Qf3JD9W4qoJ9sUOM4TfIypQDFqTlyv5X49GETmm1J5ShBvYxOVJKJGa45iNXsv2fVb+k9qp6C45lZlqIhiwLOyiLoKq+COzqCn8v9oSq71pqYjfP741PGNhxyQpBPpN0ULkIWMBsAQFS/f643pOEvAhFqdaTQL4Nq42w+I6awqM0iGm3sk72ktTjhFd9ejZ+wCniSL+U;4:MNjRsQm7PbS0HLxq/FcvkFxSpLsE2ei8pvUeDT9nYZGqNAAxCaiAWOSPwk9lG691SpzR9CFdjYwqqxzjFnwvyVAHWm5hpNpSbImFU58/WOfzO8lYJcnTOanC82IhniSvP0B77DCrUm1B/sdayflC9KW72ccW8QIPmHGG7nAGGYHyUBbG2Gvr5vk/29+TFdUZqqoiXXOZnW9+uE2TBJJf0bBs+Y+ABEM5ROS3GjT5tjyMrBJBqTFsTu8TU3nyqKqPESAv6rIE7fXY/vqswtQSHoM5jaz1uiEoCdqTYGQmDbpn3LQLj3IdCccKI9A4uurKxuk6NddjrDTnnVByUOYcmZNPhPcPvIMJ7B2knYqptVk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851)(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR08MB3263;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB3263; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(376002)(346002)(396003)(39850400004)(366004)(39380400002)(189003)(199004)(31696002)(4326008)(25786009)(54906003)(86362001)(575784001)(52116002)(52146003)(2486003)(55236004)(229853002)(76176011)(6486002)(230700001)(6246003)(16526019)(316002)(3846002)(6116002)(53936002)(16576012)(58126008)(36756003)(186003)(77096007)(68736007)(8936002)(81166006)(81156014)(5660300001)(26005)(65826007)(93886005)(7736002)(8676002)(97736004)(478600001)(305945005)(23676004)(66066001)(386003)(53546011)(65956001)(50466002)(65806001)(105586002)(6916009)(106356001)(31686004)(6666003)(956004)(2616005)(486006)(446003)(11346002)(2906002)(47776003)(476003)(64126003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR08MB3263;H:[172.16.25.12];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4TUIzMjYzOzIzOnEzNmFJTFlrUUV5WUtPMm5Dc1pHd3czSXd5?= =?utf-8?B?OUVjVXZyZjM3Nks3UzZHdEJTRGZ1cmViQlREejdjVy8yNzJSdU9NZmhZenNC?= =?utf-8?B?TGxJR1U4U3ZPdWg2Zmh5QTd3b1ZUSWhBdUgvK05Sb3ZvS0toamF6UzYvYzQy?= =?utf-8?B?MkF4WjFTZTBRRElJaExmbjVhR056UCt4RTNEWFJ6ODZGdUx4SDJ5OFFjKzgw?= =?utf-8?B?T3Zaa1B4em5sWmpVaDFyV3hPaGpQQzM2b3JnaGN6TzRpSEpCR0dkMlJwNjM0?= =?utf-8?B?OW8vbnlESkVJVjF1QU9tNlo4SFpZUDNJdkRwNXpaV0h1dWJ5UStaOFVCYU8z?= =?utf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4ljVbiL9kP6PDFTQ8+QcwG+j4gX6jx+WwEyh3Hz2cKTdXqTrSENwlt8KALSa5XF0yRrNnlAWnkU/sE/PB6Qkzn6qaheuSHj56/wbORSwXLYuyc7vCpf3iwUKEGCe9UGMHJ/bHrxMoE3M67PqOLLz+lVXhkgUfBA2YFMJz+8A;20:EC/18PC3Pa8Z7yNQdl/Xvgzv8ElwVFWYxQTxt3gpntl2iSqzEG+xykv01Jxscm7JJtrd9l4UzyJ55dTFpQXfpNjA6a1QtY2yn0ahh0uqST7ncOcPbi38PRLiK9TIxpUcTiG1x68FkSOH5z0BIqPM0kt0GbHh4c/9wSlxJJ3hmM4= X-MS-Office365-Filtering-Correlation-Id: c8a73caf-b2ae-4b93-311a-08d5c0a93959 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 12:32:17.9445 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8a73caf-b2ae-4b93-311a-08d5c0a93959 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3263 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/23/2018 12:03 AM, Andrew Morton wrote: > On Tue, 22 May 2018 19:44:06 +0300 Andrey Ryabinin wrote: > >>> Obviously we can't call vfree() to free memory that wasn't allocated via >>> vmalloc(). Use find_vm_area() to see if we can call vfree(). >>> >>> Unfortunately it's a bit tricky to properly unmap and free shadow allocated >>> during boot, so we'll have to keep it. If memory will come online again >>> that shadow will be reused. >>> >>> Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug") >>> Reported-by: Paul Menzel >>> Signed-off-by: Andrey Ryabinin >>> Cc: >>> --- >> >> This seems stuck in -mm. Andrew, can we proceed? > > OK. > > Should there be a code comment explaining the situation that Matthew > asked about? It's rather obscure. > Ok. Here is my attempt to improve the situation. If something is still not clear, I'm open to suggestions. From: Andrey Ryabinin Subject: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix Improve comments. Signed-off-by: Andrey Ryabinin --- mm/kasan/kasan.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 135ce2838c89..ea44dd0bc4e7 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c @@ -812,7 +812,7 @@ static bool shadow_mapped(unsigned long addr) /* * We can't use pud_large() or pud_huge(), the first one * is arch-specific, the last one depend on HUGETLB_PAGE. - * So let's abuse pud_bad(), if bud is bad it's has to + * So let's abuse pud_bad(), if pud is bad than it's bad * because it's huge. */ if (pud_bad(*pud)) @@ -871,9 +871,16 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb, struct vm_struct *vm; /* - * Only hot-added memory have vm_area. Freeing shadow - * mapped during boot would be tricky, so we'll just - * have to keep it. + * shadow_start was either mapped during boot by kasan_init() + * or during memory online by __vmalloc_node_range(). + * In the latter case we can use vfree() to free shadow. + * Non-NULL result of the find_vm_area() will tell us if + * that was the second case. + * + * Currently it's not possible to free shadow mapped + * during boot by kasan_init(). It's because the code + * to do that hasn't been written yet. So we'll just + * leak the memory. */ vm = find_vm_area((void *)shadow_start); if (vm) -- 2.16.1