Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1499565pxk; Fri, 25 Sep 2020 17:15:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfynKhf7rpVmkYzpUeyG761k+n2YcShcOzp+8xe7VF7HU2rIbRMUTC4Yj+FnGwxvtZ4O7u X-Received: by 2002:a17:907:104c:: with SMTP id oy12mr5355696ejb.450.1601079303075; Fri, 25 Sep 2020 17:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601079303; cv=none; d=google.com; s=arc-20160816; b=ZZPIq7igfQRk8hUymflWHMThT1sGLrx+1hTGMLyUUcVX+CWIdJZCgeT0MRKYt9ZyCY wRk3Fh31zCZ0xUs0alcFf5Op8HURBynGABDppJESSz/JtSTcmQGn/96e5NKWBBNeugw+ p5YvrXYriBn1iAm91jPwPmO1j87O+lwPCXjBbStJJJFkqrfscXWCRJAc6StlOTWGcMBO 48LS7cBTFLC+bGLy6U7Veap1y1qpHkY8JJ9Y8f8O5X+nF3F1+c1QB+YUlcwyZmoA5Obf OGjK1J0x5E4ZJ1fOATu4J37hKy6hq/WAYzzwoaCvTavt8lkf1MoAL0k+CkCg7wm8FwhK trMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=uV0OqNe6fNGB9fHblrzHw8cV18adwvrkpgLxsiNP0V0=; b=arAQpfjRfEAJYT9OyB+eaz2Yvwu8FcLo243I45TKFD0cc8qAZMbXEBxaso836tgHuI /43/TS54hoxNN0DApHSB/qf2nzrbw7pIW0DQWhLJBqXyU9di8QIWUNA7alSXhBVNtbnM FBFVQQfMxHMyPxq0p/rfwqg52ETLfI4CA8YHSNLXCGznk1bGN5wxAUg25ydDkH0Tgi5x fwXLZNBiycYlSWETvzTKA7IUTAchreGpQu/zMT0cHAiiqHB77X86jfVBPQQoWMzz5ITx MAyhS/3K8DC6ZmESbB3xHBiuFiuPddSQmckpE0/fWdwu1XGkRpgi72ky6Hfeod/2Y+Zz 9fuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Itebs+wD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r28si3010983edi.80.2020.09.25.17.14.39; Fri, 25 Sep 2020 17:15:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Itebs+wD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729613AbgIZANl (ORCPT + 99 others); Fri, 25 Sep 2020 20:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729448AbgIZANk (ORCPT ); Fri, 25 Sep 2020 20:13:40 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B586C0613CE for ; Fri, 25 Sep 2020 17:13:40 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id c2so3960355otp.7 for ; Fri, 25 Sep 2020 17:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uV0OqNe6fNGB9fHblrzHw8cV18adwvrkpgLxsiNP0V0=; b=Itebs+wDAb4wpBvU4vPbCiLJnqG1udHed3DIfGnE4q+RUOWLMv3mGel8E4yijdBKEY I9B5MlW3NcLxPV4yZNs0MN9CUGtiqpVaXBemJ5vvVwM93NCjMqEEtaE3pMrenijGh90R nX3nRIJ5N6mKMl8WCK7FP09bwZBnRfzV9FTzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uV0OqNe6fNGB9fHblrzHw8cV18adwvrkpgLxsiNP0V0=; b=CMXKN0A73JjPSgm3hy7MoRXrbiQrz0ncRiPb74z7FLDzmRqHP0WhEPTNbq1ECyQqIf S2jqve/nnbU/Lw/bE9dcf130j2WkaN175LBfp1wjM01U2BQQNu8+j/UW79J9o3hMdzGK yH7eBcsojOmDcZjXeTvuwVx67ydtaNr5hyr/g/AUs1UjI/tQyuCW3ILLJMY7X6ctU9+x Jx8Mofr5aqMav74gSzvBO1JSZgIEuA/wv2xMT7QUQ1k48yMq1fsviMm3faBsJMG/YlWs y8wydV5wjUQ97J0bbfbkxSJm2niRGuEKgyrxaAfdZkVIu6/ouf/sAk0ZOU5ggy1UrEr/ RL2Q== X-Gm-Message-State: AOAM53307m5frr6xQpnl+ysCIxtqNI1MPBAMsf9XthHB5emMo1TO+lHJ /YaE+sL5hvS2GEdqpCZPPqoHoQ== X-Received: by 2002:a9d:6e1:: with SMTP id 88mr1876214otx.279.1601079219831; Fri, 25 Sep 2020 17:13:39 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id d63sm958205oig.53.2020.09.25.17.13.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Sep 2020 17:13:39 -0700 (PDT) Subject: Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters To: Kees Cook Cc: corbet@lwn.net, gregkh@linuxfoundation.org, shuah@kernel.org, rafael@kernel.org, johannes@sipsolutions.net, lenb@kernel.org, james.morse@arm.com, tony.luck@intel.com, bp@alien8.de, arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, christian@brauner.io, hridya@google.com, surenb@google.com, minyard@acm.org, arnd@arndb.de, mchehab@kernel.org, rric@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-acpi@vger.kernel.org, devel@driverdev.osuosl.org, openipmi-developer@lists.sourceforge.net, linux-edac@vger.kernel.org, Shuah Khan References: <202009251650.193E2AD@keescook> From: Shuah Khan Message-ID: <7d8f86ab-4333-afa1-6523-e42ae5c7d9b2@linuxfoundation.org> Date: Fri, 25 Sep 2020 18:13:37 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <202009251650.193E2AD@keescook> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/25/20 5:52 PM, Kees Cook wrote: > On Fri, Sep 25, 2020 at 05:47:14PM -0600, Shuah Khan wrote: >> -- Addressed Kees's comments: >> 1. Non-atomic counters renamed to counter_simple32 and counter_simple64 >> to clearly indicate size. >> 2. Added warning for counter_simple* usage and it should be used only >> when there is no need for atomicity. >> 3. Renamed counter_atomic to counter_atomic32 to clearly indicate size. >> 4. Renamed counter_atomic_long to counter_atomic64 and it now uses >> atomic64_t ops and indicates size. >> 5. Test updated for the API renames. >> 6. Added helper functions for test results printing >> 7. Verified that the test module compiles in kunit env. and test >> module can be loaded to run the test. > > Thanks for all of this! > >> 8. Updated Documentation to reflect the intent to make the API >> restricted so it can never be used to guard object lifetimes >> and state management. I left _return ops for now, inc_return >> is necessary for now as per the discussion we had on this topic. > > I still *really* do not want dec_return() to exist. That is asking for > trouble. I'd prefer inc_return() not exist either, but I can live with > it. ;) > Thanks. I am equally concerned about adding anything that can be used to guard object lifetimes. So I will make sure this set won't expand and plan to remove dec_return() if we don't find any usages. thanks, -- Shuah