From mboxrd@z Thu Jan 1 00:00:00 1970 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 34850C3064D for ; Tue, 2 Jul 2024 14:50:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8741F6B0082; Tue, 2 Jul 2024 10:50:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 823FD6B0085; Tue, 2 Jul 2024 10:50:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EAEA6B0088; Tue, 2 Jul 2024 10:50:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 521FF6B0082 for ; Tue, 2 Jul 2024 10:50:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F32071A022E for ; Tue, 2 Jul 2024 14:50:17 +0000 (UTC) X-FDA: 82295098074.27.4813484 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf12.hostedemail.com (Postfix) with ESMTP id C444D4000B for ; Tue, 2 Jul 2024 14:50:14 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ZZnYdfBq; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf12.hostedemail.com: domain of ak@linux.intel.com has no SPF policy when checking 198.175.65.10) smtp.mailfrom=ak@linux.intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719931798; a=rsa-sha256; cv=none; b=mueMAGTHY3PhsU/zUGeMpdYzbvUOwZpB9ciQe/rW1/J3Ec4cQCq5y2YypREGWIek/3qrfm DzgBiGTQYfjFD2ago/41mgEXEhIM59sCNU7j10lw30IByltZd+doyG5YQtGoYR9qFpGktA h5zrpTZ0YyJqznGmCmujBqSr/Q+yGJo= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ZZnYdfBq; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf12.hostedemail.com: domain of ak@linux.intel.com has no SPF policy when checking 198.175.65.10) smtp.mailfrom=ak@linux.intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719931798; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QIwvbj/sHtZH/20Ln6DHoGOvibaEtBWOBpS1H8hoPLw=; b=mab0b7NJHS66LMhY85bIpp25f0dSZ931YMGRh0in8/P7XtfI97zhnwHM4QgEtjnHoxeWpD MBpLbTxK7p3G5LxX2JzeQHcsSBQVTZ4fBofJyY7bRnmv91FKKvPTjhOgh2XD6KxEs6EYRB TktkyTt0zfowoeQfw7ktM+Dmx+N9Ovk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719931815; x=1751467815; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HqJSSoNKjIMDM+CJGgP+I5L5NB+rRz1kCBLAO8WJm7A=; b=ZZnYdfBqjnATfzG3CLFd1+0D861dlCKvpp1joaakoI42itan5bZ2WI/y OUYw1zr+sSHtDnXhPGsla/XroPG68GmiT57tXCHFxNt8PHDHNLO77ufxn yDdHly0Z21YnbGhN0YpilkzB7RBeC/IqW9ZOJO4wPZivWqSdqMQiAUyKE p7OeuMUeEPQy+J6OXvw58jvCrtutgSU9GXYx8Z58TIpVLKT2nlVEJzsAo /Si+DshtcExVY47HObhtsGvXDO9q0EEqaFdnBV8bxblEqyV2QPdh1elWB 7uao7CIFTDULG60Lk1Osv70te2INKVI0/QfpDkla08YPnXXcJSQG48yRv Q==; X-CSE-ConnectionGUID: pBQcWzYZQ1mlsQGQ/4wIdA== X-CSE-MsgGUID: zmEmfdlCT1uq/c3Js8F/jA== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="34558300" X-IronPort-AV: E=Sophos;i="6.09,178,1716274800"; d="scan'208";a="34558300" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 07:50:00 -0700 X-CSE-ConnectionGUID: 6Vw0grZvTcSZ8AqT595Amg== X-CSE-MsgGUID: JIBGLbcKT1SxXJQ4cNjqIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,178,1716274800"; d="scan'208";a="51117023" Received: from tassilo.jf.intel.com (HELO tassilo) ([10.54.38.190]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 07:49:59 -0700 Date: Tue, 2 Jul 2024 07:49:57 -0700 From: Andi Kleen To: Andrii Nakryiko Cc: Andrii Nakryiko , linux-fsdevel@vger.kernel.org, brauner@kernel.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, gregkh@linuxfoundation.org, linux-mm@kvack.org, liam.howlett@oracle.com, surenb@google.com, rppt@kernel.org, adobriyan@gmail.com Subject: Re: [PATCH v6 3/6] fs/procfs: add build ID fetching to PROCMAP_QUERY API Message-ID: References: <20240627170900.1672542-1-andrii@kernel.org> <20240627170900.1672542-4-andrii@kernel.org> <878qyqyorq.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C444D4000B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: e9wxmmt5r65miwgwdd75sua3ok5hctix X-H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R9qw5oPkVk0gSAs/KX44wzOF4PrlriArcYn0XlrQaDA/cfQnMwWZSnNS9wntuEx0SiY309P2Ul80tsKckpErghZbMF7G/CXZy+pCEPKfog1wMjSJ3I7UWTRjJT7KzpYfxvgzOuodFZ/IhdIlaOpWMUlzTgJF8tsZ2fiKEerZg6+/UWUOsc32ZHxhqhq3xEYlkCBjcYsG5YKZKAxOtYdHBfVDlIyg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: > 1) non-executable file-backed VMA still has build ID associated with > it. Note, build ID is extracted from the backing file's content, not > from VMA itself. The part of ELF file that contains build ID isn't > necessarily mmap()'ed at all That's true, but there should be at least one executable mapping for any useful ELF file. Basically such a check guarantee that you cannot tell anything about a non x mapping not related to ELF. > > 2) What sort of exploitation are we talking about here? it's not > enough for backing file to have correct 4 starting bytes (0x7f"ELF"), > we still have to find correct PT_NOTE segment, and .note.gnu.build-id > section within it, that has correct type (3) and key name "GNU". There's a timing side channel, you can tell where the checks stop. I don't think it's a big problem, but it's still better to avoid such leaks in the first place as much as possible. > > I'm trying to understand what we are protecting against here. > Especially that opening /proc//maps already requires > PTRACE_MODE_READ permissions anyways (or pid should be self). While that's true for the standard security permission model there might be non standard ones where the relationship is more complicated. -Andi