Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2045784rdb; Mon, 9 Oct 2023 10:37:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6tSf8R6RhwaW1wrBWd1AkX79pAGJd6crsf3tkZjUctBkq21bWtVpesC3BVc2LdRniOLV3 X-Received: by 2002:a05:6a21:1f05:b0:15d:6ea0:82da with SMTP id ry5-20020a056a211f0500b0015d6ea082damr13905734pzb.33.1696873064208; Mon, 09 Oct 2023 10:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696873064; cv=none; d=google.com; s=arc-20160816; b=zmGEF4N0qQHMwNhFh1onEB3Umue9o3NmEVRVUJ1PliLzxdCvcTFvUbmgImfWISR5UY jw4SmRd8XXKobUu1RUwwPFC+aoogaed3xHM5Qjb/1W4OYGhCIuCFfUbdw3QGkdzsp60+ W+d6UBduG63OHucDntvn7FHBl4Cc+eEvYr6ea7zuyk+JbwvFWp4PSLWihVT9rKy2BRl3 Bb4uL+EvFbKgmCc+FH6GeHD2bMH88M2gcPLnLLQMUHbi7QVvx88Ku1w4RrJUqAMFXGnF 4/YOrfV9Jj2cJ0MleUsIwQ5byZSIbhXGb4k3PFkn8e19rDdUj1BUkE2pa+8Nhk9Qz4CB XQKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zd3O1eB/Wpq6g0qSptggykfHJXEZdAtkErQAM+wkdIU=; fh=K9StirN16RKtnAZN+epiGAJ+c17sRIGzHKPmnFezlmE=; b=Pvp41vyTV1acxMTyboJANeRTzjA24uJWgC1VsmJUwQ1B8D3/Ts3Ab7U9CsAq0+tspv xgvR2UOgzLH345mB/dWl3PCmwcdg7AD9PAYLyRUPAUOSawvQDv6OdpCMKY/cjJmCCiS5 G1qVO2y/sbUqGEROPi17nMQLTFlAZITUFKRQzRwCtVkQMu7r3+l3BSt3T7czevtL5IV+ 0IBIjBZ77Nn4FB1P5vmKCtNx/cSoDJWSsXcrJoMb/FOMAy4FXPfkLNqGioK+DRZ21JaC h+h8fR3lnUqp3R39uprf+wVc+IPunqTxuahQFcxoroVGlrr1KwgA/BemyAxcrl4nMqQ/ qq0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=anlnOJEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d124-20020a633682000000b0058d7a9f9b15si5076003pga.641.2023.10.09.10.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=anlnOJEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0C767803BA88; Mon, 9 Oct 2023 10:37:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377432AbjJIRhS (ORCPT + 99 others); Mon, 9 Oct 2023 13:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbjJIRhR (ORCPT ); Mon, 9 Oct 2023 13:37:17 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D47A3 for ; Mon, 9 Oct 2023 10:37:15 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3ae5ce4a4ceso3478540b6e.1 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=vger.kernel.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=anlnOJEI8gxsbsxEVxg1Mpy3Vub2+WKe/ddw7GMm+yldNcDIpUVHhWgrSKhmpNAEs6 2pDtcDrhX/a7/AUEJsPh8xSeuMf8twxh0kD5AljLOQEqjXt7vhZlnKyestyRBxMDgD9/ 6H+CbSm1VePOBvTAPYF7JYyoAtXprFPbxWYOg= 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=XLimRI7yQvQlP1gjvwi0/MBMAmr/DAxWvXMlNqXbfXBkLnASPvA3kqpOeac1A6xkxB Rddoml7cvXmvaP0v1Px5UpXIN92hasVr0lOK0RZJHEaOzPmQUhv3p0ZTL1QCsBQDpwKN +LPJ2azpVwtDlOVUyoYKzG66GAQ8qkqqBu3zQsUjWsLJ2n5YkV55ucrTlpKMH+fbsGiK WjmP66Shd3D5r+mUWMT3rjngUbmwpEE24gA8UmpoNKPNr3zRJyM51S4mJSCjKGg9hNwa uQXxshZoUrhLUb/q/nP2nvR4nc9RrFZyNzg9naYVx9D394uB0vU+vUraXoY+TtUawoqK fkFQ== X-Gm-Message-State: AOJu0YyrG1PPxW+asQnETWJK4UF9NoJREsI6AV42+s/2CpeVE4xRhY+w s2p4REYUBsRKSTO2Gz8HAMoV8A== 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-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:37:42 -0700 (PDT) X-Spam-Level: ** 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