Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5342402imm; Tue, 31 Jul 2018 09:20:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe7PnECetRK+ivYLl3Z7guFSMMI+X5rPxiSAouk2XrfQFc2qExd4caHncdAjRsuM8lfL5jZ X-Received: by 2002:a17:902:8215:: with SMTP id x21-v6mr20904075pln.175.1533054003497; Tue, 31 Jul 2018 09:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533054003; cv=none; d=google.com; s=arc-20160816; b=C6fKW6dimalsC6IR1Jc+LurEUghp0sTZ2WG27LijyqYkD9DquvcP3EknlyTNwyJNRi o4DJCGCFdZhXlzvGtN6AsBU5fEWVcf+hWCPx68igrfwuowk5oNut5l+G/fyqiHJLgQx1 NfUn2iawcCwo1aG+CF34WHJQAizoEKJXpCyaFIsy3R70x+USE+MBBkuobDB+gfaPqfSe HMcb78pDv6CsI7Q7fXacciWncrlXZANMWdb2PAIzH7qSJ8RxvuMMJaGL+B9YdR2pypHD u4CvKdAvughUuuqqaZk4wD147gf3wxF0yHjFR9aM2Vz904aOG4nYhYqj7Y3JYDt7SFxO 5yFQ== 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=prNRmbTWCGNYBo9BOWKiszbpzKL2QcSpGHlWGxZbME4=; b=C0o7KSio3U2cUpaoxKF1VcXQlT0yb/Pmx843/pJVceif2bVL1FSmAUE21HtnCfaIVw reWSjngvsS+NfuQk5NcteO+sl2sesLQITtW4V70g1PESnVY4shh73Ji9NYSv1d9XWYEM nQ3rWLBqB5Fu+IMkD2UBJFOWuk3na0wSLgLV0fhxAzfi4nmuu3/aoVi0HoK4DZR2e6Ss ncEJofyXYxZMCx0TpI9aSQ2OZLYDlj71S5Qv8/2jKbK68BJOG6nV4BAOs7O0ajTIVRHn d2U1T6e4cALU9xW9WML+SmxPWIjJX4ILifY8Wv8SnEB49t84NFytKGqsl0NaUYkG6WLe vWXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=La8Xrf21; 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 s10-v6si14030768pgh.6.2018.07.31.09.19.48; Tue, 31 Jul 2018 09:20:03 -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=La8Xrf21; 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 S1732429AbeGaSAE (ORCPT + 99 others); Tue, 31 Jul 2018 14:00:04 -0400 Received: from mail-db5eur01on0119.outbound.protection.outlook.com ([104.47.2.119]:13126 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727063AbeGaSAD (ORCPT ); Tue, 31 Jul 2018 14:00:03 -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=prNRmbTWCGNYBo9BOWKiszbpzKL2QcSpGHlWGxZbME4=; b=La8Xrf21Pbhnk6OwgEyTaJyJe4obHplh/6Piugyu/gwCOJsDiPyZHDcFOyx/gPFJF46J6hviklxsBq8bKo84oL2PWC6zw7xycHSuhMxvFvXAkx/wfjnQ2l+/0uUstgfuJCWpHMso+l1Bu0mSV6HiW43Z5ghuVblPOiWNUp1G4OE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from [172.16.25.12] (185.231.240.5) by AM6PR08MB3254.eurprd08.prod.outlook.com (2603:10a6:209:47::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Tue, 31 Jul 2018 16:18:50 +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:18:48 +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: VI1PR0202CA0026.eurprd02.prod.outlook.com (2603:10a6:803:14::39) To AM6PR08MB3254.eurprd08.prod.outlook.com (2603:10a6:209:47::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df56459b-0c2c-41e6-9b06-08d5f7014f00 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM6PR08MB3254; X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3254;3:c/wgCYeGqGfdheHjoUKaNxmGeCzXBE7DUmGMi8hLtEbUTk0iocBw5Niyu1or3pOfo34tyg8brTFc2dcimzfO7eA6MZ3DJcLgv7gWIJOt4pCVeihjHzFmDLU06jC4Gcmbr0kNc66ZaAXGwHrlaovoQOseeMV/ae8j5qXdUbDm2vqBWP6U6IPFJNS06HNdGURW3xcCJ9e4CLv5Sb4Rxyl2lNh/g6MywGorra2NKTyL6LTp3qf+ygG2GbWR1Vc9umGa;25:NzIT6XPKP80+nVPjeP41MArj2I9iyFXxv+a1RfPmle+JiKrQS3stbrbNwIK7AaFmrh7CY/con20QVi5DS90AMxYiF71Qm1zeLmHFWe3TeudefYLQ7BiQsLkmcTIJFTaB+gdkwUAl4vUpWFxTpYn4YCHc67nnqba3f4D+a7PJe5mr9kBQQ5EZYJ/j1pHc0aHLG9vtKAYwOOES/0dp+1kK1EzKvpbVeUPq8V4V1ROLfcTha4ka2mlFBqXAHfapUSik0HhmTw8NFKl5jkNEsCQYy/fxnawiFJLZOAhB8gl170eKo+dJwSKOxQjmnamEJk18Zg6sWDCD6baYqBcQiEYzRg==;31:MG4knPC2oNSrVrnfnVHWpH1WSJfcXvcEPXeIknE2MH3wjv/CLiiP1G224iOFUaHl1t4JzQRsq1utLZ9to8PljCKdvDsSpYo33RhkmQXuy6qa2ynfHYqWhJkurPXfBnZGFpazxbsklVgXkDUrsP+k+/KpxlcUmGI4t+qt8SeOPUrRzEfAIJzohbV+h7LJm/d1OQaVH419/F7DDseLSLQqeMO7hYeKNlhy/FGG0bAPYDw= X-MS-TrafficTypeDiagnostic: AM6PR08MB3254: X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3254;20:vpe6ke++Za6v9Fp5MAca5HrKdrRdWeeguRl+ey2RjlUh67ywI/2bmJEE4UWfR0vsu48+CHIvUVqBpEH5Rw+tamvJeWDicRP1ixE5/+ZWccJbkkUkg9XoTIN/1zaZ8YJ1VVrmtgHHGkpsyzLKW6uIP2x3jKpvhpu4q8ifY1r263weaDoUIZuBbelXyt5nFUhz5XQMxxgyHcO5oSy8gonkQJIcgGsC5rekrpnlm6/l6QB+jHLw8hrl9H8GNZmfsjkJ4IaAgEXw6ypq/Beu7dEm2AcOowsQRieGAKggSmACRb2THl8GFrkBYJX31nCGnV7rfxPV5Ly8kNkqhgxE8VMohEnj589a5xdB/9mlSv2DvwXdamkQ3Ukvvs415KXOlY6i0YOKx0IkQNVVKOL5tkIoZ5/2XeNHofN9ibUlGxaRlgeoDrUAvHk7OHJADzu6rVVb7/MZIll4lyweV8D+FkFxBOAbnRVcTjJSBw4/MpqPrJNq6Vl0VwZZcYFqoQBh8IHr;4:3GpeunDhA3PHrUZGXTAOSCJYPRYo6QbCN2llrMwltTtH9TcLU8WUYtb3m1Y8+Rg/Rw6dcItwOgv+c+8noav9fYDC1qMmEQ7/fFWSITc7scYflKyMH8rZ2973NoU7rs2UrmHjs4Aa5op4259yYW7jZPmso8bKdha5j7gqiAL/nJOthhG4HDU8GjzfML7HG+3blGxSvlcDUYSbKNRkBFwNBu65KFjn1i9Pi3CcrMOBj/Krv7y7Yjb9HNml3S6hy1iI0jAJzzaY4CKoFzCkS2ml5Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:AM6PR08MB3254;BCL:0;PCL:0;RULEID:;SRVR:AM6PR08MB3254; X-Forefront-PRVS: 0750463DC9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(39850400004)(396003)(346002)(376002)(136003)(366004)(189003)(199004)(2906002)(68736007)(486006)(6486002)(305945005)(66066001)(8676002)(81166006)(6916009)(50466002)(47776003)(65956001)(65806001)(6116002)(3846002)(2616005)(956004)(478600001)(476003)(81156014)(7736002)(5660300001)(7406005)(52146003)(106356001)(97736004)(86362001)(6246003)(2486003)(26005)(52116002)(54906003)(25786009)(446003)(14444005)(53936002)(58126008)(7416002)(16576012)(77096007)(11346002)(64126003)(31696002)(229853002)(76176011)(316002)(105586002)(65826007)(186003)(16526019)(230700001)(31686004)(6306002)(4326008)(53546011)(36756003)(8936002)(23676004)(386003)(93886005)(507254003)(556444002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM6PR08MB3254;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?MTtBTTZQUjA4TUIzMjU0OzIzOjlIeGZQTFZYMnM4VGZNQUhMUlVLVjQyWWFP?= =?utf-8?B?cWhnYzlIQXNhaVNuNUZ2Rm5FeUNYQWI5ZTRWbHY5TWNjVDNWM0VjM0dMZ1M5?= =?utf-8?B?OFVhMVNwVFltVGZOaFZUZ1ZuOWtNWi9OcTkxbFFyTzVNN3VSd1prbzQ4VzFs?= =?utf-8?B?d05HRGZDaTVVNlpHYmFiakgybUVjMW8rVi9ITVN0UTZSR3liQi9WYkZrW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LFGeMUA3HfYGY48o0g9PcdeX0C80pDnLM393114nXFnGsYd3kaHVGe4exaJpOAiyXa/a16dpbKtKoafGffGpRvbXlfHID7Vqp2LHkxULPry0=;7:EAJIqrFgmXVqIfxZnCscj8oT379WRoMTH55MoXLxUZxBR1mPDyeH8f8LuEvfO0Iew8x0GZTh4MOGkgg6FVECAJX5OJnVh3p7fn0CP2VMkDynJs4QaVotlGytKZXjQ/AoPugTAAxt/yE0NBmIZOnBfjOSC5Qg/hcnHtXx1y3fI+KCFxXVnDR0jkcxAvw5TtRRuXyX1/92wuq3025OgRlvL1cJfofWfJxY4YKTXOFGndV+meGKJ8iS+yUtYJyfJWbk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3254;20:SxYysiLh6UKCTDPPxtjeBASk4bgA0xsainNyFy5QYjBqBuADYWyn7SdUbZvjdYbeal6zZTkFjwt0UnFWJKg8CZjXDUuextXzCBLwzh0OoGuFKPNBRWW2JS9J1Weazni6M4neuZGDNOiMO8HkjIsTvjzDBgVt61DfepMnUbIw+ao= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2018 16:18:50.2788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df56459b-0c2c-41e6-9b06-08d5f7014f00 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3254 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/31/2018 07:08 PM, Dmitry Vyukov wrote: > On Tue, Jul 31, 2018 at 6:04 PM, Andrey Ryabinin > 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. > > > Agree on both fronts: theoretically possible but easy to fuck up. Even > if it works, complexity of the code should be brain damaging and there > are unlikely good reasons to just not be more explicit and use a ctor. > > >> 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. > > I have another hypothesis: they are not bogus, just don't need > SLAB_TYPESAFE_BY_RCU :) > I'd call this a bug too.