Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp2006674lqg; Mon, 4 Mar 2024 09:56:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOsMwqiFTGndbjnWBZEHsTVd/+5FwjbZ6u8gNSgaLCfH62uhZXlfXUYqUJHbNmIEwBxRdpj7bYD6tLNYC7cYcuDRUtIpvu6ARdIAWIfg== X-Google-Smtp-Source: AGHT+IHEBqfAhoFnuU74a14rrwACErv8VeZX30hr8q1nNVyHa6to2W9T3DycIdPo2bnR/KZHY0YC X-Received: by 2002:a5b:98c:0:b0:dc7:5018:4022 with SMTP id c12-20020a5b098c000000b00dc750184022mr8460026ybq.44.1709575014948; Mon, 04 Mar 2024 09:56:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709575014; cv=pass; d=google.com; s=arc-20160816; b=mWYxB3/DYXmyjC8Y44cxfgiwjYQ8L/qv1mxxS9FnLL0r/hOApmho+q39xMZwjj2mKg 0ybP+0O5PkXVu52+jaBjwE9/2+OsKsB+ISLPVGNaaubQglZXsKiiOzDYk03fYS+TVhsB 7CruvoernvO6qShq0YDsClTdKqvUEMc4Opm4G+kdW6wO2jz06Fh6BY0KUidle5PsOt3q xMvUpdUVKJs2lcATOhmMbhD3pSL+w9BYhhFauhtzFqmljTEjwQmBhxjUv89dLRLT6Vo9 j2giELMIfIyxi/AL+DFkd+wyhQIYjywC1PXf0/JmrUgON3GnNaQZt3godu7DNZOwbz65 BmpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v2VvyqeNIcG/snWQL5vBwyojit65ijRwWamSan0U1MA=; fh=79FLDthpmC+cU3cAItPdh3lT6Dpbydt+BVMdDz0/bQA=; b=W3Hk7/WEX7ARcewjOktKmZnGc0RehYytsy3iuLrybs9v9YhLyCgLaT4if1RlMaY1K8 Zk7tvzW14VKyAUUwGuPxD/sRH9GJQ7eSMCVk0LhH3WtOF23dZ+5tLkKIogjBSbQ+aUJL eXp/H9EBrUzmy/zQnpEXkrDJ6FT8B1xYlk79m8SCVlqhpWOCOUt1KS9o96bWcNtqASis 0xr4yxyNYkaLCSIWAW+EEfNF/dFkJq0ozGL4I7WakjaKAFqkOQIoUPGqvZsbnYZJet5W 9ErTBfoofuuj6QxRLFqxRTx0tXTTwsc35PG38urhAn2DNN0h1+Jy7wJXHbGJY/9G9mAW bJMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JaZSX2nW; 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-91043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j2-20020ac85f82000000b0042e7a34d286si10698607qta.672.2024.03.04.09.56.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 09:56:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JaZSX2nW; 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-91043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91043-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B39F01C23484 for ; Mon, 4 Mar 2024 17:56:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4321361694; Mon, 4 Mar 2024 17:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JaZSX2nW" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 1880C6166D for ; Mon, 4 Mar 2024 17:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709574966; cv=none; b=noUY4lBR6vNyoDl6Q/1BtD4yum/Kn/0f9MVzn+g0X88gY7dGmNBoD2JCzmlnNYHOH3I3fcJc5c3xXPwd2n6gzaeICzes7OWf/3SQGG9HFQSqw3AAIY3Q/gY9jGffmzgixF3MX3/3W5URZ7cFyn+tAGyTVcnIxa4yATZhI/qkyB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709574966; c=relaxed/simple; bh=sjlJjVa6TG/fX5vFVh6AwpeyDBSvVtN6my3+HRQrKNY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TFOM0WEYvpub/rByERBoqn1Yxx/Z2Di/vU6oUBAExNDtnms9uvVZsEOEJHNW5x+GC7bvciOXGB1pmS1Cvw8UW0XrEd/lMg1ypntFHiAx2yEcSsEi0tTZ4Zp6NItu4WCarcAgz5wIugTOuq1pts4o/p3v9zvLQ/wEDIfphmbSYRc= 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=JaZSX2nW; arc=none smtp.client-ip=209.85.214.175 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-pl1-f175.google.com with SMTP id d9443c01a7336-1dd10ae77d8so9113715ad.0 for ; Mon, 04 Mar 2024 09:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709574964; x=1710179764; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=v2VvyqeNIcG/snWQL5vBwyojit65ijRwWamSan0U1MA=; b=JaZSX2nWU6XL1jLsvNiWT7HooTxxdp4LNSLgG+aRhKYZMw0tCPKQNaKsbI0amVaE9a 4pzgs27tB3ZdAGv4mgzTBYf5Q0+/elxcqWEHHyAhHfBJH7GXjynRJvabpWaAH0NFRct9 yKLnlgaZvNKwbiCZ3VMUEQS4Jq2nlEBM3VwbQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709574964; x=1710179764; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v2VvyqeNIcG/snWQL5vBwyojit65ijRwWamSan0U1MA=; b=q9YCI8ToaWgCanMmfhMCIPU56kcxMwaz0z7G9j1e1KQpjs0w6yogs18vVz0loBPHsQ 0DaJ4QnT6Cy9w/5y+uicYP+yZDggnkrc8Z/jiH0Vg/Hk2BWjxt9IkxCbtaBuEwcqTPjg oKDLh/Oj1wI3kmeUYWl+2D0ctmukOHQmnUmaTAGsehtOFg9oTYTVwudy9EUx41L2vjpo eF5rqbKpw7fLYxwd3rB2NYWa8kRT5Aet1vstoxRWE4bRy8h1bw/BGZ/c4gvfqB7w4WnO XR0h7IFTnmUInXJXVoKT/G1D7P7Xh3IzsCe93KkcNM3ZmEz2u6MjmM8I3ttam6FbymaZ dw+Q== X-Forwarded-Encrypted: i=1; AJvYcCXnyDR2Ay+XVAsmF3IE7aJuqC4w85p2RBCE0GKLTl6WyOrAJjJZWdYLqy6PsRL+yF1BwiThBDN6FJaOV8XZlmHhLRbXMWI8e3pBtE15 X-Gm-Message-State: AOJu0YwVQLPyi4gDDRibJD1R1aiR5Y4TOZyCBn9uYGWFtvx9VcfgfXv7 4lHti5qEfnLI4i7rSOxJ7IaBV+jp7oIaV8yO6qVdTdnAbBmmeCZ05Qjx1f7e3w== X-Received: by 2002:a17:902:ccc2:b0:1dd:159:e2e7 with SMTP id z2-20020a170902ccc200b001dd0159e2e7mr6628681ple.39.1709574964374; Mon, 04 Mar 2024 09:56:04 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id t7-20020a170902e84700b001d9a91af8a4sm8792261plg.28.2024.03.04.09.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 09:56:03 -0800 (PST) Date: Mon, 4 Mar 2024 09:56:03 -0800 From: Kees Cook To: Adrian Ratiu Cc: Christian Brauner , linux-fsdevel@vger.kernel.org, kernel@collabora.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Guenter Roeck , Doug Anderson , Jann Horn , Andrew Morton , Randy Dunlap , Mike Frysinger Subject: Re: [PATCH v2] proc: allow restricting /proc/pid/mem writes Message-ID: <202403040951.C63C3DF5@keescook> References: <20240301213442.198443-1-adrian.ratiu@collabora.com> <20240304-zugute-abtragen-d499556390b3@brauner> <39e47-65e5d100-1-5e37bd0@176022561> <20240304-legten-pelzmantel-1dca3659a892@brauner> <3a1eb-65e5dc00-15-364077c0@216340496> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a1eb-65e5dc00-15-364077c0@216340496> On Mon, Mar 04, 2024 at 02:35:29PM +0000, Adrian Ratiu wrote: > Yes, easy to block and also respect page permissions (can't write > read-only memory) as well as require ptrace access anyway by checking > PTRACE_MODE_ATTACH_REALCREDS. right, I don't think process_vm_writev() ignores page permissions? i.e. I don't see where it is using FOLL_FORCE, which is one of the central problems with /proc/$pid/mem. (Which reminds me, this is worth mentioning more explicitly in the commit log for v3.) -- Kees Cook