From patchwork Thu Jan 6 10:41:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 530345 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp1063641imp; Thu, 6 Jan 2022 02:49:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxODdY95AWykbXdvagzHHYL7keYgb99AYacNc5BfGtO0lDYdOspYcP6obszqrLJh+Awf/eb X-Received: by 2002:a25:2543:: with SMTP id l64mr59153069ybl.4.1641466172506; Thu, 06 Jan 2022 02:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641466172; cv=none; d=google.com; s=arc-20160816; b=Zc8wVAuukZobxosrOY7IbATJ1En+Y5Am2hlz4o4+cy5HTuV06/7D/sFRD/p3UMtd3T puIZ0EPsRUeYHCAdw5iov8EcTeM5wDwPH1pBbs+F6u1QWVu57u0ebtYsjIr9J3NIRjwX o7euYUcp6wsk46zcW5Rj7Pf4GyjEifclPr6LAqeTzzIj9CNUa/KyjkQC93yrc6q5/eqQ a1ZOeISW2bvm+g8jZIPK/1aKDNRt53vqenrYLQDRD1/+3AeOU3zzwh2/Y78OFmyoUNWR bmkavt0Y7uqx2n78OuoRTzSS4kWDdEtKFebv5qNwDBOioFsZKxuK+NOmz60mH1wBbL/D +qnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=GApDC1N8c1BGUmV12Srd9lwt2mic5QW4KHLkpQG7TPo=; b=k2T5IPgxk4hc1R8e1A3FMasDQAXEZ5OLa9PN0JIBpoV4Xo2SXZItaOEmE+NyDj6Yv9 toHm4Jb+MR3V6eC8d74u71FCx8ravvbWjTDpacxTrCm1LiDnFQX6vUBzlMxAH88sOJCc SPTWX2djK9Elt9xEufD40h7AWn0LcS6ZTIZPg+GhuFvO41bHr5QmX2H2g8REMVq4LIcB PkVm1xraxs4ZvWK2FZze3LmJ0tzjz//vQ6NfHeXqRKeuXdDijZaYsK1tfKZ4i5BLzOdH PK8ret31sVDYxnTM4lNWsHCQZEOx4TxTkbLwOIcGIhpo5AMf9AnaIX3cPzVN4J8scaN9 M3hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q11si1760727ybu.314.2022.01.06.02.49.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Jan 2022 02:49:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:60888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5QKp-0008EP-Uu for patch@linaro.org; Thu, 06 Jan 2022 05:49:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5QDZ-0007ng-GK for qemu-devel@nongnu.org; Thu, 06 Jan 2022 05:42:01 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:59497) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5QDS-0004k4-99 for qemu-devel@nongnu.org; Thu, 06 Jan 2022 05:42:01 -0500 Received: from quad ([82.142.12.178]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MFsdD-1nAhOx3J0B-00HM7h; Thu, 06 Jan 2022 11:41:44 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 08/27] linux-user: Disable more prctl subcodes Date: Thu, 6 Jan 2022 11:41:18 +0100 Message-Id: <20220106104137.732883-9-laurent@vivier.eu> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220106104137.732883-1-laurent@vivier.eu> References: <20220106104137.732883-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:exBT1H1rszwPC8FJI7xe18/8Sp8Ud31mxEMUrECmJ9fB3wCQ71j vvocxS9CmbansrTdY0gBkhLYEe7jHO08uQSeMVQJFjoFRNcKk1q4LiOKFvPoAhsNNaWqhnL xOxAbZ4Zb+DoFoCplTCXvToJpKnCrkB/eKRGPIoZACSPp8kzwud1odI+XCr/ThHtbspG7kU cU8TPj2Eyf6S+412vZ+Pw== X-UI-Out-Filterresults: notjunk:1;V03:K0:AuFtkTdDAo8=:4E1TezFD/uBa4nyFpEbkPA DoBOuHT03Xv+Fp7ObpnYGLd9za+AkkULRWILmwEeYFQkKeTO8uX8BNd4MJZ92k9cn0YHF984S gNpZKIpDCRdsR/IOyaJkBzRj4qlDoqKPW87u74zyVljGZHUjDyqMA6vAy3VHYp6J0v26iptFF ZBeanFLWRcfPqeAbi0Y9tTzoy/w36vB1bSKkG9vGWYW/+koBJEcRQ4enpTYIcDq+j5bovUdND e6FAlN1UCt6QJ+CcA6Ib80KsEtmn/nljAKmEk5nYUAgf1uRrV2G+Poer005b6YcBgYFwziAqT Y5y5AWfLq2InBylh0VyHJ0r27TsCkQa/ezMlqL0uOE8LavMGSTtbM2a4DUtbe3/K1rQCgOS5w /0uOWE7h6YHIgfcXKNl3YdW3TRXsgojCwb358/yli/ENo0Pu9IsYdg8Kh0LnLL/FgaB5DP2Xr KiqZ3EKwMaxrYjuk9rN9tJdiKwAJ4seZe0M+pVySdyObq8OyzItDokoZR357oznbB04UmSYgu O3O9DZbQ88m4Nc1r806tj2WQfEhKIMehN9GrH/nj15UKmSOPeiVjxWIninqUi37OliWVT9V6a TxXuQ2W4ilfrY2Oxsekxmeb/nilkGyahQk32cgCjB2kwIkrVwbZBYTTiNVJfYdJhY0wVGPg4t rijtSdSs/QSgXvRsAolXqZH4jB4q5WRWdQQy5HUm0ZgMmsK/4f56/R0jbToNuyPhXzC4= Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create a list of subcodes that we want to pass on, a list of subcodes that should not be passed on because they would affect the running qemu itself, and a list that probably could be implemented but require extra work. Do not pass on unknown subcodes. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20211227150127.2659293-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 58 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 0f0f67d56721..d868ef291085 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6337,6 +6337,13 @@ abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr) # define PR_MTE_TAG_SHIFT 3 # define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) #endif +#ifndef PR_SET_IO_FLUSHER +# define PR_SET_IO_FLUSHER 57 +# define PR_GET_IO_FLUSHER 58 +#endif +#ifndef PR_SET_SYSCALL_USER_DISPATCH +# define PR_SET_SYSCALL_USER_DISPATCH 59 +#endif #include "target_prctl.h" @@ -6433,13 +6440,58 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, return -TARGET_EINVAL; } return do_prctl_get_tagged_addr_ctrl(env); + + case PR_GET_DUMPABLE: + case PR_SET_DUMPABLE: + case PR_GET_KEEPCAPS: + case PR_SET_KEEPCAPS: + case PR_GET_TIMING: + case PR_SET_TIMING: + case PR_GET_TIMERSLACK: + case PR_SET_TIMERSLACK: + case PR_MCE_KILL: + case PR_MCE_KILL_GET: + case PR_GET_NO_NEW_PRIVS: + case PR_SET_NO_NEW_PRIVS: + case PR_GET_IO_FLUSHER: + case PR_SET_IO_FLUSHER: + /* Some prctl options have no pointer arguments and we can pass on. */ + return get_errno(prctl(option, arg2, arg3, arg4, arg5)); + + case PR_GET_CHILD_SUBREAPER: + case PR_SET_CHILD_SUBREAPER: + case PR_GET_SPECULATION_CTRL: + case PR_SET_SPECULATION_CTRL: + case PR_GET_TID_ADDRESS: + /* TODO */ + return -TARGET_EINVAL; + + case PR_GET_FPEXC: + case PR_SET_FPEXC: + /* Was used for SPE on PowerPC. */ + return -TARGET_EINVAL; + + case PR_GET_ENDIAN: + case PR_SET_ENDIAN: + case PR_GET_FPEMU: + case PR_SET_FPEMU: + case PR_SET_MM: case PR_GET_SECCOMP: case PR_SET_SECCOMP: - /* Disable seccomp to prevent the target disabling syscalls we need. */ + case PR_SET_SYSCALL_USER_DISPATCH: + case PR_GET_THP_DISABLE: + case PR_SET_THP_DISABLE: + case PR_GET_TSC: + case PR_SET_TSC: + case PR_GET_UNALIGN: + case PR_SET_UNALIGN: + /* Disable to prevent the target disabling stuff we need. */ return -TARGET_EINVAL; + default: - /* Most prctl options have no pointer arguments */ - return get_errno(prctl(option, arg2, arg3, arg4, arg5)); + qemu_log_mask(LOG_UNIMP, "Unsupported prctl: " TARGET_ABI_FMT_ld "\n", + option); + return -TARGET_EINVAL; } }