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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF32AC4363D for ; Wed, 23 Sep 2020 23:54:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FB822063A for ; Wed, 23 Sep 2020 23:54:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C6tuuIRt"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="XU8UVx4l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FB822063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C2wpxtdXHJWImDIPgCSQ+8+3zI0gd0/hX6Lm4Wgw7mg=; b=C6tuuIRtXvHM3ZJI2XSryNHV3 lYBu919keilMOh/8TvP6X33fUbrDJ9xCEgWd6put+GWCf0sqQh8W5LXjdzcrKFjCobC1T59SsgKm6 LfcWZI43ihK43LeYxSR7KDlh2lYyjxa/6s+PdxWCLjfxBwu8YFItVgeWWWVKfwOrqp9AoNDeC9AFj n6g9gdC/JZ7wO+Rv3OZugRJYFcCjkfBSGdG6+D5ttFoyJSewPWdJ6lnpmkQnI5A/QnYzqCJvuqyk2 YbWUXIvh/amwUcgiOgAL4BUZztQLkSmZZfO+c+baHxORlxsYDfsKAPivqpjM+UDH+fS5k7gWWnkZN 2gnFxHw4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLEZi-0000uZ-FN; Wed, 23 Sep 2020 23:53:26 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLEZf-0000ta-Md for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 23:53:24 +0000 Received: from [192.168.254.38] (unknown [47.187.206.220]) by linux.microsoft.com (Postfix) with ESMTPSA id 035D320B7179; Wed, 23 Sep 2020 16:53:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 035D320B7179 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1600905202; bh=stfW7VJ9ixikhAwpOM4Y5v+Co/aY6HnPcRI9MXRFn5o=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=XU8UVx4l9QT/FMwo8coMBjnSlLBVk+KBoR6KrO3k/zZ6+mnhEd9ikKjXqtLLVZvX8 6L4k3p2sXtnrt7iHN48ZKcWMojIdvdW6wCunGopAI4Vm339QmzKeUGR7hpZh3q8OSK MOlqBqWNABhGiq2M7DKxely5hf7eFnDLY3+f4pu8= Subject: Re: [PATCH v2 0/4] [RFC] Implement Trampoline File Descriptor To: Florian Weimer , Solar Designer References: <20200922215326.4603-1-madvenka@linux.microsoft.com> <20200923081426.GA30279@amd> <20200923091456.GA6177@openwall.com> <87wo0ko8v0.fsf@oldenburg2.str.redhat.com> From: "Madhavan T. Venkataraman" Message-ID: <1a7c9989-fb98-20f7-c0d9-2261aa50d967@linux.microsoft.com> Date: Wed, 23 Sep 2020 18:53:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87wo0ko8v0.fsf@oldenburg2.str.redhat.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_195323_850802_8A7B269D X-CRM114-Status: GOOD ( 25.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Rich Felker , luto@kernel.org, kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, oleg@redhat.com, mic@digikod.net, linux-security-module@vger.kernel.org, David.Laight@ACULAB.COM, Pavel Machek , linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/23/20 9:39 AM, Florian Weimer wrote: > * Solar Designer: > >> While I share my opinion here, I don't mean that to block Madhavan's >> work. I'd rather defer to people more knowledgeable in current userland >> and ABI issues/limitations and plans on dealing with those, especially >> to Florian Weimer. I haven't seen Florian say anything specific for or >> against Madhavan's proposal, and I'd like to. (Have I missed that?) > > There was a previous discussion, where I provided feedback (not much > different from the feedback here, given that the mechanism is mostly the > same). > > I think it's unnecessary for the libffi use case. Precompiled code can > be loaded from disk because the libffi trampolines are so regular. On > most architectures, it's not even the code that's patched, but some of > the data driving it, which happens to be located on the same page due to > a libffi quirk. > > The libffi use case is a bit strange anyway: its trampolines are > type-generic, and the per-call adjustment is data-driven. This means > that once you have libffi in the process, you have a generic > data-to-function-call mechanism available that can be abused (it's even > fully CET compatible in recent versions). And then you need to look at > the processes that use libffi. A lot of them contain bytecode > interpreters, and those enable data-driven arbitrary code execution as > well. I know that there are efforts under way to harden Python, but > it's going to be tough to get to the point where things are still > difficult for an attacker once they have the ability to make mprotect > calls. > > It was pointed out to me that libffi is doing things wrong, and the > trampolines should not be type-generic, but generated so that they match > the function being called. That is, the marshal/unmarshal code would be > open-coded in the trampoline, rather than using some generic mechanism > plus run-time dispatch on data tables describing the function type. > That is a very different design (and typically used by compilers (JIT or > not JIT) to implement native calls). Mapping some code page with a > repeating pattern would no longer work to defeat anti-JIT measures > because it's closer to real JIT. I don't know if kernel support could > make sense in this context, but it would be a completely different > patch. > > Thanks, > Florian > Hi Florian, I am making myself familiar with anti-JIT measures before I can respond to this comment. Bear with me. I will also respond to the above libffi comment. Madhavan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel