Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5281714imm; Tue, 31 Jul 2018 08:22:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfy8br3ZI0VTTkH8axNRi82GCWfHFA84DYw6f9zc7TAFZtpIabHG0Ggqlej/tUEcyKRAF85 X-Received: by 2002:a17:902:b401:: with SMTP id x1-v6mr20966473plr.236.1533050560429; Tue, 31 Jul 2018 08:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533050560; cv=none; d=google.com; s=arc-20160816; b=td61SR1JmlKXMV2HTfh7q8Kq3/nUZjISCMBTWVbr8li++z4LvYLhBWX2qLWKFsXikm vEkWy+0rD4/A0z4fdALRiuI0/Vx4YGVVEi++PTYMJdWHIR41K9gMDnRMEpnacatRcd9A H6vK1zz9N0btznoRU4PhYKBFCn+iNkFfQDq57SeYTDwZhMqHt1tfB68kzMUa3WzyuXtM G4mCRymtNlgFbZqReDP9fvlcT9zUhr7wiAVaYsoBKept/OVyw7Y7Bi/40Kk5PiK+30T0 p5PKy2KPRyzjoR29u3kuxP7P2VK2wRZJkhsCAxxQBN043CEHREZNl4vQNG2U93fq2au0 6PCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xWE2aF0pajdZAOP+uUcDJNx6SJt58NICxf0URo6mRNg=; b=0j0V3Iy++KEHGqQinevZ0RoWuIQ/PziCFaWEXDsjZ9X+lbnDMydjps4l/FGyZxAWW/ F3vIaoAwnamdA0WcUiEzGHFOFG/zJxOcFBr+ZthlaTAa3p1FQ9Coy+OBZtF/N5dKKr+4 OpeEapbWOOsKxRhtxAF3f3bmIFKl4Hlx1dTTsAKtIaj1anvIo0a9JC9K5uApbQ1/ySTx QI7kiDaRdMY0ejy1V/VpTdfn3lrpjwR3ps4JeynNKw1ha5KFYG+U2RHtCOJiQacJz6Zz 1AoxLJ6xOo+erWPw2lUvhvkBYK7M5MX3v35QcEffXnetbdeLN8umGKQrNc1kbvHqML/F /MYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=noBTi9HZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17-v6si14132898pfm.264.2018.07.31.08.22.25; Tue, 31 Jul 2018 08:22:40 -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=@google.com header.s=20161025 header.b=noBTi9HZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732394AbeGaRC0 (ORCPT + 99 others); Tue, 31 Jul 2018 13:02:26 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:43061 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732358AbeGaRC0 (ORCPT ); Tue, 31 Jul 2018 13:02:26 -0400 Received: by mail-io0-f195.google.com with SMTP id y10-v6so13332409ioa.10 for ; Tue, 31 Jul 2018 08:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xWE2aF0pajdZAOP+uUcDJNx6SJt58NICxf0URo6mRNg=; b=noBTi9HZ7q5dUt0wE4QBXNbrQbnss3heBqyxzdpzF+TPVi2rwXsilLdvg20pfrCav3 as8rNbf241vy4nhYz3sKea22yqKLdgt7pu9yymGgzsfE9W/wNLWugGsAZ5OqtDzTLgvo zO8qphr3l98wjq8DGe0yV6URA6escglDwkPp5QlYvGseOszIWmYKumgyi9CwZQTLdDbK SURuaGZPOoJJmpDaRmuu1g4cBL3h4eETEVG62NMzZdY7TW3mOuWU3sbkhW02jzCkSLW4 2pJ2i3ZEiUD5B5c2MlDLSWVhPn7ujiYzHoOx+pd1N3KNLQWlydLmb5uQCpRS+MXbU779 C+RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xWE2aF0pajdZAOP+uUcDJNx6SJt58NICxf0URo6mRNg=; b=hEJoR0pi5swIhtcPhCipjYvukDOzO2upohEDYOmdBsNZAA9HCl6hzS/PDctQUxu1/q VzrLHHfA4G6ezHL2l/mPUCfrWCBrMPGnCdOE6J0t4axX8meBNrc+dIInM0hzHeONZBQn VC4bTuRA5KtiqMP6F5zy1AMlj4U0mXDWGQTHcLprFZW9nzRcDFC3R82D2qWdF3X7WMGD ufGe5+c9XOaek2fkY1+cntJb0pMXjdlK1Mbqe+7EBY15D6092KrS3ilunwN0Q4N8QI9V +BpmE0wt3nec7joTCmY/Dp4//a4TNaiWz1FdpuC1cv/kPa9p731/ExWZbBR6W7kVSkFs +WMg== X-Gm-Message-State: AOUpUlGj++wCAPZeCSW054MQybGao6vlnRHff9F9jZdvA22dhHSF7YWk N39rKPr0Qw8HgSrP3uk8CkbVDvhGU3QLxvNiMcaKzQ== X-Received: by 2002:a6b:84c6:: with SMTP id o67-v6mr135135ioi.119.1533050496587; Tue, 31 Jul 2018 08:21:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:918c:0:0:0:0:0 with HTTP; Tue, 31 Jul 2018 08:21:35 -0700 (PDT) In-Reply-To: <8240d4f9-c8df-cfe9-119d-6e933f8b13df@virtuozzo.com> References: <09cb5553-d84a-0e62-5174-315c14b88833@arm.com> <8240d4f9-c8df-cfe9-119d-6e933f8b13df@virtuozzo.com> From: Andrey Konovalov Date: Tue, 31 Jul 2018 17:21:35 +0200 Message-ID: Subject: Re: [PATCH v4 13/17] khwasan: add hooks implementation To: Andrey Ryabinin Cc: vincenzo.frascino@arm.com, Alexander Potapenko , Dmitry Vyukov , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 31, 2018 at 4:50 PM, Andrey Ryabinin wrote: > On 07/31/2018 04:05 PM, Andrey Konovalov wrote: >> 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. > > As for non-SLAB_TYPESAFE_BY_RCU caches with constructors, it's probably ok to reinitialize and retag such objects. > I don't see how could any code rely on the current ->ctor() behavior in non-SLAB_TYPESAFE_BY_RCU case, > unless it does something extremely stupid or weird. > But let's not do it now. If you care, you cand do it later, with a separate patch, so we could just revert > it if anything goes wrong. OK, will do it then when there's either a constructor or the slab is SLAB_TYPESAFE_BY_RCU.