Received: by 10.213.65.68 with SMTP id h4csp81788imn; Thu, 15 Mar 2018 17:50:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELusJ37IVhwmCWEHkvk87RdmSozRHiTwbex2xlyZC98UWnxtx/iuYWovqtGnugK33aRijKz1 X-Received: by 2002:a17:902:52c7:: with SMTP id a65-v6mr1875007pli.249.1521161414338; Thu, 15 Mar 2018 17:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521161414; cv=none; d=google.com; s=arc-20160816; b=DX+y4sGs353hjHDpiWPdmUV26vLAFMCouR0hy/IIG6o6k9Bxo2frlrrE/KSaPURF8t tuObZEYcYhOW7KoSYUMI1qK7aDSFPXXPj8H/y3wB8aZ4yTtGj/1CIWKqyeVJC4uBFQKq L7BUBWfbU9JSWw8ByYtTpbkJI2kWKb3PXNvHqaFIzRT2Y+cJ2yA338jIyv/aU1oFnnY4 0dkBQTEzyPJJEMrsDTsy+njF7g3pNwwe0oet5qrmcfiiZXu68VkFjacsOjQqOXubmQx2 2/bv/Wo/sFJQk7pTMW3rN3Q9wqKub+KJ+7TO2VDY8hIFrYZdQe3KkygC07DSw2rx2MmH YFDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=EPRPqzbRbJVh/87cEesjpGbaSVjnZ3I7oNx1QY5/XGc=; b=RYatgNkhtnfvkM9hU7LbMqgAgbOZ6eWbAGitMc/P/zLTYh+1UBUAeHArScH1TyowE6 R1RQFre7UT+yrD8yh4j+Mu8AFMXRw2Exy1BfXWKcji+GKUUicMt1bSkjhXetlk3F/fyX G02WCPj1DcE0HUf/WZiv1J6mq2jnzKlcU/LCzARb5lqGII5b5ARYbrOc4Y6w8/OCCFla RUYHhvM7ycYdwOvI7sItWyKP43pWrFbOvyTBmPD9ZaxczesLmWidaOM3NA0eZN5eeZXg a+0Vfqw2VOpFTSv1umYPRjiJ733ScMTqU6MHapxlKNmIUYBtiAjdTkhUc9JiyDxLl199 Y6FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59-v6si4939699plf.596.2018.03.15.17.50.00; Thu, 15 Mar 2018 17:50:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976AbeCPAii (ORCPT + 99 others); Thu, 15 Mar 2018 20:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:35480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbeCPAih (ORCPT ); Thu, 15 Mar 2018 20:38:37 -0400 Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (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 E863C21777 for ; Fri, 16 Mar 2018 00:38:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E863C21777 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-io0-f172.google.com with SMTP id u84so10702491iod.9 for ; Thu, 15 Mar 2018 17:38:36 -0700 (PDT) X-Gm-Message-State: AElRT7F6YrsdU5Rzd0wlhrJ3aFSHZ6mF0/vk3rzgPiFifmJH32sk1QJM hyQWGmc8ikKjgTAgHvJas909w6n0oEz3+QAH9ybH0w== X-Received: by 10.107.20.131 with SMTP id 125mr11553767iou.239.1521160716373; Thu, 15 Mar 2018 17:38:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.137.101 with HTTP; Thu, 15 Mar 2018 17:38:15 -0700 (PDT) In-Reply-To: References: <20180315190529.20943-1-linux@dominikbrodowski.net> From: Andy Lutomirski Date: Fri, 16 Mar 2018 00:38:15 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 00/36] remove in-kernel syscall invocations (part 1) To: Arnd Bergmann Cc: Dominik Brodowski , Linux Kernel Mailing List , Linus Torvalds , Al Viro , Andy Lutomirski , Ingo Molnar , Andrew Morton 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 Thu, Mar 15, 2018 at 9:02 PM, Arnd Bergmann wrote: > On Thu, Mar 15, 2018 at 8:04 PM, Dominik Brodowski > wrote: >> Here is a re-spin of the first set of patches which reduce the number of >> syscall invocations from within the kernel; the RFC may be found at >> >> The rationale for this change is described in patch 1 as follows: >> >> The syscall entry points to the kernel defined by SYSCALL_DEFINEx() >> and COMPAT_SYSCALL_DEFINEx() should only be called from userspace >> through kernel entry points, but not from the kernel itself. This >> will allow cleanups and optimizations to the entry paths *and* to >> the parts of the kernel code which currently need to pretend to be >> userspace in order to make use of syscalls. >> >> The whole series can be found at >> >> https://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux.git syscalls-next >> >> and will be submitted for merging for the v4.17-rc1 cycle, probably together >> with another batch of related patches I hope to send out tomorrow as a RFC. > > Nice work! > > I've already commented on a few patches that now have a kernel-internal > helper function that takes a __user pointer. I think those are all only used > in the early boot code (initramfs etc) that runs before we set_fs() to the > user address space, but it also causes warnings with sparse. If we > can change all of them to take kernel pointers, that would let us avoid > the sparse warnings and start running with a normal user address space > view. Unfortunately, some of the syscall seem to be harder to change to > that than others, so not sure if it's worth the effort. It would be fantastic to get rid of set_fs() entirely and make it impossible for get_user(), etc to ever access kernel memory. And this effort is necessary to ever achieve that. I don't think this patch series should wait for any of these cleanups, though. We need these patches to change the x86_64 internal syscall function signature, which we've been wanting to do for a little while.