From patchwork Sun Jun 10 03:01:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138152 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2604727lji; Sat, 9 Jun 2018 20:59:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJLq8N4th+a/3Lo8FSIGAgUujGTl1ctPIgpDoFqAzJI6j3zOOsbPmFOR/wn2wRiHlGJHPBx X-Received: by 2002:ac8:3426:: with SMTP id u35-v6mr11616167qtb.288.1528603187518; Sat, 09 Jun 2018 20:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603187; cv=none; d=google.com; s=arc-20160816; b=1Dafv2EplL8b5orEeOfB7wxDWjCi7SEnHswyLckoBiVV+Gt+jiQzEIuGQTUnFn86yD K+nJGbejL26BFCqQ6mRoccKji61tirUJcCcD+GOtFXIpJzrKJLsDAPlEubnzXc0RHUn0 0RSGPP8haxNI+cbt9UmjGpuACKYRUhraOlbC30Fv+Obc5HFDz65FcLkd3RslDtd1frTS Y71SDemIbqQPVbXze5L/Mb2wvFZKNMnVZskCSYcgYVbA1GEQeEYtZc3haV2wZjh5Cx33 fvE3rHSuKRU0uL8AfLMsHdMUNIs+rf23+/Qyzlzu9/r7FQYS0aCpdtV6xXCLChtDtArx 6fwQ== 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:arc-authentication-results; bh=eKNa1DsH+OxIQ1x9aRCezT/ioFBhMALTf/PEP0/c5zw=; b=Z0+NCh0qMaS1cLK8JAD+GnZTHrWCJJFqSa9sualqRrZkC+I2ZCcOJSEYZqm6BkIlg3 u0e1pwdLw1Rf533D47/xNzIAUPhKicgpPHAWzEt5D2NtrTwedsgHQUVStrCKbH7M5q9S sY5JE7AatpONviT2x7kLHWCdBbH6Po6yvjPSvdMMvCUf9obdTjUaQH1Ev/NMCgtli3r/ 2x9dw4t00faHqDdJp3cPodLM4tvJfDrUKaWNwDYo3LlML60/yedzdcG3SapnLnJmVpIK 90gWITd99NZpiGz98CVoMdFx6ysakw/zCD1n8rwMJ8Pqh7XIAhuii1B2cmsWaDD3iA/o JvTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PRyMnfgz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h5-v6si4854280qkd.22.2018.06.09.20.59.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PRyMnfgz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrW7-0004DB-0V for patch@linaro.org; Sat, 09 Jun 2018 23:59:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfO-00041E-Fx for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfN-0004N7-Ej for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:18 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:35912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfN-0004Ms-8V for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:17 -0400 Received: by mail-pl0-x244.google.com with SMTP id a7-v6so7900314plp.3 for ; Sat, 09 Jun 2018 20:05:17 -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=eKNa1DsH+OxIQ1x9aRCezT/ioFBhMALTf/PEP0/c5zw=; b=PRyMnfgzFTZy3l0RQ6y+MtkVl6iGinnKYcBz8i5C/Ss4K9MqnEdxL72rH82HPSmumd dKlCcNxnFZQs4Q6ML6fuZttKH1mbA/zO/9+HbI+dPeI4JlV5pBzi1SMuJj+u/kwKnvFm InxBRbtfSXiYbOu89KEBvq1QmoU/PXnugQQUw= 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=eKNa1DsH+OxIQ1x9aRCezT/ioFBhMALTf/PEP0/c5zw=; b=un3eLO7XNOSq1COCMwnzdOusnnZwrwSEp6kbXR6hYbv0p9eIgU5IpNq0evoHgMJlQa 9f9ov7MAdReyPlHbuebYN+UMifr4UiF9fEDJ7oA9m9oK3dsRUJa0G+uO7XRNNEElvjTy M5tanXC29Nb07MB2RbC/yTn6VeNGOJXMrcVgn9Bn4K2I3krmo0RGEYSzwNJfPT9V+8BV YCkHLsnyk0Gcwu7bQ9DkVtUy3X8xm7p9wgDg7vDn3VQlth9N/9N02Qq4uHIJ1RmCIxqj NJGAXx1p9syDkD2bbmbgQbbfc84+rQZEwq3FNeZWnsJFebthWTRY1vx15iToiu7QQdmf bFFQ== X-Gm-Message-State: APt69E2GLmp+TMNDG1KyM74r7SqGmqNo8Zpr09PZ6gRmDbKQBj6z4VIJ IklcINtOznCUYKPSv50M23cNKFcdU9k= X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr12936064plt.91.1528599916125; Sat, 09 Jun 2018 20:05:16 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:53 -1000 Message-Id: <20180610030220.3777-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH v2 081/108] linux-user: Split out getresgid32, getresuid32, setresgid32, setresuid32 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.c | 93 +++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 36 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 031033c0ea..af96cc95d3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8674,6 +8674,22 @@ IMPL(getresgid) } #endif +#ifdef TARGET_NR_getresgid32 +IMPL(getresgid32) +{ + gid_t rgid, egid, sgid; + abi_long ret = get_errno(getresgid(&rgid, &egid, &sgid)); + + if (!is_error(ret) && + (put_user_u32(rgid, arg1) || + put_user_u32(egid, arg2) || + put_user_u32(sgid, arg3))) { + return -TARGET_EFAULT; + } + return ret; +} +#endif + #ifdef TARGET_NR_getresuid IMPL(getresuid) { @@ -8690,6 +8706,21 @@ IMPL(getresuid) } #endif +#ifdef TARGET_NR_getresuid32 +IMPL(getresuid32) +{ + uid_t ruid, euid, suid; + abi_long ret = get_errno(getresuid(&ruid, &euid, &suid)); + + if (!is_error(ret) && + (put_user_u32(ruid, arg1) || + put_user_u32(euid, arg2) || + put_user_u32(suid, arg3))) { + return -TARGET_EFAULT; + } + return ret; +} +#endif IMPL(getrlimit) { int resource = target_to_host_resource(arg1); @@ -10906,6 +10937,13 @@ IMPL(setresgid) } #endif +#ifdef TARGET_NR_setresgid32 +IMPL(setresgid32) +{ + return get_errno(sys_setresgid(arg1, arg2, arg3)); +} +#endif + #ifdef TARGET_NR_setresuid IMPL(setresuid) { @@ -10914,6 +10952,13 @@ IMPL(setresuid) } #endif +#ifdef TARGET_NR_setresuid32 +IMPL(setresuid32) +{ + return get_errno(sys_setresuid(arg1, arg2, arg3)); +} +#endif + IMPL(setreuid) { return get_errno(setreuid(low2highuid(arg1), low2highuid(arg2))); @@ -11898,42 +11943,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_setresuid32 - case TARGET_NR_setresuid32: - return get_errno(sys_setresuid(arg1, arg2, arg3)); -#endif -#ifdef TARGET_NR_getresuid32 - case TARGET_NR_getresuid32: - { - uid_t ruid, euid, suid; - ret = get_errno(getresuid(&ruid, &euid, &suid)); - if (!is_error(ret)) { - if (put_user_u32(ruid, arg1) - || put_user_u32(euid, arg2) - || put_user_u32(suid, arg3)) - return -TARGET_EFAULT; - } - } - return ret; -#endif -#ifdef TARGET_NR_setresgid32 - case TARGET_NR_setresgid32: - return get_errno(sys_setresgid(arg1, arg2, arg3)); -#endif -#ifdef TARGET_NR_getresgid32 - case TARGET_NR_getresgid32: - { - gid_t rgid, egid, sgid; - ret = get_errno(getresgid(&rgid, &egid, &sgid)); - if (!is_error(ret)) { - if (put_user_u32(rgid, arg1) - || put_user_u32(egid, arg2) - || put_user_u32(sgid, arg3)) - return -TARGET_EFAULT; - } - } - return ret; -#endif #ifdef TARGET_NR_chown32 case TARGET_NR_chown32: if (!(p = lock_user_string(arg1))) @@ -13235,8 +13244,14 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_getresgid SYSCALL(getresgid); #endif +#ifdef TARGET_NR_getresgid32 + SYSCALL(getresgid32); +#endif #ifdef TARGET_NR_getresuid SYSCALL(getresuid); +#endif +#ifdef TARGET_NR_getresuid32 + SYSCALL(getresuid32); #endif SYSCALL(getrlimit); SYSCALL(getrusage); @@ -13491,11 +13506,17 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_setresgid SYSCALL(setresgid); #endif +#ifdef TARGET_NR_setresgid32 + SYSCALL(setresgid32); +#endif #ifdef TARGET_NR_setregid32 SYSCALL(setregid32); #endif #ifdef TARGET_NR_setresuid SYSCALL(setresuid); +#endif +#ifdef TARGET_NR_setresuid32 + SYSCALL(setresuid32); #endif SYSCALL(setreuid); #ifdef TARGET_NR_setreuid32