From patchwork Sun May 19 20:37:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164543 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4806831ili; Sun, 19 May 2019 14:20:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqy97qWVwRFGaZEqlNY2jG55EiHIbuy8D8ASwGnx/QYhyED6lbjUW8g+v17nUviSwUuU/MsU X-Received: by 2002:a17:906:4e87:: with SMTP id v7mr49642776eju.150.1558300811842; Sun, 19 May 2019 14:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558300811; cv=none; d=google.com; s=arc-20160816; b=J3F/zrrYv2bOAWSzP8ncM5D2608M2E9riHLftVVhrQsgB/puW6skZYePzQijw1i9Iq HlZoycQuR7krZFUDwzFQPO3Qtbin+BLf1ELrtacEfgMOweuz9X6izw4FpELhdxI2CQWw fNcdZoL5EOXS19y6fkYeIZV7UgNcGqZ9iCeW7XqwshXKCu5a+OGMwFqlAcB7XOpo6foD zCOVlchOy0fxsVSTVYeCJexMQfr7A4EUf+kL6aV9y1kfK7+Xve5TP8839AGCVzfZH0fO CCtTPJ533QyDVMfbMNsQ+9AJAMOdcFWj6f+69wSQHwkasoglYgqHwaLvMGEf/VBogYuM YYAQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ECmaTCfEAMemyN6xkmuxaTzKq2RyHXzLJFeHp0RKqwc=; b=MssGGM7Z7OherikAISET87VHnXACB/wa4RranDnvN6aLN8k2h8G1KF9HobUYDYoDiZ ZacrgwmDHhlI/q+I4zFBVRVIdlsnIluZ6jvaPQFe6p814apozO5GmcKTp/x2FGdPjOAC FzZ9UStJXp3iQRiOLhz1NA5mrsEGO0FA9KGV8nbZ00BX/r7vcJTBMaW7Zhep+prjoSFc Ka6ir3vi5L8BfmdOeL3t2WWmC1IOcdUCmBO8fPOFgxoI+ZvYP6rAUt4t+fyrwk1m0jbR JXyfKmIHoQOAuio46gr3w7qnn78OoiTdiqjjfB5qDK49hnYEMRDjLYSReENHjPtgGs3B VEEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=q7VaexYd; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z10si10866142edc.287.2019.05.19.14.20.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:20:11 -0700 (PDT) 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; dkim=fail header.i=@linaro.org header.s=google header.b=q7VaexYd; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTE2-0006PQ-Kn for patch@linaro.org; Sun, 19 May 2019 17:20:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZx-0003uD-2f for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZv-0004og-Rs for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:45 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:40703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZv-0004np-Lt for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:43 -0400 Received: by mail-pf1-x442.google.com with SMTP id u17so6164928pfn.7 for ; Sun, 19 May 2019 13:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ECmaTCfEAMemyN6xkmuxaTzKq2RyHXzLJFeHp0RKqwc=; b=q7VaexYd+7If+cN2hjhaFwAKNkcPwnI0/CufIkGx5LDTc1sAzpKs8XJ+C2gfl+pADo JelSOM/p0qBipRdZdeO8FnD7I0Sfl3uduomlcO7xgAptqH+93GIaC/UY2EJNEQc+nc0s ais6vaUpRo6PhKvkeLIFBtto7go/wo9GoFnd6J9DGCxP5iImwhOJyGnDu6ejYdAIFbrN penQZzl50WLzHt8qszsFQlmrQR4zaiVTsSvbZ19cqsNgKTJ4g4URjeYojzVbsL5N5z1s CQ88qFOKGuCeArEIMLxAOInDYdHZi6GvDbbGSSsn5bA0Q+bXkk9RFs4HITNHasWJSwUK oboQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ECmaTCfEAMemyN6xkmuxaTzKq2RyHXzLJFeHp0RKqwc=; b=CxvpAYh6jRdUMUSlpLRl0tZ4GS3AIe18vjkFeRlidFzlKM5lGMzXe6/ShrpH/7KKV1 VgBSCU0nX2k+4NujshiXqSJcIYy81ao56IjP/s0i4+mxpsk+87boHS1d0m7wZkmNfERz NGqDZdtRvwN3kfZGtY3Vet0hk7tDLtD1zZ0mqrBUB+iRahqrSdYqO0YS91ycysu72zBY 2EuTfE9T5GzciKSrcM4NIsJCVjZ68EdN5cIvdkJYP4ben/+b3zWwtnEFFixFAwF3VGip 5SahACBbFaRl47BGdzYT+byGpET30rfHYUWnR+/kbD+VaaqEvB4u5PyK3jpPCCvWmdfk qKRA== X-Gm-Message-State: APjAAAUtuwL7c1YkIn2FhUTEbx4cTn0JdIUXlUYa9fFxtFC2psShbrq/ W0oYfpDi4HgkWMWzEf4AbE0MZ0tdESk= X-Received: by 2002:a62:5487:: with SMTP id i129mr75484904pfb.68.1558298322438; Sun, 19 May 2019 13:38:42 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:11 -0700 Message-Id: <20190519203726.20729-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v7 59/74] linux-user: Split out sigpending, rt_sigpending X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-sig.inc.c | 45 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 36 ----------------------------- linux-user/strace.list | 6 ----- 4 files changed, 49 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index ef77f60524..83a69246d0 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -194,6 +194,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_PTR, ARG_DEC); #else SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC); #endif +SYSCALL_DEF(rt_sigpending, ARG_PTR, ARG_DEC); SYSCALL_DEF(rt_sigprocmask, ARG_SIGPROCMASKHOW, ARG_PTR, ARG_PTR, ARG_DEC); #if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semctl) SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX); @@ -223,6 +224,9 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX); #ifdef TARGET_NR_sigaction SYSCALL_DEF(sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR); #endif +#ifdef TARGET_NR_sigpending +SYSCALL_DEF(sigpending, ARG_PTR); +#endif #if defined(TARGET_ALPHA) SYSCALL_DEF(sigprocmask, ARG_SIGPROCMASKHOW, ARG_HEX); #elif defined(TARGET_NR_sigprocmask) diff --git a/linux-user/syscall-sig.inc.c b/linux-user/syscall-sig.inc.c index 8a6518bdaa..fe717a5121 100644 --- a/linux-user/syscall-sig.inc.c +++ b/linux-user/syscall-sig.inc.c @@ -117,6 +117,33 @@ SYSCALL_IMPL(rt_sigaction) return ret; } +SYSCALL_IMPL(rt_sigpending) +{ + sigset_t set; + abi_long ret; + + /* + * Yes, this check is >, not != like most. We follow the kernel's + * logic and it does it like this because it implements + * NR_sigpending through the same code path, and in that case + * the old_sigset_t is smaller in size. + */ + if (arg2 > sizeof(target_sigset_t)) { + return -TARGET_EINVAL; + } + + ret = get_errno(sigpending(&set)); + if (!is_error(ret)) { + void *p = lock_user(VERIFY_WRITE, arg1, sizeof(target_sigset_t), 0); + if (!p) { + return -TARGET_EFAULT; + } + host_to_target_sigset(p, &set); + unlock_user(p, arg1, sizeof(target_sigset_t)); + } + return ret; +} + SYSCALL_IMPL(rt_sigprocmask) { int how = 0; @@ -259,6 +286,24 @@ SYSCALL_IMPL(sigaction) } #endif +#ifdef TARGET_NR_sigpending +SYSCALL_IMPL(sigpending) +{ + sigset_t set; + abi_long ret = get_errno(sigpending(&set)); + + if (!is_error(ret)) { + void *p = lock_user(VERIFY_WRITE, arg1, sizeof(target_sigset_t), 0); + if (!p) { + return -TARGET_EFAULT; + } + host_to_target_old_sigset(p, &set); + unlock_user(p, arg1, sizeof(target_sigset_t)); + } + return ret; +} +#endif + #ifdef TARGET_NR_sigprocmask SYSCALL_IMPL(sigprocmask) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 11bbdfade4..7dda237c95 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4241,42 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_sigpending - case TARGET_NR_sigpending: - { - sigset_t set; - ret = get_errno(sigpending(&set)); - if (!is_error(ret)) { - if (!(p = lock_user(VERIFY_WRITE, arg1, sizeof(target_sigset_t), 0))) - return -TARGET_EFAULT; - host_to_target_old_sigset(p, &set); - unlock_user(p, arg1, sizeof(target_sigset_t)); - } - } - return ret; -#endif - case TARGET_NR_rt_sigpending: - { - sigset_t set; - - /* Yes, this check is >, not != like most. We follow the kernel's - * logic and it does it like this because it implements - * NR_sigpending through the same code path, and in that case - * the old_sigset_t is smaller in size. - */ - if (arg2 > sizeof(target_sigset_t)) { - return -TARGET_EINVAL; - } - - ret = get_errno(sigpending(&set)); - if (!is_error(ret)) { - if (!(p = lock_user(VERIFY_WRITE, arg1, sizeof(target_sigset_t), 0))) - return -TARGET_EFAULT; - host_to_target_sigset(p, &set); - unlock_user(p, arg1, sizeof(target_sigset_t)); - } - } - return ret; #ifdef TARGET_NR_sigsuspend case TARGET_NR_sigsuspend: { diff --git a/linux-user/strace.list b/linux-user/strace.list index 7157876302..978e47bf0e 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -926,9 +926,6 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigpending -{ TARGET_NR_rt_sigpending, "rt_sigpending" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_rt_sigqueueinfo { TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, print_rt_sigqueueinfo, NULL }, #endif @@ -1128,9 +1125,6 @@ #ifdef TARGET_NR_signalfd4 { TARGET_NR_signalfd4, "signalfd4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigpending -{ TARGET_NR_sigpending, "sigpending" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_sigreturn { TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, #endif