Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1075000rdb; Fri, 2 Feb 2024 12:48:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxlTfZOpeS1vfrKW7Ppf/gkJsy9/Dx+953e6ZNvg6TVKzC1bsBZtxYNzre9SlU0ok8b2Vo X-Received: by 2002:a05:6e02:4aa:b0:363:b519:bff0 with SMTP id e10-20020a056e0204aa00b00363b519bff0mr2935656ils.23.1706906880835; Fri, 02 Feb 2024 12:48:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706906880; cv=pass; d=google.com; s=arc-20160816; b=e3tPTJcuOpZq2j4NZmVEEjMnxMcfCIfRSKBfWOMi/qkYl/j12mM2fDfNUCnRQM2+An ckxKkF7F31413s74bb6DJ3vKLQ+fWsVrpKfwDhT6GkPlmE/FYeNO/nZEiPhHFFOtCiRu Eo6o1M0RSqWnl5NUQ1lXR6q9DpJbvikXUEe/K8b4gjB9zCFyXU5TbXCnUlZ1eSKDgsLI zX5zXepL9a7aNtyB9K0maN/GjCCNlg4U/xnKDA30i9KbOsPUsi2YdtBxEs//masVOwoY zBfgQpBIgrRcfZl6WRYJRSsecP1GwxCKk9TF5ekRZbUZuhTezvlO9BBfqyEBanPVCen1 6ePg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:dkim-signature; bh=/+Lf+IboQG1dTAVnxNBjsFez85NCfDl/n19nRqwUon8=; fh=te9L5+yYlO683W/P/MyAHJoimUeREgcRLMMKQOVqtBI=; b=XpWC/CPa/818hY3Mics4s9TttwKerXwuH8Mgyub3bBQGd2y1lr07dZEisItsjIM9VI dPSdpQW0fY4s2EqtXayhs7ULTyOnnBkY0jdZzrPu5ZaAWd0hZtobkAVYxHe4qV+RnrOc lnwa2WYRa7uk1VX21ukW3vE+g57AvdB3bzU9mSo7mik21KHIcw34PTIGheS7E4uV/nJq WXciW2budffQfwFgjElywYJ5PuaNbxwo9iw0SBQIy+oVP/Xf+CwqJIzyQOzn/1CKx/2z 5B3GJoQ6ziToC6WgictbTX5iFnx5PWqiOktUlW9dBpw1yh09E2W+NNKUlKxhQBwkNdhN 3dCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=aFG4K6G8; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-50547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50547-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVZCpL4yXvfpQLwGXqT4Z2cpwjkAy71lQYpBpprzruiaFs2rtLb9xkXUC9wAuPyWvKv5J4FQKEJtPLzYl50u84GgsmBzdcSsgU9UkOr9A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q13-20020a63504d000000b0059b64b153f6si2110356pgl.845.2024.02.02.12.48.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:48:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=aFG4K6G8; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-50547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50547-linux.lists.archive=gmail.com@vger.kernel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1CE7BB245F1 for ; Fri, 2 Feb 2024 20:37:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 631F42746D; Fri, 2 Feb 2024 20:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="aFG4K6G8" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 4F6ED18050 for ; Fri, 2 Feb 2024 20:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706906236; cv=none; b=Nd3o94hKqZoQ2c+oAo0k+0A4cGD2J/WU3sj4s0kPKDr+uiFDqEko5L9xpSwS48YjzDgMe1mYK3at1YTUxJk4tR5nAQltwGTfO0ZJ3y94/Z8depSswFDqRoCJQgrplhEfpGGaSUV1bCMPdGvh/2wvxQfiaGjltqWo4OQfGbGY+FM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706906236; c=relaxed/simple; bh=7Mvu1Qvmq1BUG1gJYlb4UcjxOFlgOR8rt+Lqx6uTvnk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Content-Type; b=iJ3um2e06lMU8mWJxrWfgImZg606pz4kplEk3dROzpt7y5yn7rBday5nW2tSFBgmWqWwoZPfza/EGM4WTnZkh1UIpRAuYsMIsL8BMajf33Sjdn1jC+v4+EqYGDSHHG1WmOED5nnZn/zcTqvCEeX9mhiCBYoBWH6Z0xIwtrrubCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=aFG4K6G8; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d061f1e2feso29738011fa.1 for ; Fri, 02 Feb 2024 12:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1706906232; x=1707511032; darn=vger.kernel.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=/+Lf+IboQG1dTAVnxNBjsFez85NCfDl/n19nRqwUon8=; b=aFG4K6G8LcqNRYTrWhlGHYSgWWcFi+gMBdQJyUy0WDu67HodFz0nNogSSUgLlcJ7nA 4Z6dQlcbjM5hXGnWMQ/iQG8eHjY2PbGrFQszPvjuBq1V7dnF6aOwHWUsngAER1+Qvq/W WENmVedkobibziQAlOo6LPTaQK1KEWQ+RdPyk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706906232; x=1707511032; h=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=/+Lf+IboQG1dTAVnxNBjsFez85NCfDl/n19nRqwUon8=; b=hjNJoGOdwytQFWlswd7WcwIzuqahTuEMpuhj7RPorvgwI70hHzBq+LmVKgjzhJKBFk qctuHs+Z7trjFsYI/RnnNBZWFQ7T8j09c+y6h8NJZkexOiCkvqnCrEJV6Gzz+jNYX0nk tFKvOYSZHLlSnQNai1HKZGlF6v5nsJC52Nls0+T4TyTWKtkATm2f7jwpZ1M+MH8w0wNT yK0EIAwwSgy4okZBss9Hj7EJA9sFJ/D5SPfsRaPx8cvZ6Q92r5WA/fv3Pd6siGUinCsK N4PZ5uEPUVv59sSLDOwgxpzZ1g3aVTHKqb0mA6SpWBWgurFAB5JE7GucsaD/Vwbu/bq4 vxYQ== X-Gm-Message-State: AOJu0YzN8C2hVOGg0fUFmji85bDWpvYY2uf1l8vcDe8QdW4gpyCoRqNj qNGyYXZ1oa6/qAamk/W9Ga4Z2bvBJkdEmfyeM0X2CzlT1V1D1JrrG27ve6itpSK4WLuXe6OGQ8j TvsvWtA== X-Received: by 2002:a05:6512:2030:b0:510:1b77:62d8 with SMTP id s16-20020a056512203000b005101b7762d8mr1962895lfs.23.1706906232263; Fri, 02 Feb 2024 12:37:12 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUDzENwG5Neqf3yFG51fs7ReA2/F0oM1SiIreXAn3SUVDwrGUSYMuDKA2RyTzvsQAG3gCvWQPibE6RKAn/6mtUWLOk9cc5cgp0zlg+Q Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id x21-20020a19f615000000b00510213a6afesm398891lfe.253.2024.02.02.12.37.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Feb 2024 12:37:11 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d066b82658so34777511fa.3 for ; Fri, 02 Feb 2024 12:37:11 -0800 (PST) X-Received: by 2002:a2e:9081:0:b0:2d0:643c:c2aa with SMTP id l1-20020a2e9081000000b002d0643cc2aamr2137336ljg.20.1706906231031; Fri, 02 Feb 2024 12:37:11 -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: <85714.1706902336@cvs.openbsd.org> From: Linus Torvalds Date: Fri, 2 Feb 2024 12:36:52 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 0/4] Introduce mseal To: "Liam R. Howlett" , Jeff Xu , Jeff Xu , Jonathan Corbet , akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, sroettger@google.com, willy@infradead.org, gregkh@linuxfoundation.org, torvalds@linux-foundation.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" 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. Linus