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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0777BC43461 for ; Thu, 10 Sep 2020 20:26:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94DEB208A9 for ; Thu, 10 Sep 2020 20:26:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="joGXDmWg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="doPdBnJs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94DEB208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GSZqG31ZFHPQhNbneJtM+VbYauPUpYuZv2uIaN6cOiQ=; b=joGXDmWg1ZhsgI8Hkmj6K4WkCU hwOQUFLFVgQedE74tQiVBq2BiR6mmchulkalNbw2qEcHkksqAck+ajtxGF7G5ob2nCbKJVvFAK1Bo bGGOmh9ESX8sU0M7VQDRyURKKgKVC4AeccrCil1xN/S/vbbad2KycpXRdcBtI2WMaRF5Zlp6qBrKn 9crayoJgUCHDGPwUN4j0VOj1c9HXNEElxfjgHgzAAxiWAQIc4wne4+gBV+gIbQ2XsE+0Rs1qc22ny AvBAnU52/gLiqzoW5bgXU9yKhg5RaFnrFfe5fPx5CaQv2518BQj0xKIKlEQOftk/XcMc3z4equB2s f+e8Ssnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGT8O-0003BD-3b; Thu, 10 Sep 2020 20:25:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGT8K-00039U-Eh for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 20:25:29 +0000 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E83E20829; Thu, 10 Sep 2020 20:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599769527; bh=j1D8IPJ4Y08qnoWlFLiDNLrabhQVaPZSJO9zVTmslg8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=doPdBnJsbif/E+6P+b8WZBM0DPFyC8Ar2wQffAXUnGxFuH8CuQy6cIoH1ChJxEEdp T/094BXQngRogk0hZw0MrLqFPTkSpdB3jz95pU+oOeYJExyZ+BkHTDqXzi+TVSEyPF W22Q8DV32RdLZ+Yl4WNrQphSoWVZuPu3oZHwDtKg= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id CF0923523080; Thu, 10 Sep 2020 13:25:26 -0700 (PDT) Date: Thu, 10 Sep 2020 13:25:26 -0700 From: "Paul E. McKenney" To: Dmitry Vyukov Subject: Re: [PATCH RFC 01/10] mm: add Kernel Electric-Fence infrastructure Message-ID: <20200910202526.GU29330@paulmck-ThinkPad-P72> References: <20200907134055.2878499-1-elver@google.com> <20200907134055.2878499-2-elver@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_162528_672724_578350AC X-CRM114-Status: GOOD ( 30.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: paulmck@kernel.org Cc: Mark Rutland , "open list:DOCUMENTATION" , Peter Zijlstra , Catalin Marinas , Dave Hansen , Linux-MM , Eric Dumazet , Alexander Potapenko , "H. Peter Anvin" , Christoph Lameter , Will Deacon , Jonathan Corbet , the arch/x86 maintainers , kasan-dev , Ingo Molnar , David Rientjes , Andrey Ryabinin , Marco Elver , Kees Cook , Jann Horn , Andrey Konovalov , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Andrew Morton , Linux ARM , Greg Kroah-Hartman , LKML , Pekka Enberg , Qian Cai , Joonsoo Kim Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 10, 2020 at 07:11:41PM +0200, Dmitry Vyukov wrote: > On Thu, Sep 10, 2020 at 6:19 PM Alexander Potapenko wrote: > > > > On Thu, Sep 10, 2020 at 5:43 PM Dmitry Vyukov wrote: > > > > > > > > + /* Calculate address for this allocation. */ > > > > + if (right) > > > > + meta->addr += PAGE_SIZE - size; > > > > + meta->addr = ALIGN_DOWN(meta->addr, cache->align); > > > > > > I would move this ALIGN_DOWN under the (right) if. > > > Do I understand it correctly that it will work, but we expect it to do > > > nothing for !right? If cache align is >PAGE_SIZE, nothing good will > > > happen anyway, right? > > > The previous 2 lines look like part of the same calculation -- "figure > > > out the addr for the right case". > > > > Yes, makes sense. > > > > > > + > > > > + schedule_delayed_work(&kfence_timer, 0); > > > > + WRITE_ONCE(kfence_enabled, true); > > > > > > Can toggle_allocation_gate run before we set kfence_enabled? If yes, > > > it can break. If not, it's still somewhat confusing. > > > > Correct, it should go after we enable KFENCE. We'll fix that in v2. > > > > > > +void __kfence_free(void *addr) > > > > +{ > > > > + struct kfence_metadata *meta = addr_to_metadata((unsigned long)addr); > > > > + > > > > + if (unlikely(meta->cache->flags & SLAB_TYPESAFE_BY_RCU)) > > > > > > This may deserve a comment as to why we apply rcu on object level > > > whereas SLAB_TYPESAFE_BY_RCU means slab level only. > > > > Sorry, what do you mean by "slab level"? > > SLAB_TYPESAFE_BY_RCU means we have to wait for possible RCU accesses > > in flight before freeing objects from that slab - that's basically > > what we are doing here below: > > Exactly! You see it is confusing :) > SLAB_TYPESAFE_BY_RCU does not mean that. rcu-freeing only applies to > whole pages, that's what I mean by "slab level" (whole slabs are freed > by rcu). Just confirming Dmitry's description of SLAB_TYPESAFE_BY_RCU semantics. Thanx, Paul _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel