Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5326907imm; Tue, 31 Jul 2018 09:06:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc4UJtJCy21h1WuhX3PLA+WdvS+gpM8YG0rd/DF7Z8zP//nT/dmhEW/bPQx0TAdAmXlFMb2 X-Received: by 2002:a63:5e45:: with SMTP id s66-v6mr20986996pgb.151.1533053161058; Tue, 31 Jul 2018 09:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533053161; cv=none; d=google.com; s=arc-20160816; b=CQatUPPLR2Hw1kQ+Gr1uZ1+vvqBeGfdS+XzylAD587g+WVgS6Gfew0Xaf+Jimr0jtV LRde+vBmKsy+OJnkQxOr1XaPgwr99KsaelTvrDYOdQhM7SGNTU29LjGXG0Q1pArHfvfh LHzVS5d1okoYe2ClNNQ/s8E5/mjeGLDy2k8N8jovAOIHnPuExPn1nEodiW+oslauPK3J SgQ3iVP0m7HiR1S42zRMIJkG80PDWkYAhVzKfe3YLG2h0nfVDTgmGhAnKoz3093Qs9bF SuhCXt44UhRk8zylUSPbisSPffUG3mrPelrsvO8IBrL6GCZOBlKdTRfvF9tEt5pxDzUE CXqQ== 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=rR+HKkO9+n87WQnFtEYHA6nxuq1/6lPipeg8wd5q+aU=; b=xD/Ja7Us0aXKo9mwVNwroU6a5C6a7la5tmclKrDksIl0tpjUlbR3vdCoRzkOQn107h z2RsfiTe/ZZkZ/Ij2YXqbjLivlR7PeRKuy5s5LtZtMBwFosmNB8/NZz/MaOqn0IYA93G zgBYFNswtG68XjUTCCwf/vhBi2yOyOkPt8SSk6vnBMULJRL5UdhzVzHVAfV8pFNekcHW Nj7VaS9li/+Flz7+n5hKNsX1LI0pyQ9zRs428n/wp7PG5iXli7ejJTKg+ETel3Sh77dp Ommf0c/eSJiwdFlC+FqlIMJxjpEotR4p4qx1fmpTz7fFyl7Vl8Jp15GJ4WG5zwkYDtxY Rwmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=JMhmOZ3i; 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 y5-v6si12099874pll.89.2018.07.31.09.05.46; Tue, 31 Jul 2018 09:06:01 -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=JMhmOZ3i; 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 S1732509AbeGaRpf (ORCPT + 99 others); Tue, 31 Jul 2018 13:45:35 -0400 Received: from mail-db5eur01on0126.outbound.protection.outlook.com ([104.47.2.126]:22517 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727063AbeGaRpf (ORCPT ); Tue, 31 Jul 2018 13:45:35 -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=rR+HKkO9+n87WQnFtEYHA6nxuq1/6lPipeg8wd5q+aU=; b=JMhmOZ3iJY0mA4oPbhDih4znPwd2d2rsM1p+F5rH8fBDwRObH3GxbZPGu42hdmwMFUCnUl7XSdQNTao0QH4EO9B4cn3PxB0tPFI3Sl4JFCocJOW+Ljx7K9atTB8N6z1rfrMG+OW15fsNnIRYyPGFf5yLkhc3OMgYPaFQV/WTogo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from [172.16.25.12] (185.231.240.5) by DB7PR08MB3257.eurprd08.prod.outlook.com (2603:10a6:5:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Tue, 31 Jul 2018 16:04:26 +0000 Subject: Re: [PATCH v4 13/17] khwasan: add hooks implementation To: Dmitry Vyukov Cc: Andrey Konovalov , vincenzo.frascino@arm.com, Alexander Potapenko , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov References: <09cb5553-d84a-0e62-5174-315c14b88833@arm.com> <8240d4f9-c8df-cfe9-119d-6e933f8b13df@virtuozzo.com> From: Andrey Ryabinin Message-ID: Date: Tue, 31 Jul 2018 19:04:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR05CA0211.eurprd05.prod.outlook.com (2603:10a6:3:fa::11) To DB7PR08MB3257.eurprd08.prod.outlook.com (2603:10a6:5:1f::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe8bead1-caf6-4465-ccda-08d5f6ff4c93 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB7PR08MB3257; X-Microsoft-Exchange-Diagnostics: 1;DB7PR08MB3257;3:fKxdAXx4Mdq2DHoTGPgFss1FdMzLwZhNyJ7rez0j43jorhJYOjR3N34DG2BCo9+QZiDvU/uB2DubBu6DVKu4gSfohuo2UP8j7ZQ4mL6RjmpKKZfIBcKfyD5alxKlWHnmSZLI5Elo27awWziyi1nKOBsH++cOKnmDX2gscYY3b0Z/Xly1lmTuMjSoShKKvluZ4SJDuODXqXBc1PJa52TaBea819ux2jrdyCo6My3J21cZCTKCpBFA7J7lPhvDMEz/;25:L7Vz5OBL7bY5AnDJzXj1rESAKGhPqlGtlQcrzHiFkZBzcoLMleBnTu88i/rjMti6DfKUoHXsNsfVmA1cuyGXdUyWFT1xxk4kyZ7T489qdKXL4n8LDLgBgSVjvq4TFL5YPAr9bBYurdEvwub6Bv+Y5llRaMPLVLKG+3NtQy8X0CCmmR9BvmYcovCu8FWJIiHKoe0FveZzW/bhvy9jjZb1nBU3iEX3NUNj08hb0g++1WCn0nlDEKFYVdoofOQ0lP9hnxMPwtKnpSR2YZA3e/bbivJ9+Q9Li3aJfp76N2RC1eXoCVPNMinDlNeZJKUg/EDl/PNZfvmJNGh6F/VbpHHh/Q==;31:HFLSrkwDB4pOb4VZIt2vtiPHXBiV9Z2yxV67emUkkT4wlyh3YAxnVuzYVqozmXor+AH3e4gsB0B11HvE4i+TcSpUrU9sTkf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Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DB7PR08MB3257;BCL:0;PCL:0;RULEID:;SRVR:DB7PR08MB3257; X-Forefront-PRVS: 0750463DC9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(366004)(396003)(136003)(346002)(376002)(39850400004)(189003)(199004)(14444005)(446003)(8676002)(54906003)(386003)(476003)(58126008)(81166006)(26005)(81156014)(2616005)(76176011)(93886005)(956004)(316002)(53546011)(64126003)(25786009)(77096007)(6306002)(2486003)(53936002)(478600001)(11346002)(305945005)(3846002)(47776003)(16576012)(2906002)(65956001)(66066001)(7736002)(6116002)(97736004)(8936002)(16526019)(105586002)(5660300001)(23676004)(50466002)(65806001)(6246003)(52146003)(486006)(36756003)(6486002)(65826007)(106356001)(68736007)(186003)(52116002)(230700001)(31686004)(7406005)(4326008)(229853002)(31696002)(6916009)(86362001)(7416002)(507254003)(556444002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB7PR08MB3257;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?MTtEQjdQUjA4TUIzMjU3OzIzOm9CYWJZdk1aSUdnSjBnOXgvTTdCRE5XZEs4?= =?utf-8?B?UEs4T3BYUFlpVUVaZlVvOXY0Rzd4MWhDK2dkM0NPM1ZqbHBMZkw0VG1nVzM1?= =?utf-8?B?Qk80K1l1NnRaVy9CNjJ1S3NkMEs3V3c4R3l0T2lKQVFMVDgzVTU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uQGvmDQoyl/Nuip5Pg==;5:CCa82Q077eeROeucHVpLtRLg/v9r5/L95m7YYQazgPDUT17uKInOk2WfLi8D4oy3qdp1p3OZkVXfGil1reKQ+6lg04UDSeZcjlBEhMcHnW5O7zkN2f/x59n5jzBYGxPCIazPoxyhni0WY6TbqutSDMZK3hGL1GOoMu0YvZhESMc=;7:DqZaOMcTmSv0/HBhxpXsvObb5Nosf6MMy36C6EuzZZrYgMwOjMl/SiZ4c/tThz4i/qCw5Doh3ZAnVxl6txiZ3G3ETkGVY/xlO2wo3b6WM4+u3BEzHKfzjN6/8cIWN3TxCgwtwQT1TXmsCzYoYPF//cyIlwZBsikuJUpEcdc4C+SxQ4SNsjSxF84/7Q57B0hA5E0o9R8sQlEoRvxr8KwTWbXR3YFSxt6zREyGyR06LLTVE3DoSnHcwT5NxZ0PU/Ot SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB7PR08MB3257;20:f8ilW5mL+bwkY8wo1mhIZwmBgZhMVETLy8pgTy/Pxao7Yi2BaUbp4HuJJYkpsGd8fa48IteYzDcBv1geDI+4JF4G94bVi26MNNueKGO0PpiDic5r2PiA+knL2S1ncehDSIFRQOptcotV7HoqN+0gjwWVBdOesmmxDqX7p4oLiDk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2018 16:04:26.7405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe8bead1-caf6-4465-ccda-08d5f6ff4c93 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3257 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/31/2018 06:03 PM, Dmitry Vyukov wrote: > On Tue, Jul 31, 2018 at 4:50 PM, Andrey Ryabinin > wrote: >> >> >> On 07/31/2018 04:05 PM, Andrey Konovalov wrote: >>> On Wed, Jul 25, 2018 at 3:44 PM, Vincenzo Frascino@Foss >>> wrote: >>>> On 06/26/2018 02:15 PM, Andrey Konovalov wrote: >>>> >>>>> @@ -325,18 +341,41 @@ void kasan_init_slab_obj(struct kmem_cache *cache, >>>>> const void *object) >>>>> void *kasan_slab_alloc(struct kmem_cache *cache, void *object, gfp_t >>>>> flags) >>>>> { >>>>> - return kasan_kmalloc(cache, object, cache->object_size, flags); >>>>> + object = kasan_kmalloc(cache, object, cache->object_size, flags); >>>>> + if (IS_ENABLED(CONFIG_KASAN_HW) && unlikely(cache->ctor)) { >>>>> + /* >>>>> + * Cache constructor might use object's pointer value to >>>>> + * initialize some of its fields. >>>>> + */ >>>>> + cache->ctor(object); >>>>> >>>> This seams breaking the kmem_cache_create() contract: "The @ctor is run when >>>> new pages are allocated by the cache." >>>> (https://elixir.bootlin.com/linux/v3.7/source/mm/slab_common.c#L83) >>>> >>>> Since there might be preexisting code relying on it, this could lead to >>>> global side effects. Did you verify that this is not the case? >>>> >>>> Another concern is performance related if we consider this solution suitable >>>> for "near-production", since with the current implementation you call the >>>> ctor (where present) on an object multiple times and this ends up memsetting >>>> and repopulating the memory every time (i.e. inode.c: inode_init_once). Do >>>> you know what is the performance impact? >>> >>> We can assign tags to objects with constructors when a slab is >>> allocated and call constructors once as usual. The downside is that >>> such object would always have the same tag when it is reallocated, so >>> we won't catch use-after-frees. >> >> Actually you should do this for SLAB_TYPESAFE_BY_RCU slabs. Usually they are with ->ctors but there >> are few without constructors. >> We can't reinitialize or even retag them. The latter will definitely cause false-positive use-after-free reports. > > Somewhat offtopic, but I can't understand how SLAB_TYPESAFE_BY_RCU > slabs can be useful without ctors or at least memset(0). Objects in > such slabs need to be type-stable, but I can't understand how it's > possible to establish type stability without a ctor... Are these bugs? Yeah, I puzzled by this too. However, I think it's hard but possible to make it work, at least in theory. There must be an initializer, which consists of two parts: a) initilize objects fields b) expose object to the world (add it to list or something like that) (a) part must somehow to be ok to race with another cpu which might already use the object. (b) part must must use e.g. barriers to make sure that racy users will see previously inilized fields. Racy users must have parring barrier of course. But it sound fishy, and very easy to fuck up. I won't be surprised if every single one SLAB_TYPESAFE_BY_RCU user without ->ctor is bogus. It certainly would be better to convert those to use ->ctor. Such caches seems used by networking subsystem in proto_register(): prot->slab = kmem_cache_create_usercopy(prot->name, prot->obj_size, 0, SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT | prot->slab_flags, prot->useroffset, prot->usersize, NULL); And certain protocols specify SLAB_TYPESAFE_BY_RCU in ->slab_flags, such as: llc_proto, smc_proto, smc_proto6, tcp_prot, tcpv6_prot, dccp_v6_prot, dccp_v4_prot. Also nf_conntrack_cachep, kernfs_node_cache, jbd2_journal_head_cache and i915_request cache.