Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp192891rwl; Thu, 30 Mar 2023 14:24:03 -0700 (PDT) X-Google-Smtp-Source: AKy350aPddDwpmZkV3LYyR3C1vweEMoztmbHZK3mKqHq06jIJ9xSKzhiWin4wS7AtBh3thZp9xcU X-Received: by 2002:a05:6a20:3d91:b0:e3:e236:bbcb with SMTP id s17-20020a056a203d9100b000e3e236bbcbmr4287729pzi.0.1680211443303; Thu, 30 Mar 2023 14:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680211443; cv=none; d=google.com; s=arc-20160816; b=LGGGBk6Stw/BIGyInziIUOdyZ6sTdMMtmbatxIpG0wgTu7TfINMAlFraLkvO9PfS8u r4Rth7fI1VCyGhCTelzUjOGuMTgOmEeqCPukdmjGeaKiog2Gc2z/hpFjQZEDuVlGouCW Of2pzOoBOdov4C480TXjBbLq4+sre8A1pTSRCrICiQfdrSdY1qvb+nl5N7SFrBSPGZuL gin/vS8inYtPLCUFrPx1MIwpD7OMVPt2FAJrzpZmJnSR/qKnEa/hT5kwOZ2IGBRIuxt2 6Kin3te0NwYADSxL+iDEn6/qwWuf1iAtRmq28XyZZNP5U/x6IaGSDC7S7zlXGY/Qi2PK fgaQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sLteJQ8c+SN8oNJjCjxoIRPKFzLnI8skpOxBYxbnER4=; b=u2xtVMtoWv+XRXnfD5zBSHo8khJia1nvR59YIBIFSRpVGvZr6gYhH0dR0XzpWy8JqG MJwYMpCpxkgVXxB3uh/L17JOjjoMioPZdP1iKI4GJzGvniN5PKb7Efe+0aADRl61J/Bc ZcCgigZZa4fzPSMQyaDB39EEx6eVAeJCQfucyKwc8xyl5Yy2ChR7/+lX7HfBRtvynyrm vYZK90iO7LM4zl2jqVtHOkqD1yZbFFRkoWwlAjKfAvrq6YYH5HLfXD9nuaBcLJy/f1Wa 9hh0djQRPRCT0U8uFa19QvyTDvkysI9VWcgJ44Q/c6mWjg4RwmWf3+ZrPOOXTABF4Mu6 t5+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iykmzulI; 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=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 145-20020a621997000000b005a8b3c6b5besi647422pfz.254.2023.03.30.14.23.51; Thu, 30 Mar 2023 14:24:03 -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=@gmail.com header.s=20210112 header.b=iykmzulI; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbjC3VVt (ORCPT + 99 others); Thu, 30 Mar 2023 17:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjC3VVs (ORCPT ); Thu, 30 Mar 2023 17:21:48 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE29DEB61; Thu, 30 Mar 2023 14:21:46 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id m16so15064614qvi.12; Thu, 30 Mar 2023 14:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680211305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sLteJQ8c+SN8oNJjCjxoIRPKFzLnI8skpOxBYxbnER4=; b=iykmzulIMbse0iCb3oP8M4I/k54cZgd34u2hhDsdW2/bHFIPIukaDmopN8U07+Q0iY N3Cu42LC+E10+Etfpht1AeFG/lsgrl2llBs5fCQOTn4M0nDnNj8OH7F9RZGArwq6Ffx6 wz+AqODSEQyod9lMrwR6EEXysh+NAETu/KXdPurGS+2Cv6ALsO5YrXHUwXJlrIUk8n2v r+CoYCOYOtcL/y0QEV6iHW/v1XkqO9gyjaMDiOLCWwnLINKSLvry+5abktd1VLCv+eAW b8bsejZm0R58OqQkNFa+Ve21cvqQeDFt7pS6Bo7Ae0yc2CoIOhcdHcoFk4ASugCAQ8Iu kg+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680211305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sLteJQ8c+SN8oNJjCjxoIRPKFzLnI8skpOxBYxbnER4=; b=EAfPdlERkoDOOvLs/Bo2icgymcuTqazagW5K1TkKBbLC/VT5Z8ZPF8GHa1BENUTENF st8oky81nMHvtnE+Vb2uUXTnVWMaJtzURxP8b4Ib1Wfzao8wULPVpSVDIq3lK/3Y8fku SPZ5qn7ORHIySM3/Kj6m6A24tUy9Ihvz64NfA1crWpWVk6d4ClEH4tWEe7fqw13JRM0H mxhJfJm6pBfK6EZnyvfp0weoL8H++UMFT96UkfkFQz88cdujq2v5Ve2Ub9C399NR5gZy 1UfPokWPg15K2nY+hx5pwi7gLmZQVq4QONSN7ddGzYklCt1ftQHymSOH+RUlYNEde8md sVIA== X-Gm-Message-State: AAQBX9dP/c3yzYzw0p7IloyDYN8XrimIoQ2VjmhkljOCq58NT8RGzGFW CwMIKzn7Z5zpVW8ITZll0cyYW2+TdK1Txfo= X-Received: by 2002:a05:6214:509b:b0:5df:4d41:954d with SMTP id kk27-20020a056214509b00b005df4d41954dmr12791662qvb.3.1680211305691; Thu, 30 Mar 2023 14:21:45 -0700 (PDT) Received: from fedora.mshome.net (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id mx5-20020a0562142e0500b005dd8b9345desm110761qvb.118.2023.03.30.14.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 14:21:45 -0700 (PDT) From: Gregory Price X-Google-Original-From: Gregory Price To: linux-kernel@vger.kernel.org Cc: linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, oleg@redhat.com, avagin@gmail.com, peterz@infradead.org, luto@kernel.org, krisman@collabora.com, tglx@linutronix.de, corbet@lwn.net, shuah@kernel.org, catalin.marinas@arm.com, arnd@arndb.de, Gregory Price Subject: [PATCH v15 1/4] syscall_user_dispatch: helper function to operate on given task Date: Thu, 30 Mar 2023 17:21:20 -0400 Message-Id: <20230330212121.1688-2-gregory.price@memverge.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230330212121.1688-1-gregory.price@memverge.com> References: <20230330212121.1688-1-gregory.price@memverge.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Preparatory patch ahead of set/get interfaces which will allow a ptrace to get/set the syscall user dispatch configuration of a task. This will simplify the set interface and consolidates error paths. Signed-off-by: Gregory Price Reviewed-by: Oleg Nesterov --- 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 0b6379adff6b..22396b234854 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); +} -- 2.39.1