Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1078708rdb; Fri, 2 Feb 2024 12:58:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEvrsWTpvowbOXUWZq0oAjUFt6spEUjHgkjMs+Ps3YIJiSdbnq4A6iabSiTB0RMXX8fApI X-Received: by 2002:a17:90a:9f88:b0:296:521c:4caf with SMTP id o8-20020a17090a9f8800b00296521c4cafmr1851754pjp.8.1706907491570; Fri, 02 Feb 2024 12:58:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706907491; cv=pass; d=google.com; s=arc-20160816; b=Wkcp40uwrc14ttuWGU+aRc+zhZ1TcpakZwMa7/KT65GVHKhqzoZToD9VmctwgRR/kw fAXdNZrgLrqxwmZl7kMcZURHiZSJ4FDVbmuWSIQH9WNmjS8s1aLDTtQG2i4gAqkbIkUT IJPvdxRJSun/KDe2K+ZCFqI9qE7NWjljeNSDDDtZliikaO0EwaUmDOCGNzB5DFBsp2Wg +QsgH9pL6lvFb62gSvLdzPzda7Kdd39U2vF6qNeVU8H885kE1mpqlQzoEYHQma9vDSYD 7ceaShwbSIJnxHgDXwk3skcGl4BKalB/fKnwqTaCPcUXLlixef/BPr0nNm6eFyHzWSJk yv1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=jd5iB2GW7u96qhDXLTaDLBHJW+CgTFsPG8xtoncLIv8=; fh=9E1sV9VoXal7WaF4p65nj9g7UUSxhvMWzoCJz3tnrIk=; b=q2h5ECJ5HXSOaGTLGyBClafjpvEZXOBXLvvAi19sUtcQMnHdBU3hf9aUv3Qi13lvKd 3M30pBYjtHZigrt4X/tLU0VQ42tjvS+gRNer2hq1UukdeVWTDAqIrFrYoOJpxG/bWyH5 ktUAILl/8i6FIs639krOKZSsUPGnDbI4BClHmO60VW+BCUHzjffUBZN0scj5svUxbYDc 23r8t5C4QSvUFsbZIEmNFeG8LLyV7z8qXVKeYaboup6RSip8c/7kkuAxqKSavvAcZX5M uYZogMcnIOVVLM3DHaHk3s8AQt1bU4CG2cJf4BRD9hG7/6izyb+Z31I/Qua7e/MbED38 TnGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KACTs63E; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-50561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=1; AJvYcCW6jlF+wPdzd2irBHZLy3KOqOtzNkdzrW5NKiLjGBCDu0nQcUyxq3LKuIkleeZXBuRyOOnRBCfUhYgO3ha9wXCh2WpYgWkBifyANYA7Jw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x20-20020a17090aca1400b002904e63a5a8si461607pjt.122.2024.02.02.12.58.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:58:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KACTs63E; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-50561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 535802859ED for ; Fri, 2 Feb 2024 20:57:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A718615E5BA; Fri, 2 Feb 2024 20:57:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KACTs63E" Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 368D78175A for ; Fri, 2 Feb 2024 20:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907436; cv=none; b=i496Q8rRWw3lF5pKCOg+CPsKzGtH7l0ns4OfeRVoYQ+hpf0STMik3eBmREvcV7R93uM3NmSF5Yk+vGQGXoVY/86anSovRkTbHRybNFj0uo2WVACsoCRa7gZ2j98NxZpLunsUjVfxzSwk/dZS4eSG4avIFxGFeVoO9rk3mcfysck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907436; c=relaxed/simple; bh=8ocUjGK2oy01qiBgCNBpq+20kZmTzsOI10qpJvgvgtg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nN4JS7UkMw77wXNl0jy/RutikrmUMaRebnvNqVN0ufYxFDdMtSTuyIlh9zFHjJsMPVOL7wK+R/TbJwAYis65djBtaF1zh31bs6CYBeQeBoaYrVtTR4wLCCv16ve9j4UVORpnyup1wP2hG8qj2Zo9PfQzVK0BtZa8Fte3ZObRZMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KACTs63E; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6dc8b280155so1540598a34.0 for ; Fri, 02 Feb 2024 12:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706907432; x=1707512232; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jd5iB2GW7u96qhDXLTaDLBHJW+CgTFsPG8xtoncLIv8=; b=KACTs63EtR/6LViJcdoyk8Wa0iQcMmiJlpSXahnHWJ8YGTWGJba7CB/Xa/BxDJgQqd ALMG2GCJR6HO3JhzBS3s9F6AiEOVher3pftcZXRr+paWn3veTNXcpEWkr0FXh8L6vLrl rNVPU5z+IbxFSEdq9sQsqEKAcE6aRJNfV8LrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706907432; x=1707512232; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jd5iB2GW7u96qhDXLTaDLBHJW+CgTFsPG8xtoncLIv8=; b=A+sbWyBbZcoUViRYL0mTVldYqZQskbsfeKlWTVu4gp34t2qScR5+B9jqLpNEehhjLy +wXDPRuvpbSi+xhkLzOYUFZigtCqOuw51STOUvmIawlETfeTL43iwiIo0kdsSLprrIAQ 4MNJmGAy/PQfbvf6P5UIJvBpVk6pX6Joxu5tUKmOlL1L+J1+1omNngDifuHIcsmLAdbr tx930bRnMhG9Hh3KK8rNS2aiYGe1zQIyA1nDZHN310g0VcQ1wVaEbkYOn119MZcWRHaK pgnGQNx+HIovIeuu6UWZN3ZN62Jzgirh7BeW3AMa7Ep1NxL0n2CepXMQqJV60U6U29GU DRNw== X-Gm-Message-State: AOJu0Yzqi1kvpIPs/FNCPowoBFiyJTE1aFZhZLi/UtmLhrzSui1/OO90 izDv+qodidPWUxTTi3h3yDWFdoQgGa8eTVpLaL/IL1IJDfnO2lOAWExF+BlI3PvqDU4NXAIndvT lH9C11AMuWB5sMNFdlkWkA4GHixMszXdMtyfN X-Received: by 2002:a05:6870:96a1:b0:218:d1d4:78a9 with SMTP id o33-20020a05687096a100b00218d1d478a9mr871537oaq.24.1706907432643; Fri, 02 Feb 2024 12:57:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240131175027.3287009-1-jeffxu@chromium.org> <20240131193411.opisg5yoyxkwoyil@revolver> <20240201204512.ht3e33yj77kkxi4q@revolver> <20240202151345.kj4nhb5uog4aknsp@revolver> <20240202192137.6lupguvhtdt72rbr@revolver> <85714.1706902336@cvs.openbsd.org> In-Reply-To: From: Jeff Xu Date: Fri, 2 Feb 2024 12:57:00 -0800 Message-ID: Subject: Re: [PATCH v8 0/4] Introduce mseal To: Linus Torvalds Cc: "Liam R. Howlett" , Jeff Xu , Jonathan Corbet , akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, sroettger@google.com, willy@infradead.org, gregkh@linuxfoundation.org, usama.anjum@collabora.com, rdunlap@infradead.org, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, pedro.falcato@gmail.com, dave.hansen@intel.com, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 2, 2024 at 12:37=E2=80=AFPM Linus Torvalds wrote: > > On Fri, 2 Feb 2024 at 11:32, Theo de Raadt wrote: > > > > Unix system calls must be atomic. > > > > They either return an error, and that is a promise they made no changes= . > > That's actually not true, and never has been. > > It's a good thing to aim for, but several errors means "some or all > may have been done". > > EFAULT (for various system calls), ENOMEM and other errors are all > things that can happen after some of the system call has already been > done, and the rest failed. > > There are lots of examples, but to pick one obvious VM example, > something like mlock() may well return an error after the area has > been successfully locked, but then the population of said pages failed > for some reason. > > Of course, implementations can differ, and POSIX sometimes has insane > language that is actively incorrect. > > Furthermore, the definition of "atomic" is unclear. For example, POSIX > claims that a "write()" system call is one atomic thing for regular > files, and some people think that means that you see all or nothing. > That's simply not true, and you'll see the write progress in various > indirect ways (look at intermediate file size with 'stat', look at > intermediate contents with 'mmap' etc etc). > > So I agree that atomicity is something that people should always > *strive* for, but it's not some kind of final truth or absolute > requirement. > > In the specific case of mseal(), I suspect there are very few reasons > ever *not* to be atomic, so in this particular context atomicity is > likely always something that should be guaranteed. But I just wanted > to point out that it's most definitely not a black-and-white issue in > the general case. > Thanks. At least I got this part done right for mseal() :-) -Jeff > Linus >