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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 08B44C433E5 for ; Tue, 28 Jul 2020 17:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC98F2083E for ; Tue, 28 Jul 2020 17:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595956606; bh=FPl2g9z95O/j9qakMr1cGWs3U8+LQVfszTzNisgkf+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=HkUCcOB9usL6t93chlBDsa4KU0HlweX8R+gJyqxhRWhK3iDrp7HHa+jwMwTy7UQCX pkY5fNUDNKx49G7qqtq7aK/nxsR3AjrtDyVNgkqY/f9GRO2BeXJx8PPb6wXtqUsAV9 VpBjNccmXTcHLx9kv5bo683c7I82SiOln7LLREqI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731914AbgG1RQp (ORCPT ); Tue, 28 Jul 2020 13:16:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:37294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731845AbgG1RQp (ORCPT ); Tue, 28 Jul 2020 13:16:45 -0400 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8182D21D95 for ; Tue, 28 Jul 2020 17:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595956604; bh=FPl2g9z95O/j9qakMr1cGWs3U8+LQVfszTzNisgkf+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KPnMEN7iCF/xEO6QsEaxqYO2GzTsDtB7AMcRLK6l/UjK4oIn/F4JOGSXZUvYW44s1 jEFlyTCl3P3MEFUQeNfubHYCCc9zG74UqQBTODvN2LzJ4uy4XxTnjTnNBbEJ2yMVj4 PZjnIsRaELUQ0yXk6Deqthsuj/8xNzoMTptFK1So= Received: by mail-wm1-f46.google.com with SMTP id d190so265418wmd.4 for ; Tue, 28 Jul 2020 10:16:44 -0700 (PDT) X-Gm-Message-State: AOAM530Yv6SlwOXbIC0weDf9w8qTSrLFXTro8w2lLTw0bQ5YjcbYohNo 3YlD4ktFfx0Tum27xkC94CAGUVSksm0WEIhogaJS/g== X-Google-Smtp-Source: ABdhPJwu7N9kRRQbUR+VvYTCTVOAiGMuB+0+ywLntE8sEkStNuXDIJbnbwFAt4moiWmwHpSI57u5zJetZtfyZAKrhS8= X-Received: by 2002:a1c:de86:: with SMTP id v128mr4734767wmg.36.1595956603047; Tue, 28 Jul 2020 10:16:43 -0700 (PDT) MIME-Version: 1.0 References: <20200728131050.24443-1-madvenka@linux.microsoft.com> In-Reply-To: From: Andy Lutomirski Date: Tue, 28 Jul 2020 10:16:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 0/4] [RFC] Implement Trampoline File Descriptor To: "Madhavan T. Venkataraman" Cc: David Laight , "kernel-hardening@lists.openwall.com" , "linux-api@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "linux-integrity@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "oleg@redhat.com" , "x86@kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 9:32 AM Madhavan T. Venkataraman wrote: > > Thanks. See inline.. > > On 7/28/20 10:13 AM, David Laight wrote: > > From: madvenka@linux.microsoft.com > >> Sent: 28 July 2020 14:11 > > ... > >> The kernel creates the trampoline mapping without any permissions. When > >> the trampoline is executed by user code, a page fault happens and the > >> kernel gets control. The kernel recognizes that this is a trampoline > >> invocation. It sets up the user registers based on the specified > >> register context, and/or pushes values on the user stack based on the > >> specified stack context, and sets the user PC to the requested target > >> PC. When the kernel returns, execution continues at the target PC. > >> So, the kernel does the work of the trampoline on behalf of the > >> application. > > Isn't the performance of this going to be horrid? > > It takes about the same amount of time as getpid(). So, it is > one quick trip into the kernel. I expect that applications will > typically not care about this extra overhead as long as > they are able to run. What did you test this on? A page fault on any modern x86_64 system is much, much, much, much slower than a syscall. --Andy 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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A402AC433E0 for ; Tue, 28 Jul 2020 17:18:13 +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 707F520809 for ; Tue, 28 Jul 2020 17:18:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="avBv5/7P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KPnMEN7i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 707F520809 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ha3xD2Q2IBcVtBcUvcgAHZRtHmdPB6+5WDHP5cfpey0=; b=avBv5/7PXo9S7bZRUeMiJRA58 XaDs8WLgBTP+1EVVjifwJUt3URvIQzxXcM5ottd0DvSuZ+kZJyqG22HiksuML0VxausnflWkV/yz2 CdgIk3M0gCZ1XBpHovzeo9CRqmQ/LpgKYDlw43FjccWbDdWBmMWGdjWl7XWgpxx/OBVEXhyfNp0Px b51yaotCVNS+gES5nIqa9Wsqo3Q8PB9CX54Tmxwdl1l3f7FYPCdwMsIMqeIaGW5xBkSTZXd8IY6Yx eUH0jEKTcGR6SSgfrHV8P16pZkoLibLT1qzfGvmAs2U9CZeKLYDlCqrAmsfelGB7Ujh8oq+K7P2BD liEASi+xw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0TDc-0001KH-OQ; Tue, 28 Jul 2020 17:16:48 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0TDZ-0001JR-MT for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2020 17:16:46 +0000 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7918B21775 for ; Tue, 28 Jul 2020 17:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595956604; bh=FPl2g9z95O/j9qakMr1cGWs3U8+LQVfszTzNisgkf+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KPnMEN7iCF/xEO6QsEaxqYO2GzTsDtB7AMcRLK6l/UjK4oIn/F4JOGSXZUvYW44s1 jEFlyTCl3P3MEFUQeNfubHYCCc9zG74UqQBTODvN2LzJ4uy4XxTnjTnNBbEJ2yMVj4 PZjnIsRaELUQ0yXk6Deqthsuj/8xNzoMTptFK1So= Received: by mail-wm1-f44.google.com with SMTP id k8so294279wma.2 for ; Tue, 28 Jul 2020 10:16:44 -0700 (PDT) X-Gm-Message-State: AOAM530hDxMUl1lfUg2PvQ/RlSzLo1RQed4whhmDIj6bvqeeP9K1FJm3 /sBT/hXArIG2L/aRNTaMXtq9XyJAo7j1i2L0XhR/bg== X-Google-Smtp-Source: ABdhPJwu7N9kRRQbUR+VvYTCTVOAiGMuB+0+ywLntE8sEkStNuXDIJbnbwFAt4moiWmwHpSI57u5zJetZtfyZAKrhS8= X-Received: by 2002:a1c:de86:: with SMTP id v128mr4734767wmg.36.1595956603047; Tue, 28 Jul 2020 10:16:43 -0700 (PDT) MIME-Version: 1.0 References: <20200728131050.24443-1-madvenka@linux.microsoft.com> In-Reply-To: From: Andy Lutomirski Date: Tue, 28 Jul 2020 10:16:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 0/4] [RFC] Implement Trampoline File Descriptor To: "Madhavan T. Venkataraman" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200728_131645_838167_114E3F95 X-CRM114-Status: GOOD ( 22.17 ) 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: "kernel-hardening@lists.openwall.com" , "linux-api@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "oleg@redhat.com" , "linux-security-module@vger.kernel.org" , David Laight , "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 Tue, Jul 28, 2020 at 9:32 AM Madhavan T. Venkataraman wrote: > > Thanks. See inline.. > > On 7/28/20 10:13 AM, David Laight wrote: > > From: madvenka@linux.microsoft.com > >> Sent: 28 July 2020 14:11 > > ... > >> The kernel creates the trampoline mapping without any permissions. When > >> the trampoline is executed by user code, a page fault happens and the > >> kernel gets control. The kernel recognizes that this is a trampoline > >> invocation. It sets up the user registers based on the specified > >> register context, and/or pushes values on the user stack based on the > >> specified stack context, and sets the user PC to the requested target > >> PC. When the kernel returns, execution continues at the target PC. > >> So, the kernel does the work of the trampoline on behalf of the > >> application. > > Isn't the performance of this going to be horrid? > > It takes about the same amount of time as getpid(). So, it is > one quick trip into the kernel. I expect that applications will > typically not care about this extra overhead as long as > they are able to run. What did you test this on? A page fault on any modern x86_64 system is much, much, much, much slower than a syscall. --Andy _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 02123C433E8 for ; Tue, 28 Jul 2020 17:17:04 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 5128720809 for ; Tue, 28 Jul 2020 17:17:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KPnMEN7i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5128720809 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-19479-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 3294 invoked by uid 550); 28 Jul 2020 17:16:57 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 3271 invoked from network); 28 Jul 2020 17:16:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595956604; bh=FPl2g9z95O/j9qakMr1cGWs3U8+LQVfszTzNisgkf+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KPnMEN7iCF/xEO6QsEaxqYO2GzTsDtB7AMcRLK6l/UjK4oIn/F4JOGSXZUvYW44s1 jEFlyTCl3P3MEFUQeNfubHYCCc9zG74UqQBTODvN2LzJ4uy4XxTnjTnNBbEJ2yMVj4 PZjnIsRaELUQ0yXk6Deqthsuj/8xNzoMTptFK1So= X-Gm-Message-State: AOAM532q9RZ0bVU+5qIIDfwBroSFE76WttS15JYlWROjs7+ySblERbHL NnT6e1Vw444xwuQ6eVaRjUksVAOK1oxSHKCrM2W3IA== X-Google-Smtp-Source: ABdhPJwu7N9kRRQbUR+VvYTCTVOAiGMuB+0+ywLntE8sEkStNuXDIJbnbwFAt4moiWmwHpSI57u5zJetZtfyZAKrhS8= X-Received: by 2002:a1c:de86:: with SMTP id v128mr4734767wmg.36.1595956603047; Tue, 28 Jul 2020 10:16:43 -0700 (PDT) MIME-Version: 1.0 References: <20200728131050.24443-1-madvenka@linux.microsoft.com> In-Reply-To: From: Andy Lutomirski Date: Tue, 28 Jul 2020 10:16:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 0/4] [RFC] Implement Trampoline File Descriptor To: "Madhavan T. Venkataraman" Cc: David Laight , "kernel-hardening@lists.openwall.com" , "linux-api@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "linux-integrity@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "oleg@redhat.com" , "x86@kernel.org" Content-Type: text/plain; charset="UTF-8" On Tue, Jul 28, 2020 at 9:32 AM Madhavan T. Venkataraman wrote: > > Thanks. See inline.. > > On 7/28/20 10:13 AM, David Laight wrote: > > From: madvenka@linux.microsoft.com > >> Sent: 28 July 2020 14:11 > > ... > >> The kernel creates the trampoline mapping without any permissions. When > >> the trampoline is executed by user code, a page fault happens and the > >> kernel gets control. The kernel recognizes that this is a trampoline > >> invocation. It sets up the user registers based on the specified > >> register context, and/or pushes values on the user stack based on the > >> specified stack context, and sets the user PC to the requested target > >> PC. When the kernel returns, execution continues at the target PC. > >> So, the kernel does the work of the trampoline on behalf of the > >> application. > > Isn't the performance of this going to be horrid? > > It takes about the same amount of time as getpid(). So, it is > one quick trip into the kernel. I expect that applications will > typically not care about this extra overhead as long as > they are able to run. What did you test this on? A page fault on any modern x86_64 system is much, much, much, much slower than a syscall. --Andy