Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5463336imm; Tue, 31 Jul 2018 11:18:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcC+RWT5KYaMdrYGVQXBk5vU4N0+tROK5CpSIHDIPIwPhLNPzf7gmzsdNfXYPyVf18hOS2Z X-Received: by 2002:a65:4541:: with SMTP id x1-v6mr21126285pgr.26.1533061094246; Tue, 31 Jul 2018 11:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533061094; cv=none; d=google.com; s=arc-20160816; b=EQtnSFZa7Z2BW2ydL4kEawiXOWzh+55REV5uGI5TXDaZK5/3WES70jO/pywoM6ko96 XJDQwhQ/PeZG7NXLz7Ij7rcb8xlYTCSLe1/YrnmOTINdM/pXGiVgN+Z/MdT5RpzLmE1S LsDfsSq6AS1kD87OuBGJ7DtQ6pnuNlmBWj0yjNpPczv3u8kBYbFdNdv6+q1PDN9NpsAA zeA24FORJ4AOTT2W4lOmo9pY7FA6uqSvnZbNKs4ehZz1/g/x1UUUf5NTWl8hQo7hDUVQ jFE97iGfyvq21PBIkc7Qf8F0QYXr32jJTvdqGp05ugV/bTosOgtHNMz7qc/fBU2E9g0n iR1g== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=DTjXcujdgZpGHh7EfF5Xue7aXiadmLUkC/Ykc5iWe5E=; b=LbdlvmtvUH6kglrsJzl3AGtV3DnPVdAQL4+A9jszuJDmFz3DiM0IEzCBgto7FHfNo/ T8NdjsO537bNYxezHMA01d0McTvaRgz6A8UkebaRg9V3xS6j7rckiHLLJik5T/4t4h8t vvF+iGT6UmthD99q+xw4O48kI+o/to//ncepeVPK70NX/eZSGrkZGczKKTEHhYTkMa3X SLoEe5Gj8pSfQ/m1eemXCrW7T+nWtetQeyc3iN8WYMLuggMeD2Zxmaw0QSrhX6EHVfoS zLMLjT/aMEhckBazBYonkFqXNP/rlB2T5TdIEm7DJzpF961c+BRnesaOlpoJ3D/HnoLS GbMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aRlXLcEF; 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 c6-v6si14350105pgn.143.2018.07.31.11.17.54; Tue, 31 Jul 2018 11:18:14 -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=aRlXLcEF; 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 S1731865AbeGaT6N (ORCPT + 99 others); Tue, 31 Jul 2018 15:58:13 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:43584 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728140AbeGaT6M (ORCPT ); Tue, 31 Jul 2018 15:58:12 -0400 Received: by mail-ua0-f194.google.com with SMTP id x24-v6so10900897ual.10 for ; Tue, 31 Jul 2018 11:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DTjXcujdgZpGHh7EfF5Xue7aXiadmLUkC/Ykc5iWe5E=; b=aRlXLcEFFhcXvAI+wlASznx7Qlgiyt8ynfxkjZzDOcLdfhmibji0ClI6CZSAPFjIWl ywm3WbaKizd7b3Y+yr5Isohd7mhJTG36UUoIwjZwi601QJ3FB9ATaw/Cxl28PTq11+Dn Fkoe2J4FoUPyqA5VaUMbOc+1vJu31K38uUb967zj9kx/N/oTQ3e4tEjczkv8StljYB75 ntY4ed1tuVKexFU5/hIEpbchSlLSEw89yRS2QxNbpAWt7o7F8XUhTjZ5JK+/Z6f1T+hM hRMAbsXwZJK2bK8kZGacfb1violra9gUii5Z8EiLekmU0/pwTeJUDzHyTTWWvtCon9bp yhOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DTjXcujdgZpGHh7EfF5Xue7aXiadmLUkC/Ykc5iWe5E=; b=gf0tTFAjFRh+KmGWR4xLCA78zKzVAQ5fJwhdIC9nd5KixUXUbkZxkfhEnW472W1Cij /HEJlIt0xgQP3AbeWFN50EFZf1F8jeJBG+PDOTmF/yA5eExOA5jt5hyhe2t4ijn+XbOt bzEbpWrt5BNP2aWloJRu3oPHIiCPl2HIqUOZHPuCBfZqAHshCRXZuFy4e7R3N5TH60HE VG5fVOZm19EF5RI7caZwghP+1exZP/IPA/h2eFa13a7OUc0/AFIxayE8odZsO4E/+rte Rwrj/FD1ECjoqT/efD1oq79EH6ydRHsp1fcx5KwvZ5YigzTEOePXdvKZLyuGxdOcN5cp EiEA== X-Gm-Message-State: AOUpUlE/HAr96aN8SZHqshOthj6SuOOyVquwFDJs+wKpbPjom7jSXlHo vkZhHuFv+dAF7143ArXsy/EB4F7x4KWpG/FN9tC6Nw== X-Received: by 2002:ab0:7055:: with SMTP id v21-v6mr16024703ual.44.1533061000916; Tue, 31 Jul 2018 11:16:40 -0700 (PDT) MIME-Version: 1.0 References: <01000164f169bc6b-c73a8353-d7d9-47ec-a782-90aadcb86bfb-000000@email.amazonses.com> In-Reply-To: From: Eric Dumazet Date: Tue, 31 Jul 2018 11:16:28 -0700 Message-ID: Subject: Re: SLAB_TYPESAFE_BY_RCU without constructors (was Re: [PATCH v4 13/17] khwasan: add hooks implementation) To: Dmitry Vyukov Cc: Christoph Lameter , Andrey Ryabinin , "Theodore Ts'o" , jack@suse.com, linux-ext4@vger.kernel.org, Greg Kroah-Hartman , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , David Miller , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev , Gerrit Renker , dccp@vger.kernel.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Alexey Kuznetsov , Hideaki YOSHIFUJI , Ursula Braun , linux-s390@vger.kernel.org, LKML , Andrew Morton , linux-mm , Andrey Konovalov , Linus Torvalds 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 10:51 AM Dmitry Vyukov wrote: > > > Is it OK to overwrite ct->status? It seems that are some read and > writes to it right after atomic_inc_not_zero. If it is after a (successful) atomic_inc_not_zero(), the object is guaranteed to be alive (not freed or about to be freed). About readind/writing a specific field, all traditional locking rules apply. For TCP socket, we would generally grab the socket lock before reading/writing various fields. ct->status seems to be manipulated with set_bit() and clear_bit() which are SMP safe.