Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1395092lqd; Thu, 25 Apr 2024 14:26:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKyTzdSHcmflDDFOoLYqsgXUzqky7wEjiO/k7Ypnpz6CyZ4esH2fbZQpZSkJ66pv8MXt2M0m4kHL6IBbeDNqH7bTG1lBbePLiZSIIKaw== X-Google-Smtp-Source: AGHT+IHbAn0lSV3Co0AE7Z3/EzRvR4t0p3imYv397BL0txG8LnwANMndrQxNzxRzsPrKqL18xcad X-Received: by 2002:a17:906:1c48:b0:a52:56e8:224a with SMTP id l8-20020a1709061c4800b00a5256e8224amr655636ejg.51.1714080367224; Thu, 25 Apr 2024 14:26:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714080367; cv=pass; d=google.com; s=arc-20160816; b=s2pLB4r5ta7DeuOVL+AUu8/XnXO3cw3AHRK89gVzzsFxyLn1Ty6bfXHBCCcuJnOzYE OOQkRhRQlmnpCiZ9z4arGIWjtQOavfnhYIDFZrU8+4GCiu0aENSuKYosu+IRqeZZ3qYT GglH5KZ8jzXwz4g4XskBc8jUzScBHdOL971pO9ww31FUg8GKTHsGFC4O7cYnlnrHItCY WZa8viSCfy//FuVL6BuoOt5yq8NqUx/6qXeZgcv5N+ltfCpRZZvitpsBEE9290YPReEU KSr0F7m/rAE+dhKbg9F4cPOQtar6EpVRen60PB9aNjnq8ksYNhTMEkdAG2GWwIh3MxpH dgcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=bcs3Nm1/9Fh3J4Kqjg9L7siFh+ejjk1lAbPq3D1UGRw=; fh=BEERVL7j+fuqMohCE6DvsIRb2CF90UfynTbtOZ6mCYI=; b=OFb7Y4+2jyMTgbdgdutGFyo9myVgfVrYiLkq85xV8dKc2Oblkuqq7OEnxGiEYiVIog RGJwApBiofz+cUOy+3j7ysbvPVUFzzBuKgGNL0TBiOi/MlDSwQvDHXKCLHAveSw4kQn/ RFTZLxV7eObYC0F9HkJMEgQVwuAi7rpNhRyVndwsPsgm31+gvgOQyl2L7oPcTtH/xRBT rJXH3Wtxgq5Z0EG3pRRwf/t+HL+otPdJEuL5L9E5xva/RultXPZ8zzmKRiMwCSrJ9Jio vROZPm/vI9HnFP5H+msSaP9mrhvTCz+v8rfiCEbUpxV6zdr5Tdq0ZMNs/DAmiqe9liq0 SNmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=YmQbhvqT; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-159205-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159205-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f7-20020a170906048700b00a55b579f467si5886636eja.604.2024.04.25.14.26.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 14:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159205-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=@linux.dev header.s=key1 header.b=YmQbhvqT; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-159205-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159205-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 D3EAF1F227D3 for ; Thu, 25 Apr 2024 21:26:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 198DE155734; Thu, 25 Apr 2024 21:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YmQbhvqT" Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (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 3B11D153812 for ; Thu, 25 Apr 2024 21:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714080360; cv=none; b=H5U5w2DgUDkCwpoCtHQdaLsDCBykdiUZwL3ob+CvR+sGlOShzVacK0WL+uowDMb0iawRvGxngbmf4LXUCfftnvm/rK9jmelVOCpSrAh9z3WXVfUmEOwfDB1U/j46bosqd65AwhEIK0xftC7XilrkmIr+YSlqHHUw7DFC4o60RBs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714080360; c=relaxed/simple; bh=ANuUZMaTH+/J+cSi8lFPdQJweuKHc3U1ixJgR978CHw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FEAhfqPQs+4U99cVq3mAzt/jDupLfiUcxOAazbAbSUHlFpdLIXgiPDWLqZ799ljFEo4RHopOF9JNHol6ovkUdR2t/hyTnalpkUJMoYc5czMJPSDJsWXUJy6jSjoX6GNeWNnsfEEYx8RClF2r+XgAaYKD7KWAkCwgEyh9UMQkqpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YmQbhvqT; arc=none smtp.client-ip=95.215.58.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Thu, 25 Apr 2024 17:25:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714080356; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bcs3Nm1/9Fh3J4Kqjg9L7siFh+ejjk1lAbPq3D1UGRw=; b=YmQbhvqToPD8nhSNDwaoX67lVDstd2lh5nC43lMUz2k/EOy6dFPKAW4SrYT2ZhD3p560p6 Bmlbsij0Gfehhr1YbVmUEz7InnK3T+SwykJMgqp0T5g3mGed6q/JUm/btmDRDBA/mP/cW+ RtYzd/Y/R+KOSDYGIsjIm8vMj6bjhdw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Suren Baghdasaryan Cc: 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: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Thu, Apr 25, 2024 at 02:21:39PM -0700, Suren Baghdasaryan wrote: > On Thu, Apr 25, 2024 at 2:04 PM Kent Overstreet > wrote: > > > > On Thu, Apr 25, 2024 at 09:51:56PM +0100, Matthew Wilcox wrote: > > > On Thu, Apr 25, 2024 at 04:45:51PM -0400, Kent Overstreet wrote: > > > > On Thu, Apr 25, 2024 at 01:08:50PM -0700, Kees Cook wrote: > > > > > The /proc/allocinfo file exposes a tremendous about of information about > > > > > kernel build details, memory allocations (obviously), and potentially > > > > > even image layout (due to ordering). As this is intended to be consumed > > > > > by system owners (like /proc/slabinfo), use the same file permissions 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. > > 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? A sysctl would be more in line with what we do for perf. Capabilities aren't very usable, and CAP_SYS_ADMIN is already way too much of an everything bucket.