From patchwork Thu Apr 25 20:08:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13643713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA5FDC10F15 for ; Thu, 25 Apr 2024 20:08:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EC1F6B0087; Thu, 25 Apr 2024 16:08:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69B966B0088; Thu, 25 Apr 2024 16:08:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 564496B0089; Thu, 25 Apr 2024 16:08:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 379766B0087 for ; Thu, 25 Apr 2024 16:08:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B835780622 for ; Thu, 25 Apr 2024 20:08:55 +0000 (UTC) X-FDA: 82049142630.04.C9EB9AB Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf19.hostedemail.com (Postfix) with ESMTP id EBFAD1A000C for ; Thu, 25 Apr 2024 20:08:53 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=MWGpM4cR; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf19.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.175 as permitted sender) smtp.mailfrom=keescook@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714075734; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=qy9dTrTP2OsIqwtd1vO3NsTWFfZryD1eD3WzbdxI4A4=; b=BswsXSHuu2S1Mob9/2zO5LviKovOa5eqr/hdOlGm6QpjOM2sBWjK1rgP0jeVuyfldwoV05 Q/FQz85YlP/N5zFKYMEbRqtN5uCZeSkB0dV5Niig1ZSRtvyElp/GNDr7AmbVTNQDeEM5fl H96RqPGIGqKW8/EIqjjpp7awR7qV5cg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=MWGpM4cR; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf19.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.175 as permitted sender) smtp.mailfrom=keescook@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714075734; a=rsa-sha256; cv=none; b=AznHpm7QzGEJT9CZM8oLLQoCwZcikgZc+ZDeokeSloUfVJdt2fmp46pz+cpxDxXniSv5CU h/1Vtr10uyIULoIOGw31+/cEsrJ1zc6+8abJ+SQIefoen72W5XeCgxEYAx8Fdwo5ZcxMIF Dnd9zR0yWvJwBk+sAUj7Ykn4LbRhIX4= Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6effe9c852eso1271837b3a.3 for ; Thu, 25 Apr 2024 13:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714075733; x=1714680533; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qy9dTrTP2OsIqwtd1vO3NsTWFfZryD1eD3WzbdxI4A4=; b=MWGpM4cRARW6ZCvBiQD0mxyoqT7E5FBkMtTVPy2+TJ3t8x45dqcRccgFY0hUaB4+eQ ZURu0oM3klaIIujOsXuBz9+rvnLJzAfJi5MmD8K74Hpf8lOyB/yx9g3FaUqAUijn/uVT U/c2n0R3HYyPVuedFk9diqVqtj3Nbs36ttP3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714075733; x=1714680533; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qy9dTrTP2OsIqwtd1vO3NsTWFfZryD1eD3WzbdxI4A4=; b=Rzo77okh2qoMbS62BBBgLnzBTgIjdxdc2sKSVxioJxEdLCpP6R2uJYLbdZJx8GstAV eWccKVFhMYaw7UaSqIhgNwCzBHT7oNQMphOEG79HwQ7q8KvytilJyZlYiHkZ3ROFSp3r t7Kr11F+IKIfQIGwswjrWCMPoYMVMLGs6tox0DuQgkUsiJEd7a6R5dv2stus9EWse8h8 yzG5D9xkEmmsWN0tNVg7l+402xbPA+nsiU7ym5DMhn3hfVRa4PBRUzvOfq+dkbFw2U2r 2Vl+obCBB0zRCVE1ArPxNlxd0b11Xx7q7kcOnxrCIgnHMb66JMPi3oB25fbwhlYZ/Ce6 GQpA== X-Forwarded-Encrypted: i=1; AJvYcCWaohtqTIpK8/0LEQ6eWjymsOB+gVdaVq2eVPF0afKB6mVifb8sffvGwaJEUfNo0OWFncaZJfNemAcF7dyXhy92rdM= X-Gm-Message-State: AOJu0YxtUgEfaB3L5HtHOHZobseGi0IZIlKBGmiitxHhhcWXuLgg4+Fg 4qkER5oH5bE45Zk9juX8wJCyaK6Em91c5AUFHlGIBgatzbvEkF894eCTbiC2zQ== X-Google-Smtp-Source: AGHT+IFmImq/jNB3gD8qNUpJdps7KncEBA/kJcWPP8UMkwjlmNBRr6ooOcKlnOdjQA//knsljrd39g== X-Received: by 2002:a05:6a21:7885:b0:1ad:89e:21b5 with SMTP id bf5-20020a056a21788500b001ad089e21b5mr988185pzc.15.1714075732929; Thu, 25 Apr 2024 13:08:52 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id g4-20020aa79f04000000b006e7324d32bbsm13530499pfr.122.2024.04.25.13.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 13:08:52 -0700 (PDT) From: Kees Cook To: Suren Baghdasaryan Cc: Kees Cook , Kent Overstreet , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] alloc_tag: Tighten file permissions on /proc/allocinfo Date: Thu, 25 Apr 2024 13:08:50 -0700 Message-Id: <20240425200844.work.184-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1105; i=keescook@chromium.org; h=from:subject:message-id; bh=uumuIMYEYOvPVXZFk/3WBGzdtoFi6HEW+Cg848oMGpo=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmKrhSukER5dI6JK2ZE0ZAaG3eDSZ2FZgsQIemT 23PMDlr6nOJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZiq4UgAKCRCJcvTf3G3A JoyyD/9vYCxON+r+gp9NzoIETQ6HOBwagR6aIfo8Sz0qme5nDn4C4GMI/4yFyvqny7W6MYEfe3p BYKx7kN60yCg2lPwlRzGifnRo1d1njWkmJxd3bw4Vb7oOG1FBTy9y8rHR/B7fhIdrISNQOEfatK F/1L1suXoqYMop/8SmrxFvv5vwGqZWQN8l9quAI3ut2RpjKAq4s94S6iSHUonWZFfinxW20po89 OVRSGGtpLe2o1txNJAaRnjCjlJHQ28Vmd67LzqLOTAjGPExvFeVl4YwXtDIHCDzgS+E9FHQvbeL gbdJxZ8XxqznvlHtgTkDpwITrpj2ujH9zQ6tBC5oURp23exix85eC3JKWXnuV4xLTBCjXUhER4b el4b/FbscJGd0X8k0l56NtP5fLypgmZw6tKs6KRT3t1eKWbmUjAG3PMyzw6WwSToXU3XOERTwAj u7h3T35RGClj6ySgfpa1yHXpNuRmUBlOsVdCjawkZ6VPB13H9OfzwRkn00iySnd/agD7zszDgBg f9IOeoCyBtR+hK76+QxFlJd5D5fmCTZa3iMyWOUgzH6bWK68+qKIYawDKTPm9VzkRE+7cy9NaeE arpvhoenbCoCwDs4v1qmdEMVAxHEI7AbI8BZQTG3+N/RCbbAC0+eryQFvR+kShgCdpg85f9NcW7 cfpZR39 Z6QG8tbg== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EBFAD1A000C X-Rspam-User: X-Stat-Signature: 13m8jis7wxcuozom5swenzbbaaagkho3 X-HE-Tag: 1714075733-340845 X-HE-Meta: U2FsdGVkX1/6VzkQCIlSZki7ZWIfe4GH+JRxTW0ZdMGBRsk6TCiKisykisRXh5/JnHGZ0Ngmpwf5AokwOhFS8JiV2LVqNAevInS6SY1rydA7Fhp9JAU5NJGe+eixrjJtYZwx1X/kZHvKq2uviE/CKJOgq3st8MJwX6F3YwCRNLEnn/B9UfK2ffPmrpadDQZwNpe1qg6oETrkObqp/SVOADQ0EpZiyYLqLCXXoOehaCrqsWDiqHrF7WTFW3XJykn1V+7Bv+3O/jWjnjbw6YvL6nDugnAfnHsS8OSkBOSTA7aY5JpzKR60rTps1uY49+YLR26iVWDCp0FZuCtp5NB5hVvtK+9i5tFRfV4soh12Wi69Py0/7ZAvc6KCEHsyoHFLiKt8iUTa9wHV3ZYqPWOYXkKH+RUNjEqbnH/dZRFayCHsf6dqOTCpkqxyn6EQmNGBW1QF8tnlZuB/0TIakCDxt94hiM0pw5sLKs9PpJpgZkOs0MKJoAWui3Dx8QkQrml596AkH3ivn7r9GcALe9makHVVO95+XBII0r8n8CgVKtSI3UYMX3OBulZjS6rNBDLZli3aEh0O1kMqtwDg0IMe++7o4/w63M7uotZBRIpmtv/bg8nBW5/ili/Lbi/G/79P8ySAouTky9On4Oy6FFTM3hvKAJfpho7qjDej/5z67jKg0iDPVs3YmvVVGQfmKcjEpnSzVEur6POTvMFw/rNvVLumq+Hd79KoLGXaa+KB7J+2UZ9i+N+RTYAjqOXeH0asrC94dgEv9wLMPZ46GQi/1y120yGrUGD259vbz1/19e9hlxNYoXA4FZfjGNUc1S2rXZDGj+B/pc4Fk7OdRt5XYVu/6lPZNzeELaHr4gyfFI8hZ0T4H7odEXCSRvAZaiq1M4VhF01qUSXUBp9GcvTYIsP3PT4f7R30sx++MiWBfbNOwQVatrzbQEmWJDtG4Zp30QEvbHLMcciYrpQsTNp Z8h3ZDof Cy8DeOiQ1gF7ebNtUV06TXQGjBrm5oWohuInHQu48w8/+F2Cfckut6/kh7pReKRMVeQwHQpz35QI481YnhjXcynpqRDPQlq/0Wi8Rg20fLTp0j6aL4vkiKJ8LejQ/k0ULTrrTqkA82+hMBTSMIzhsta1vmN5PHS7ek9xFvyRLIVl6Hgp8BgijPUCIiKQWTmch46VZi1lwu0mmHUw9AtIXl+y3zSwCVfJnCLBZuEMxezfeuKjZcVCbSso39vFLGYaQcVA0n/AAGY3bjJnCEzp7VlBoCFlF1wPqnimJNJBoHnyJKbAcLVr6kzZaANebjcgOtLe7+VNqdGgIlat9PsgFfL962bAs6My7pg0bTjXfJ7T48nuemKIpqTN3DnclJwYE7whKQ4boQ0qYyEIt6K6rC8Ln4bcDsEXt+kPZ34LyWBLy4GDnOdm4R5+6gfbYF7fw0uhvCe7lbA2OCtSrG5klQPJrVeIQcVGjFk5TVIU6SJGq4tuGmImBRUqXN/X3vqHPbWXOZ0pkPtMO8VQS6mjRiKS/txyjxL1uAYWjcYFvv9zqxqg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000037, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. Signed-off-by: Kees Cook --- Cc: Suren Baghdasaryan Cc: Kent Overstreet Cc: Andrew Morton Cc: linux-mm@kvack.org --- lib/alloc_tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 26af9982ddc4..531dbe2f5456 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -129,7 +129,7 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, size_t count, bool can_sl static void __init procfs_init(void) { - proc_create_seq("allocinfo", 0444, NULL, &allocinfo_seq_op); + proc_create_seq("allocinfo", 0400, NULL, &allocinfo_seq_op); } static bool alloc_tag_module_unload(struct codetag_type *cttype,