Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp983037pxp; Wed, 16 Mar 2022 23:26:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxDAdSGaqH0hTJppdMxhcaAcbuhTSN44L5IhyJeYM7vFf0XNt0fVWXr1coN913oCmZWfih X-Received: by 2002:a05:6a00:a23:b0:4f6:72a8:20c7 with SMTP id p35-20020a056a000a2300b004f672a820c7mr3205426pfh.12.1647498375490; Wed, 16 Mar 2022 23:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647498375; cv=none; d=google.com; s=arc-20160816; b=QaRdnoopM94ye4+KtEL8dWIaJJmPJIhbMM8gp33GxD6e0e+WfPH1yZ7Yz6HvhbGWdC iyEZQqSaXv/Ya7g9+qb5IvM/qiCR6+hIkD/Km+u37ge+mVyKUlIZIO0BKOgvNl001TYI DTz3RMF5u86fKpOr+JhlOvKw99C2ZJUOdWZ5JwxxClCjh5v/6nDftUsOxls0PrR9233w 8amVe9fW2PoaJEz6GQk00rIQM9pMbOgzamz7Z5+ymKZT7RffyDqMKT6+IOZBbTy6RQAI OV1OSkVBK66qbEOmq7RuJQTF5uqVz0XvduBYZXiY4LjITXRs7BwoF+eFtVPXJYgd1Mw/ UkXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=fVeSclyEZRPDFZD/KfkHxaBdWimOxCBUtm1YfDuHBWI=; b=Zwc2LkOk/Br8Zj0fimY1T64a93AWwvbteEdpxn2v1Q+vVX/3cH2/lsW67H4a49hS+x 3QIvH9dRE8S5Aur6tVmu/qEThQzgf3CMpdwRO2N45MGDiwfy8NZiLQ1WpiNNnWh+Yycq TjIlmO92f8dRCOJTLbi/EeIpuMSHd+BMtz/F1ShYxvsPPkKqtBKDa0Kk1Vo/DqPUPQlz rJKeFNKzFUh+sZndDy8GnH6e3mi0YWUCuB1JVvfY0zUndcRViRCitFe4kxB4koOzBkUa AL56BtK6i5rfiNdp7oR/cI66M/e/emT1RudxStfG1RjU0onZHFiba80ePF7oi/bA0oRe 5D3A== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q19-20020a056a00089300b004e16ac631bbsi4054729pfj.381.2022.03.16.23.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:26:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C13411D8304; Wed, 16 Mar 2022 22:11:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351825AbiCPRG1 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 Mar 2022 13:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232373AbiCPRG0 (ORCPT ); Wed, 16 Mar 2022 13:06:26 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5505446B25 for ; Wed, 16 Mar 2022 10:05:11 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-40-kHM77aNRMluU0HPtzKF3Hw-1; Wed, 16 Mar 2022 17:05:08 +0000 X-MC-Unique: kHM77aNRMluU0HPtzKF3Hw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 16 Mar 2022 17:05:07 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.033; Wed, 16 Mar 2022 17:05:07 +0000 From: David Laight To: 'Kees Cook' , James Jones CC: "bp@alien8.de" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] x86: Remove a.out support Thread-Topic: [PATCH] x86: Remove a.out support Thread-Index: AQHYOVBkiI2rWSVwnUW0pCDz/QTpF6zCOwVw Date: Wed, 16 Mar 2022 17:05:07 +0000 Message-ID: <8e9db4d6ff614006869eaa412a536fa0@AcuMS.aculab.com> References: <4c449fab-8135-5057-7d2c-7b948ce130cc@theinnocuous.com> <0b31b1d3-852d-6cab-82ae-5eecaec05679@theinnocuous.com> <202203151150.1CDB1D8DA@keescook> <202203160909.B1A022B@keescook> In-Reply-To: <202203160909.B1A022B@keescook> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 From: Kees Cook > Sent: 16 March 2022 16:11 > > On Wed, Mar 16, 2022 at 05:06:10AM +0000, James Jones wrote: > > I dug the scripts up in the state they were in when I gave up (September > > 2020 according to mtime), and put them on github in case anyone wants to > > have a go at it: > > > > https://github.com/cubanismo/aout-to-elf/ > > > > It was an interesting problem in its own right, and I'd be curious to > > know what I missed. > > Yeah, this is a good start. I think the main problem is with how program > entry works, specifically that %esp is pointing to argc (with all the > args in memory above there), which isn't the way ELF sets %esp. > > It might be possible to make a userspace loader, though. Hmm. Could it be fixed up by a small bit of code that the elf interpreter runs just before jumping the a.out entry point? Depending on the elf layout it might be enough to just reset %esp. But if the strings are the wrong side of argv[] and enpv[] the vectors themselves might need copying further down the stack. Should be possible to do it as PIC code. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)