From patchwork Tue Apr 18 08:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 84691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2692774vqo; Tue, 18 Apr 2023 02:03:17 -0700 (PDT) X-Google-Smtp-Source: AKy350Zk1/IV3xwGA+bA7OQBUMdtwSSg2lVOpwseeav+Gf9z2RtsYfiKAtEH28fCJZp7+RVsSOPJ X-Received: by 2002:a17:90a:fe07:b0:247:101b:b532 with SMTP id ck7-20020a17090afe0700b00247101bb532mr1206001pjb.28.1681808596893; Tue, 18 Apr 2023 02:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681808596; cv=none; d=google.com; s=arc-20160816; b=xXva2KRjJo4cyOsuXjKlnrs54Xxo1CY/9AAB6r1isw2uhCJtz4sGp+cayJsEcN+uMd VZSUcOMTlNIl7Tc9zFR9rbDvLK4ybwP3xVi2+8+SG9CIm4WbMdf6r0YaBiXGPcbzHnGp Z03ia4S9QwUerfJMkeOllojbG1FWckAs9r32Ow8QWe/On5aC5dsIai1dnX1xmgzrBUZF AMihPU2jamA0sMpUAonLghqsGulVsNG5/73TXqNic/leXa00805ra7r9Jo5J1p/dsdfJ sPq4kfniMAH+KsSR+NPumci+Iq1LryaGKaySE46srHYnXJWuKWQN7hKcUqHMX1ZUCO5f iShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=rsdIAMAwWopaXTDtOD5aLMYboZIulPn7eG1OGyICisY=; b=GS1SsdZ+LfLDORaFGwGGD8qsRPZUy2Q8irUaiPu0KZHZn6p66KY7BX9zclsj501AHz +2Bw4AdVW0w4+o6PnDjfJt87F8Tou0G8OJArd8sU0kZT3yGmNAHB8ZO8JhjK3XgOB6gx bzCUq0ampsVYO09cgVqPmObSnWAbR7qengls0sr1sSmyyOqQESoYdi4z8hzT9l6dUxiI QVY17IT1Hc0pfUG/vwIat8nk/GaRf8044UHxxFypUY1BJUflChnmIq+YceULhyreh6a6 ITgEoH2AJJSbsKs0kHn9DcxVtdsp3A3uPHJ7ocqz4r37gC6nz25WbUrstpjQTfO3KiCO /vdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xwdwruv5; dkim=neutral (no key) header.i=@linutronix.de header.b=m+YIBgxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp10-20020a17090b4a8a00b002474c0c63ebsi1336823pjb.0.2023.04.18.02.03.04; Tue, 18 Apr 2023 02:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xwdwruv5; dkim=neutral (no key) header.i=@linutronix.de header.b=m+YIBgxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbjDRIrz (ORCPT + 99 others); Tue, 18 Apr 2023 04:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbjDRIrm (ORCPT ); Tue, 18 Apr 2023 04:47:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A4FC40D5; Tue, 18 Apr 2023 01:47:41 -0700 (PDT) Date: Tue, 18 Apr 2023 08:47:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681807659; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rsdIAMAwWopaXTDtOD5aLMYboZIulPn7eG1OGyICisY=; b=xwdwruv5LDE0XdxsJNO3X4Ce8VwNwW1kTbUv8dNRcQs2A74197WoXjAOQuo8rwieyp/gPf sHjYruQ+/DDhqfgZy/68rXJLuPGDOlr1LZgcV9ieBDaGEhrME1nxaeiYND6idsHuudoTXv FWy+ax3/HwHtA+hSQgGI0ZS2pTELCiPyACi20PApvPaZ0+48UzM4PWAK5Y9O6rYRubMjNL 6+ffz0BZzPkQcMizAjz4eKSazv2Ra4zNh3o9OLNZHEZDnHJ8uU+0jERqbEK1mBx7YGnca+ N0i83gU7M1gQlMp5YzGnBN0xSE2FBfr+5rwlgVccH4xCh7N5ba+NN+Wn/fyHCg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681807659; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rsdIAMAwWopaXTDtOD5aLMYboZIulPn7eG1OGyICisY=; b=m+YIBgxL+JFywTivrGbJLJYCDdNBQALYylOekIxGtcI7zzgWtRN3xXkhLnQIoVRwaWrL6S vO2pFvNasplqyNAg== From: "tip-bot2 for Gregory Price" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/entry] syscall_user_dispatch: Split up set_syscall_user_dispatch() Cc: Gregory Price , Thomas Gleixner , Oleg Nesterov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230407171834.3558-2-gregory.price@memverge.com> References: <20230407171834.3558-2-gregory.price@memverge.com> MIME-Version: 1.0 Message-ID: <168180765934.404.13399191864427617953.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763504131133234907?= X-GMAIL-MSGID: =?utf-8?q?1763504131133234907?= The following commit has been merged into the core/entry branch of tip: Commit-ID: 43360686328b1f4b7d9dcc883ee9243ad7c16fae Gitweb: https://git.kernel.org/tip/43360686328b1f4b7d9dcc883ee9243ad7c16fae Author: Gregory Price AuthorDate: Fri, 07 Apr 2023 13:18:31 -04:00 Committer: Thomas Gleixner CommitterDate: Sun, 16 Apr 2023 14:23:07 +02:00 syscall_user_dispatch: Split up set_syscall_user_dispatch() syscall user dispatch configuration is not covered by checkpoint/restore. To prepare for ptrace access to the syscall user dispatch configuration, move the inner working of set_syscall_user_dispatch() into a helper function. Make the helper function task pointer based and let set_syscall_user_dispatch() invoke it with task=current. No functional change. Signed-off-by: Gregory Price Signed-off-by: Thomas Gleixner Reviewed-by: Oleg Nesterov Link: https://lore.kernel.org/r/20230407171834.3558-2-gregory.price@memverge.com --- kernel/entry/syscall_user_dispatch.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/kernel/entry/syscall_user_dispatch.c b/kernel/entry/syscall_user_dispatch.c index 0b6379a..22396b2 100644 --- a/kernel/entry/syscall_user_dispatch.c +++ b/kernel/entry/syscall_user_dispatch.c @@ -68,8 +68,9 @@ bool syscall_user_dispatch(struct pt_regs *regs) return true; } -int set_syscall_user_dispatch(unsigned long mode, unsigned long offset, - unsigned long len, char __user *selector) +static int task_set_syscall_user_dispatch(struct task_struct *task, unsigned long mode, + unsigned long offset, unsigned long len, + char __user *selector) { switch (mode) { case PR_SYS_DISPATCH_OFF: @@ -94,15 +95,21 @@ int set_syscall_user_dispatch(unsigned long mode, unsigned long offset, return -EINVAL; } - current->syscall_dispatch.selector = selector; - current->syscall_dispatch.offset = offset; - current->syscall_dispatch.len = len; - current->syscall_dispatch.on_dispatch = false; + task->syscall_dispatch.selector = selector; + task->syscall_dispatch.offset = offset; + task->syscall_dispatch.len = len; + task->syscall_dispatch.on_dispatch = false; if (mode == PR_SYS_DISPATCH_ON) - set_syscall_work(SYSCALL_USER_DISPATCH); + set_task_syscall_work(task, SYSCALL_USER_DISPATCH); else - clear_syscall_work(SYSCALL_USER_DISPATCH); + clear_task_syscall_work(task, SYSCALL_USER_DISPATCH); return 0; } + +int set_syscall_user_dispatch(unsigned long mode, unsigned long offset, + unsigned long len, char __user *selector) +{ + return task_set_syscall_user_dispatch(current, mode, offset, len, selector); +}