Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4465191pxf; Tue, 16 Mar 2021 14:21:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJGoLYaxQNNZnch3hTS8MDBwrk8xerVY+65PIqhTW7wjmF012JdVLUh4xZVZBsMY55zCWy X-Received: by 2002:a50:ef0a:: with SMTP id m10mr38364366eds.261.1615929682144; Tue, 16 Mar 2021 14:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929682; cv=none; d=google.com; s=arc-20160816; b=ITxJdp1OfkLUcPY/c9NKMI0Th0iJvQy9ndrq2Fivhi5ALQA5E62qHmOz/alpueh3/I KfxfY8QBhx21JQWsiQY9F9ErHXvwC7x+enCztM3X+zbZsfAVvX/6JqsXxRvbNcTVYIPg io5LZgt+IO7ErzP0EYTpopvMqP6xWeg3F8UpHmPoiHvaiKdEeN0VhH4bev8QQuLdB5Zj r940H/KfvmqpRUXwI8jbYen4U1ML1zv9CVzdaGA0lRK2BET+fJ5qqitNatJRDjO18NTS At74sJjV+ZYP6n/ILT/pEW+672jzhESa4d/yXYy1l3SZV7CeMyRfPFf2bU7rpWz4fb0U 6SKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ywai4YPe6URsofe8kbvRJ5BLerohwMgOUz2A+yTu1V8=; b=VjBiqnmoxn3XZmRsN0PnW6/Rtcfn+DM1ukKkHYU/o/f/yb2urP0EPToC7rxzQig0Jb 0ndqkj2+mrfhgcydGLr3t/v8HqVilKF/jl5qZSVadmBe7QVvQeobA2FrtCCGY5fZ8fuU e5E4IHpSIU7e8H824FKXk3Mrv6KnFL0uRGhBGVSIaH0wbw8ZsUWceNnUB0KvchsKpNJ8 UofKRbE5bMCcsI+YxHg1X6ioRmUht/vnBJERsufwJiK5X3C+Ee32BLggKaAn42e6Reke uCp5p7MuIOvK/X19N1+4pzMBfQk+cmcIgn3yRPo6/KSDg8VXXvNh1K1FJm0meGAtTWh9 j0PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Gi/mZifZ"; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk14si14219613edb.548.2021.03.16.14.20.59; Tue, 16 Mar 2021 14:21:22 -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=@chromium.org header.s=google header.b="Gi/mZifZ"; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231364AbhCPSuA (ORCPT + 99 others); Tue, 16 Mar 2021 14:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbhCPSta (ORCPT ); Tue, 16 Mar 2021 14:49:30 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B41C061756 for ; Tue, 16 Mar 2021 11:49:23 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so4039633pjb.1 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=ggipdjTh8LoB67efEa0TJct7kC5OO/AZofPXFNHj/lmVIvi7+siUSjbz1vFKWlGgqM GCk9NLeeG4L1bDt363lS/OsVoSAfJ4RiVfnAQw86Yxwg8mQJz2SeQH0zLM1sN9lzKPx1 RXPoRXJOgP4Yk5u5tfLwYCZOxUmJESridiJ2ETlw8MkQnk263p/EEySenl8Klg2EL6We 2WMf2YrzEdzTNQK60Bw1e45N1tkIPBO9DeRuTwHxTTEgJCdDzw8aLKxNpKO8wYHUqfz/ Jk8ZVYpKiZt0Aqq8Qy9yhmLZY1n/V/skI1dJV8kAPHhS2PZ6A+0PUny5eS/0yuphoMxf pZJA== X-Gm-Message-State: AOAM533nTV2TG5nVTfYZJ6xDBroJeWRdnVKM1A6s8+1hbTHPvzrx3Xc0 NrQ+ASbJ5BKqgOPz5GwKS/3XFA== 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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