Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp473292pxb; Wed, 18 Nov 2020 09:06:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxL7Sma9OuOtSj8bQ6i5wM1rLqXXPMbXx3o1YdDRPNUmUzoAFuharARt0r5A530CjEXHObH X-Received: by 2002:a17:906:6d4:: with SMTP id v20mr26911854ejb.500.1605719193106; Wed, 18 Nov 2020 09:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605719193; cv=none; d=google.com; s=arc-20160816; b=qJ34opC+jC8TSqwwAdfiNmzFow+1QFKdK9sguVV6uZ2jUdWxNFDqJW296kQ3FuscYz 5H3NIOoxmK8PWiUzZel8zWJdzd7RTOR/BB0qnJ9F3PwQRiv0kWrRyo4Juz5nChdf1Cog zNLUHRYtC1DCuOTr2hkJG9xYuuc3oYufK5Sa3hGtq1bbyTHvBeLqRvndDamSvv5tdZis iHkuqHfEvP1VZHwV+9ylewavq3r5nQmXLQmyLwxWhun7RTtc97zuoA6mYGRaXvKOqmAt cqQjz9ydjhzTanVMJNCZ59d0xHPYuXsWgV+YGKK2aDMv1dS1QfdtAvcPdKOrFGC8i0Yn pUaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:organization :subject:cc:to:from; bh=oybbF9JkzmfXSRJwbcoPDlsyBAHJovBWLRMc6OodbSg=; b=iQ97fU0QBleMeZPL4GmT/SpAcEQS9ZQvz2rTeawoN4+rjCH5v6THrUBGhGg9imxN2U +YinR9T7V1nu1q9XURvi/wK1aAzBFMs5uJHkG/33reKA21g6s33fYxulS8IbI86tn8w2 043HuONJ1b5CK0mQkWuIWGbPIBlivAdI6zjhlgBsGt6inz0N1STV2jFTkw/f9kkPEHD9 t4fy5RBLMqb3prTV5M4ZjUEOiBEu4lYmT50156CAGGQ83V8FGBR2kEwFPoxHnTkAUuW+ 4SnDaMURv/DoNfydVwe0AmyhZViVyNXXwdgrlk5xxa8X2rNXXVRjoYXGQ2Esjga70aiW xisw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr4si12473785ejc.486.2020.11.18.09.06.07; Wed, 18 Nov 2020 09:06:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbgKRRCn convert rfc822-to-8bit (ORCPT + 99 others); Wed, 18 Nov 2020 12:02:43 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:36662 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbgKRRCn (ORCPT ); Wed, 18 Nov 2020 12:02:43 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id EA3C41F45211 From: Gabriel Krisman Bertazi To: Florian Weimer Cc: luto@kernel.org, tglx@linutronix.de, keescook@chromium.org, christian.brauner@ubuntu.com, peterz@infradead.org, willy@infradead.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org, gofmanp@gmail.com, kernel@collabora.com Subject: Re: [PATCH v7 7/7] docs: Document Syscall User Dispatch Organization: Collabora References: <20201118032840.3429268-1-krisman@collabora.com> <20201118032840.3429268-8-krisman@collabora.com> <875z63yrrq.fsf@mid.deneb.enyo.de> Date: Wed, 18 Nov 2020 12:02:36 -0500 In-Reply-To: <875z63yrrq.fsf@mid.deneb.enyo.de> (Florian Weimer's message of "Wed, 18 Nov 2020 09:48:41 +0100") Message-ID: <877dqivbrn.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Florian Weimer writes: > * Gabriel Krisman Bertazi: > >> +Interface >> +--------- >> + >> +A process can setup this mechanism on supported kernels >> +CONFIG_SYSCALL_USER_DISPATCH) by executing the following prctl: >> + >> + prctl(PR_SET_SYSCALL_USER_DISPATCH, , , , [selector]) >> + >> + is either PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF, to enable and >> +disable the mechanism globally for that thread. When >> +PR_SYS_DISPATCH_OFF is used, the other fields must be zero. >> + >> + and delimit a closed memory region interval >> +from which syscalls are always executed directly, regardless of the >> +userspace selector. This provides a fast path for the C library, which >> +includes the most common syscall dispatchers in the native code >> +applications, and also provides a way for the signal handler to return >> +without triggering a nested SIGSYS on (rt_)sigreturn. Users of this >> +interface should make sure that at least the signal trampoline code is >> +included in this region. In addition, for syscalls that implement the >> +trampoline code on the vDSO, that trampoline is never intercepted. >> + >> +[selector] is a pointer to a char-sized region in the process memory >> +region, that provides a quick way to enable disable syscall redirection >> +thread-wide, without the need to invoke the kernel directly. selector >> +can be set to PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF. Any other >> +value should terminate the program with a SIGSYS. > > Is this a process property or a task/thread property? The last > paragraph says “thread-wide”, but the first paragraph says “process”. It is per-thread, as it doesn't survive across clone/fork syscalls. I will fix the first paragraph of this text. -- Gabriel Krisman Bertazi