Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp130281lqf; Fri, 26 Apr 2024 01:37:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsd8Y89LH7mrqeCaDg5rcfoctfWgKGRJ//z3rf6kQbq83vGi6/zfNgG3OBVd+WbNMRt61y1NGwJg04tNnjJqItQpXedsu4BHPLeteMmA== X-Google-Smtp-Source: AGHT+IHiCdGZzwktiOI/AVm6u2bL4jvh25qmmuSXXIkJI7eQ3Hy/bHk12u4DtHLvL8uuWm9EmfPF X-Received: by 2002:a17:906:4151:b0:a58:7239:4cf2 with SMTP id l17-20020a170906415100b00a5872394cf2mr1306867ejk.52.1714120679644; Fri, 26 Apr 2024 01:37:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714120679; cv=pass; d=google.com; s=arc-20160816; b=xONwSxESZVp4Myv3QQHuua/f71J/bCBCg0G/6d/kYPgD7ZIubAjkfHd3DWwRyKm/mU iVyf1mbb2WT//+FNegxQ4xhzroGJOe9OUVzTJPfyXw5S3JJncOGvHiWelWKmmZXHO4vd FAJHsS7pE2wEC6MI/Eq43fD/qWHKxCEjpNOwJ00d6v8sX5mGiOblJQzEChgkNeSx3H2M pWDequeTyJisPInlR4usDia7VVB8EG/HVvartsLeXJ19fGnC5o66/dGPAgVN0iQL0+xU xynQQ0kf6rDziv8C/04PCs8K5uJTNoMJ2f/+JN6CfdQ2CAgziOSGt3BeJaw/I+0H37z5 caVA== 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=Y0dysf36aM5avB8c3yAupwYZYTudX4kjUfayQHr8SSA=; fh=s7JEaGN3wD54sycjyHGG1zkoeTMUQBVlX+qlgRAWEP0=; b=LTWavSP1/fNIFKivsCQAnGaRDazHeY7wguddu8EsiZGzpF3vTm1HLgd0oCkok0EUZt OC1NtoEQnvQelKb7PW+qD6BgaErtoFBBx+spzr2670oQQPBGKZyVtmEjT3DxWrgBkajk Ow6b31w2E4YdVegH2ILvQe/PI4gIjNmGe6Q7PwmwDhNvhWZI6pwbUIU9FRjKd8q0flWB 1egk79745IFFG7UJt2daOrV8TpCaTPrSNkAUyR8gKGmU8t4weoFZR5fbegGdqXfR2Iz4 oHA1b82WWi6v3qTgLnHfaKyUvi0/YIsgXQNgxaCrRwWOENzaPQSK32/jR3CMYc2EuiKG nK8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=b7ZatGXx; arc=pass (i=1 spf=pass spfdomain=ucw.cz dkim=pass dkdomain=ucw.cz dmarc=pass fromdomain=ucw.cz); spf=pass (google.com: domain of linux-kernel+bounces-159715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z8-20020a17090665c800b00a51c4d61266si10241482ejn.308.2024.04.26.01.37.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 01:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=b7ZatGXx; arc=pass (i=1 spf=pass spfdomain=ucw.cz dkim=pass dkdomain=ucw.cz dmarc=pass fromdomain=ucw.cz); spf=pass (google.com: domain of linux-kernel+bounces-159715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 632BA1F20F78 for ; Fri, 26 Apr 2024 08:37:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71CD220317; Fri, 26 Apr 2024 08:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ucw.cz header.i=@ucw.cz header.b="b7ZatGXx" Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C8B21379; Fri, 26 Apr 2024 08:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.255.230.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714120359; cv=none; b=XkiC70+udWbPx1TdHkiXZ5Gl85enj1IED1xmY1XRLem+UmVcNvSTvPbDClX3Zhpe+oy/Zq+8OqNgIzSiWUKutUjsM9VLf0IVzClGY6xV534Q0a6oZvgou4wTNG/DDcTMHbc4DoQGAaa98PFhDz7jKDEe/sIpbvzraQvP1da7UiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714120359; c=relaxed/simple; bh=JPzmIyrTXDfjqDAST+PV0hnEHHxODh7jJkm7vCutels=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bUmrTHcvubFmjPw+9FA3RDuovt7w9P5Jf3ouB19yQtno2WW2dTWgeK6pMBiJIXZbBq4b9JEYSzJxC+SBxJKCiE6aQ/3KNioI+5ukatzoTBQpbcqvPZfO6Id7wpBD4u1gPPHEx/G1lBG/7vNOnWnL6YFqsyi6luvzOjWP5cw9/4Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ucw.cz; spf=pass smtp.mailfrom=ucw.cz; dkim=pass (1024-bit key) header.d=ucw.cz header.i=@ucw.cz header.b=b7ZatGXx; arc=none smtp.client-ip=46.255.230.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ucw.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ucw.cz Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 776511C0080; Fri, 26 Apr 2024 10:32:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1714120348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y0dysf36aM5avB8c3yAupwYZYTudX4kjUfayQHr8SSA=; b=b7ZatGXxsSYhR8l8hZJRyGFW+LOr6qOGfutf+6Zm1P93RkDEUXMhKbTq6Vb+4x8qd1/MSK vozQMYgkGMFXitwkhVsSrNpvzMaOIobS45adwv4yKpTz8zordqplMkYEwt7hX30h5lSRJ6 F1ESRL67V725AzzD/gtl2JuSFrK6Uz4= Date: Fri, 26 Apr 2024 10:32:27 +0200 From: Pavel Machek To: Suren Baghdasaryan Cc: Kent Overstreet , Matthew Wilcox , Kees Cook , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] alloc_tag: Tighten file permissions on /proc/allocinfo Message-ID: References: <20240425200844.work.184-kees@kernel.org> <64cngpnwyav4odustofs6hgsh7htpc5nu23tx4lb3vxaltmqf2@sxn63f2gg4gu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="b3R0spGM4QxycKkW" Content-Disposition: inline In-Reply-To: --b3R0spGM4QxycKkW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > > > The /proc/allocinfo file exposes a tremendous about of informatio= n about > > > > > kernel build details, memory allocations (obviously), and potenti= ally > > > > > even image layout (due to ordering). As this is intended to be co= nsumed > > > > > by system owners (like /proc/slabinfo), use the same file permiss= ions as > > > > > there: 0400. > > > > > > > > Err... > > > > > > > > The side effect of locking down more and more reporting interfaces = is > > > > that programs that consume those interfaces now have to run as root. > > > > > > sudo cat /proc/allocinfo | analyse-that-fie > > > > Even that is still an annoyance, but I'm thinking more about a future > > daemon to collect this every n seconds - that really shouldn't need to > > be root. >=20 > Yeah, that would preclude some nice usecases. Could we maybe use > CAP_SYS_ADMIN checks instead? That way we can still use it from a > non-root process? CAP_SYS_ADMIN is really not suitable, as it can do changes to the system. On working system, allocinfo is really not dangerous, it just may make exploits harder. CAP_KERNEL_OBSERVER or something... Pavel --=20 People of Russia, stop Putin before his war on Ukraine escalates. --b3R0spGM4QxycKkW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCZitmmwAKCRAw5/Bqldv6 8iSqAKCKKro6xd8WHDcLsDlqyKCPFqd44gCfZhN+HF+SZvKopvK94yJ3xCHoKGY= =VeNA -----END PGP SIGNATURE----- --b3R0spGM4QxycKkW--