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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 5BFEEC433E0 for ; Tue, 16 Mar 2021 18:49:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E379265127 for ; Tue, 16 Mar 2021 18:49:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E379265127 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 793F36B0036; Tue, 16 Mar 2021 14:49:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 758596B006C; Tue, 16 Mar 2021 14:49:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F8E46B006E; Tue, 16 Mar 2021 14:49:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 3FB6F6B0036 for ; Tue, 16 Mar 2021 14:49:26 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 008A2824999B for ; Tue, 16 Mar 2021 18:49:25 +0000 (UTC) X-FDA: 77926625532.02.98C1363 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf23.hostedemail.com (Postfix) with ESMTP id A7F77A0009E2 for ; Tue, 16 Mar 2021 18:49:23 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id o10so5186841plg.11 for ; Tue, 16 Mar 2021 11:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ywai4YPe6URsofe8kbvRJ5BLerohwMgOUz2A+yTu1V8=; b=Gi/mZifZtaRGM1hAEWLLYtHoNGjeBYezFLY4Ub3n4u88qoaWqF2dg8531Bz2gbABn6 FO4WtNeX0KhGduNg1GnpbY9Y/CIeAnzjNt9lLhqJ3bQiOEJ4BtAToC4VblibmRyuvANn uwgAnFSNL24Cp92te+97NTCIADTkE1HxM61l4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ywai4YPe6URsofe8kbvRJ5BLerohwMgOUz2A+yTu1V8=; b=cACGIgZ97Efy/Za+6OA/Tnp/B4pXLxq1cLIiqov7wDc4s+Ha4iRmruNCz4bUJuuar8 1jVmrD/JHbKWo6/8TdVUhiguokVq+jhB5V5A0lkNwTlWsS9Dtq+ewFUzLLHX+seNM5/9 yAwpFyk0zqGr6nRbAHvkBOFaooPokb0lCtdKGwhTD0A0+fcxlYPnbAwXx1X/A4UjfgnC 4L04ObqBc2mS1E5H1Iu/wwoaCR+yI6oCmSt1T+Pl8fOt93Sh69vcKUjNLcOplp99JkSz sW/2NATRzrKmsvcmbDoxTPzZxbDPrawp+goYOf39hNc89tMvGzsi63gTe8WXS/qQFhr7 2grQ== X-Gm-Message-State: AOAM530Zuf8gx2XiBh19eq1fjTVMeukINLmTh3gFymd7CrNcQNlVTm9l r3EX4kQTV4Ln1RVnwsTOy7Nd/DsN0OShgQ== X-Google-Smtp-Source: ABdhPJz3uNdO8WaSSFDiiPWSz3MOZAP5SYHuuEd9I+bSp0sGeAPb9gjvi+a+I3tMUX5HzOo1dk+55Q== X-Received: by 2002:a17:902:7612:b029:e5:f0dd:8667 with SMTP id k18-20020a1709027612b02900e5f0dd8667mr739777pll.59.1615920562658; Tue, 16 Mar 2021 11:49:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a30sm2800263pfr.66.2021.03.16.11.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 11:49:21 -0700 (PDT) Date: Tue, 16 Mar 2021 11:49:20 -0700 From: Kees Cook To: Linus Torvalds Cc: Alexey Gladkov , LKML , io-uring , Kernel Hardening , Linux Containers , Linux-MM , Alexey Gladkov , Andrew Morton , Christian Brauner , "Eric W . Biederman" , Jann Horn , Jens Axboe , Oleg Nesterov Subject: Re: [PATCH v8 3/8] Use atomic_t for ucounts reference counting Message-ID: <202103161146.E118DE5@keescook> References: <59ee3289194cd97d70085cce701bc494bfcb4fd2.1615372955.git.gladkov.alexey@gmail.com> <202103151426.ED27141@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: i3itpdyjmbrjg15qwauo5hktwxj13btj X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A7F77A0009E2 Received-SPF: none (chromium.org>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=mail-pl1-f175.google.com; client-ip=209.85.214.175 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615920563-790087 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Mar 15, 2021 at 03:19:17PM -0700, Linus Torvalds wrote: > It just saturates, and doesn't have the "don't do this" case, which > the ucounts case *DOES* have. Right -- I saw that when digging through the thread. I'm honestly curious, though, why did the 0-day bot find a boot crash? (I can't imagine ucounts wrapped in 0.4 seconds.) So it looked like an increment-from-zero case, which seems like it would be a bug? > I know you are attached to refcounts, but really: they are not only > more expensive, THEY LITERALLY DO THE WRONG THING. Heh, right -- I'm not arguing that refcount_t MUST be used, I just didn't see the code path that made them unsuitable: hitting INT_MAX - 128 seems very hard to do. Anyway, I'll go study it more to try to understand what I'm missing. -- Kees Cook