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 1B26BCD6115 for ; Mon, 9 Oct 2023 17:37:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9133680031; Mon, 9 Oct 2023 13:37:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C31080027; Mon, 9 Oct 2023 13:37:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B19080031; Mon, 9 Oct 2023 13:37:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6AA9880027 for ; Mon, 9 Oct 2023 13:37:17 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3B0C380381 for ; Mon, 9 Oct 2023 17:37:17 +0000 (UTC) X-FDA: 81326629314.20.3752D35 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) by imf20.hostedemail.com (Postfix) with ESMTP id 6E0F21C0004 for ; Mon, 9 Oct 2023 17:37:15 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=f1Xdy7V+; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf20.hostedemail.com: domain of keescook@chromium.org designates 209.85.161.49 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=1696873035; 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=zd3O1eB/Wpq6g0qSptggykfHJXEZdAtkErQAM+wkdIU=; b=vLTHdmZYGdzm4vc4mCKCSTN+d9qD3H6YQRMnSV5Sgd8Ruy50fioDQZgls2Q0GKMods90ns mDX766PmE9V6U2uVSedxzbpVpycCwMBuUGHhG8R6+22mHwYofAYIB2cjca2jmILj4P/iKy iYPsviNojIsoj17Xy4XU6vebEM+4klw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=f1Xdy7V+; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf20.hostedemail.com: domain of keescook@chromium.org designates 209.85.161.49 as permitted sender) smtp.mailfrom=keescook@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696873035; a=rsa-sha256; cv=none; b=wxfYZhm459KZ6LcFF8CFP4W77W6FB2GXLbWYGNRMnSrpb5+57oPXG99LOIVZsR7Ddju8XF FfXJdX0QcxjKw4r9cQ445svHfPRnbxIm3F6+o03wVAOd9X0WK06yvfylz06p0m7LA3NOPJ UDOSOwUBlUHKB1mNZQBvZglsVyiUqsc= Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-57b74782be6so2665458eaf.2 for ; Mon, 09 Oct 2023 10:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696873034; x=1697477834; darn=kvack.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=zd3O1eB/Wpq6g0qSptggykfHJXEZdAtkErQAM+wkdIU=; b=f1Xdy7V+tI5Be5l930dKqd3SVVRVL36vvjV0URJKoOCQyAlUmjTygwwaqqdjbIwRYJ gxxeUAYULDeUCsVTz3Qg5CUDfd6Rp74n0+EPBr2FHwg3w4vKxDvQApF1yq5ubZ1FP4fk yBb7PzDelNCFOiP2Eiz7qWeKThZENFoTblneQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696873034; x=1697477834; 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=zd3O1eB/Wpq6g0qSptggykfHJXEZdAtkErQAM+wkdIU=; b=CZ+Jk3S6mRMXAaxWhxvLrqG9geUYLIm8//JB4cthYmQZJLwM5LV11ZF/HOu8PVMGhx moKi7rBMdY+Ky0YxqQwqIbRlWr2rfTXRrdnRhjcMU0NoIeVFWAM83pJjZ6Gbem4lwbbj ukGfisUT76RuDnchQH1M9Yg3PtDWxDIE91rl2/DWnVd9gKoztsCDwgkkmKV3/AUx0qLH SIxWJ5IJ7VrUWaqoFAWRjRZhQltsFw/ObCAbSRdxRs7Mz3V+SGpuvGTL3beIhcsFDVG8 NnU8GXZKCLwWHpxUlAjQF+CPYBrhu8FXNOmfpOPxaPGl4wA7shqgzfVxxwxRUzS+0Z/j cCkA== X-Gm-Message-State: AOJu0YxMhz4FG81oPH59ziM7znWrieRIP3HytmzyqkqDiqcI6x3K/Jpy FN+P8dfokPkdsWyEJxVdpi+kog== X-Google-Smtp-Source: AGHT+IGu8KBpPELECSJVM0YYzq3jws78WVViT8o+27geAQZlCLJCe8lEhxuGAZR5GU32WI+llpg5kA== X-Received: by 2002:a05:6358:88f:b0:135:47e8:76e2 with SMTP id m15-20020a056358088f00b0013547e876e2mr20101688rwj.4.1696873034345; Mon, 09 Oct 2023 10:37:14 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id b7-20020a17090a6ac700b0027768125e24sm10306606pjm.39.2023.10.09.10.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:37:13 -0700 (PDT) Date: Mon, 9 Oct 2023 10:37:10 -0700 From: Kees Cook To: "Guilherme G. Piccoli" Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kernel-dev@igalia.com, kernel@gpiccoli.net, ebiederm@xmission.com, oleg@redhat.com, yzaikin@google.com, mcgrof@kernel.org, akpm@linux-foundation.org, brauner@kernel.org, viro@zeniv.linux.org.uk, willy@infradead.org, dave@stgolabs.net, sonicadvance1@gmail.com, joshua@froggi.es Subject: Re: [RFC PATCH 0/2] Introduce a way to expose the interpreted file with binfmt_misc Message-ID: <202310091034.4F58841@keescook> References: <20230907204256.3700336-1-gpiccoli@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6E0F21C0004 X-Stat-Signature: wtayqpbbgefjgnmoaeuihdofik485skh X-Rspam-User: X-HE-Tag: 1696873035-868613 X-HE-Meta: U2FsdGVkX1/p0NZFsfCNWhACVG6vXJ3g5Taa4fP/trZVxpCe38Hq4Wbwn7JOh+i1tL2TYwlI7FFtql2mmgeCaMaaXb77FwowmffaC/pe6Ik2dn9WA8b9VIMOFOc3cawMP7/Noi5zi4QCoa2hjswcQrnWdTwtAoCosK1trkMJIZx8yYGlO94ohinyLuGKl5aUTzfncVboSjI1+hC2bR3ytAe+dHhGgr0cTbil3YwC76ILmY/4LhZq5+xBDXieZp2eLNjIB7X+/PoUrX3qERDcnMpNWW6PMOCsxhS8oiYCDzCuesqO7dIZtqnd5uL3Pq5JJvGSSLcar3051yO6CYuOLraOgUS1N4y5o4ZJOqo45eiuFVUlZy+2SFpk/B5tAW8mLyuR6wSG1RhlCQ3J/9k/tHTwkH28ufA32bLqyISpTbaVNP1p9GiznFjKNXwVrahDem3aMiXgbbCsFeDQUqebTHtTd+MGweEUNKw8sRZ2PVHbvi6RBwLJpAISu0aoJwMAMrNj+5gzeuGAtn0nJoSbmlGw5bWjBiVNUwN/s0t7PnUl4+uAsAgyjFdVKWnVqtczchQVwWbglbHOWpKo7vqVE79MDmeqtCYtykZz3TbOVUDANCQwblPh7V/xJz+pyU6J8HRMeV03V0BqiQ8gRgPyblmPtg4DKA5yv0PLYlaiNRAC9rxecWME6pq8R/RINnHoM7Km1H5DEI/HNHs5OR/T5n8IJ9cGQRopz75rcUammj9pw49tPtGh+jEyX5sp2N4qlrkxO5PyqIVXG4SyzSAwQuwVuLpekRyljS4qTEcwoVWZH+C/SVvIA/7Dn1BXWB11P1qVZ2v8n/3h8vtlgoz2DjPMnXHYbDfKDVAHtdWCtwARQdI5YVJ9F8NUK2Y19MNzbb4lb6Vtq+t2X6BoFQ8m3rJ3NVMGMPwQKSDU+YfVFL3x/LoeYomz/lICLoEEazPXfFPSPiTEAXOjQDdCVod 74Iv052P w1v5sHP58Rw9tcGkgS0p1VvylZ2UROFMxAlpcv2aFnep2yDLPCj0h9VQYayDvs5WJ8qktNpkpfEOSDJ5xMdZE+0UoJuZ526EHxGgWL0akhnoN/3PI6Ar6HXGN5D6fA7CcwNoiZmWF+cwXExT3/1DJ+hTs6OaFDQ914Oa3XAn2+V0sLLTPZlDdWsWd5a0FFYSIpeH3GdkOMrvjc2RTfIPiiJFwl4PbnUbcTKin2Peq2dQ7p+B0qaa2qObsiESDKFcygJmYF0wZP3n3pH8zrchmzW+NhmcPR3JKxMfHGllDIdi9v12t9FQ16DI39tuNi5Lg3giZZd4iYjUe8IgXREcX8ygZJUV3mys0uZY4MKHZaNpTQ5BBeOGBL4ACD62xHjCTHUM7/RYJ1PICi5hkmHrZ/mYaCAlnHUYjHsHJFgRzU1qAQpy0IxYjRraJ2d2R/qYfWvSrKoDeYJgkM43HprvV7VFqKw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.019610, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 06, 2023 at 02:07:16PM +0200, David Hildenbrand wrote: > On 07.09.23 22:24, Guilherme G. Piccoli wrote: > > Currently the kernel provides a symlink to the executable binary, in the > > form of procfs file exe_file (/proc/self/exe_file for example). But what > > happens in interpreted scenarios (like binfmt_misc) is that such link > > always points to the *interpreter*. For cases of Linux binary emulators, > > like FEX [0] for example, it's then necessary to somehow mask that and > > emulate the true binary path. > > I'm absolutely no expert on that, but I'm wondering if, instead of modifying > exe_file and adding an interpreter file, you'd want to leave exe_file alone > and instead provide an easier way to obtain the interpreted file. > > Can you maybe describe why modifying exe_file is desired (about which > consumers are we worrying? ) and what exactly FEX does to handle that (how > does it mask that?). > > So a bit more background on the challenges without this change would be > appreciated. Yeah, it sounds like you're dealing with a process that examines /proc/self/exe_file for itself only to find the binfmt_misc interpreter when it was run via binfmt_misc? What actually breaks? Or rather, why does the process to examine exe_file? I'm just trying to see if there are other solutions here that would avoid creating an ambiguous interface... -- Kees Cook