Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3449224pxb; Mon, 4 Apr 2022 17:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzorXNAQkUZc2NriKHz05XoJ2R7JaO/kpJCppUGRZwfxdedR6mg6Xzg2u1nxG+9CoPgjp5j X-Received: by 2002:a05:6a00:2124:b0:4fa:739f:2386 with SMTP id n4-20020a056a00212400b004fa739f2386mr912943pfj.68.1649117985847; Mon, 04 Apr 2022 17:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117985; cv=none; d=google.com; s=arc-20160816; b=U+JOOL3HadkoM5+itVQWSVi4eEaA9FFNVL32yO8uASBFLDbJ+FanB98ws/Bh+e12L7 ZCsiT0fDmxUp4ZGBfRjt+gxnPhpL6rTfzEicuv/8+2BSX+/9U+tf+Vp/baqofGn7TSHo 99mFAA8Url4TKWLVMuzd1imoQWLqp3hxfeGGr3JL8f/NZJhHr3FtaJ2uP3nYQfYRAsIA 4wyNCboY2VyJXq35WCV1hy+vbODHngq2h1L7abk4AfUPZBVYoY1G4MnID+Ssx3qUWd3j bZbL0CzF0tmnBD7UpVKRwk98WuC8/ktzgdZWb6uquNaK+wRA38BvUhKQ/sTbBVG/rbV6 V4sA== 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=Uc2JgILBBIGGteHeEA8udkgkI4ku5XbZtnJzvUa5oOs=; b=0Eld3gAq5U7og9PoPUwFkSdpnwlXIaeWuywY7TKXorxkVPBT+z8UyY0SpTXwANOEFL 6M6FbS5HNP5mGaH9CDlbENZSIbiBX/Xt2DnXHki6Fl9/xNOhKKNx/gjk1zH6hiHKDk3w n8emudhJ3VAQc4YIMJ3SiV/7Yap4t5h1VKAkNALr38oJaVAknpPgxTKgyctx87d7Fur3 UljiGCUqgkvXegQuwqjb0QwQEVG/yyIMmn3/yiNRFY2Hi/qIVLN9rXf6+aXuAm0GWFLR y1ADw9vtLPefQN99Zg0hJzCPnVE4K4CkDemjXOVeMRcCTqNRCdPid44W1IhbYDxJgBT/ rHxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hEyBhz6c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k18-20020a170902c41200b00153b2d165f6si11478030plk.510.2022.04.04.17.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hEyBhz6c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5BF2670F6B; Mon, 4 Apr 2022 16:46:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382280AbiDDVvE (ORCPT + 99 others); Mon, 4 Apr 2022 17:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379901AbiDDSUl (ORCPT ); Mon, 4 Apr 2022 14:20:41 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05257DF21 for ; Mon, 4 Apr 2022 11:18:44 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id m12-20020a17090b068c00b001cabe30a98dso71193pjz.4 for ; Mon, 04 Apr 2022 11:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Uc2JgILBBIGGteHeEA8udkgkI4ku5XbZtnJzvUa5oOs=; b=hEyBhz6cZxnXixT/I4n2Ix076X/e8T2cj1dSgutpj5j72hGPyV/MyRuKFnYbOKDNoh lR0sNobji3iDxqHkl8NPVbzkHFEsYVMPZNBfx6YikEIHqOh4l5+SFdwAIt4WCnkPuJPV /oaWeDOV9OJAOzVrfnvEbOp0mrES0RlO1R8hY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Uc2JgILBBIGGteHeEA8udkgkI4ku5XbZtnJzvUa5oOs=; b=imrEh25E646JNGqIf+BOzHUdP0lzerOwoDkHurGcwb3lAYo/JbcpD/AMvyrb0rP3cz eUkfJhsbfZnAqFCgXvszfrUokirICMs1DULNXdUs3mudbJ1/dNVCzPuJDuHjjMG8URhD iN4k/B/M/eyZTuZQqe2gZW0F6qX95H4uCJhb+svc/4VNYgCTYCKCeRDxgkspZUYMWZNY oH5QeReC3K1AjFBzQWMDumagw9hgYeAfdb0j/UcV2PoEQhqfBU2iT1IP0MpgcAOGNHeM NJ9WBmWC0qwXkmJhKX83cqmElQgZd4zDn2dvhiBRUIhJGCzlkyLXRTmqb2Un+NvSLFem F+yA== X-Gm-Message-State: AOAM530SsHkM+EEZjIwZ5u7TjExkzebeovZvR6uGGHNVcwIjUSagOd0D W49HJB4lzVHewKJLIRU0T7n5SQ== X-Received: by 2002:a17:90a:a78c:b0:1b8:b769:62d0 with SMTP id f12-20020a17090aa78c00b001b8b76962d0mr443076pjq.227.1649096323485; Mon, 04 Apr 2022 11:18:43 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k20-20020aa788d4000000b004fb07f819c1sm12863944pff.50.2022.04.04.11.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 11:18:43 -0700 (PDT) Date: Mon, 4 Apr 2022 11:18:42 -0700 From: Kees Cook To: David Laight Cc: "'Maciej W. Rozycki'" , James Jones , "bp@alien8.de" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] x86: Remove a.out support Message-ID: <202204041117.0CD04EB@keescook> References: <4c449fab-8135-5057-7d2c-7b948ce130cc@theinnocuous.com> <0b31b1d3-852d-6cab-82ae-5eecaec05679@theinnocuous.com> <202203151150.1CDB1D8DA@keescook> <67CF27C5-5013-4EF4-B24C-8D9EB52536FB@chromium.org> <08c095230941445f9139ab89bc70da43@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <08c095230941445f9139ab89bc70da43@AcuMS.aculab.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2022 at 05:07:11PM +0000, David Laight wrote: > From: Maciej W. Rozycki > > Sent: 04 April 2022 12:04 > > > > On Sat, 2 Apr 2022, Kees Cook wrote: > > > > > > Chiming in late as I'm scanning outstanding mailing list traffic: if this > > > >is as you say all statically linked stuff, then converting from a.out to > > > >ELF might be as easy as: > > > > > > > >$ objcopy -I a.out-i386-linux -O elf32-i386 a.out-binary elf-binary > > > > > > Based on my research (and the wrapper I ended up writing), I don't think > > > this is sufficient because entry point handling is different between ELF > > > and a.out (specifically the stack layout and initial sp register value). > > > > Fair enough. I guess the exact value of %esp doesn't matter that much > > (why would it?), but the arguments and environment may well be structured > > differently (and indeed based on a glance over binfmt_aout.c there's extra > > indirection involved compared to the ELF i386 psABI). > > You could write a custom 'elf interpreter'. > Hacking at those isn't for the faint-hearted :-) A thread on LWN pointed to: https://github.com/siegfriedpammer/run-aout which appears to be a much more complete a.out wrapper. -- Kees Cook