From patchwork Sun Jun 10 03:01:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138151 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2603792lji; Sat, 9 Jun 2018 20:57:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLTgxaZx2jzhzO4X69hUXuNGfos7usAWFnIa38+Q6etQOr18tTMMypufPdb54w+NEPAcGLx X-Received: by 2002:a37:15cd:: with SMTP id 74-v6mr10665662qkv.335.1528603073225; Sat, 09 Jun 2018 20:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603073; cv=none; d=google.com; s=arc-20160816; b=08uU5mN07FOS2ACjGkttAHC+VCUQwTTYknfukBl7ljw6HDdohBmU36oiV1Ja4fIp/w dog0lVOSfnugY+rPCe2CwGyuWAChtNeWeQslP2hHlKooIrTA/tdDkITCtNLQM1ZVgudf y1gpWiUbwUjrVVZPmLOdG9DjAn5fZI4kcfjt8YUVEJ/g3Vd3AriavOvHpKAXWi+oA5lx SDIYgmXLaRN6lqvIgbdR9k8s4Dvg+VrBRoGN7a/DykUgLx0K1kOkhUcna1TKXqqiXqLw UMmD1Dyx8NVBsXfm34WkE4sRMHw1gWSBIfpNWlVFngTxXsJiBxBAqKK+H5u/2T8aY1Gf SYjA== 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=+n2lKBW6p5nuY81WSsCh3TN8fpItL8XwNfAloRWOuKc=; b=S9Io6D8Sn2t2LH8jNDQQUUoijDIGdMa0y0h+T5yCkaMRI24oZk4JlytJGyhWmXPBmU gEONUUl0AHQq9P7OURDQi+SNcSgiM13vrDIoLvknwp0lPtxxiPVkxmH2yuA7UVK6pRV4 4yxcBbBqnSor62REF1rl33A9Xh2Op79MLH+U1KM/zjm8rnP8DuGw+XsrU3gIjkkavjVO h1jZ2MjZmrx5j3kSWrv+1B1cUb4IBbtgT3zkq4VERb3gZfS3S12/cMYwNz+eRi3g9d/1 TCMd+3NLaH+zqPJhz8b/zN076SILTjv87zRTve6x7WIIIkUhP+9P8bWJGciGYUGCX3jd l8lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kgFGz6Pq; 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 d5-v6si4709382qtn.268.2018.06.09.20.57.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:57:53 -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=kgFGz6Pq; 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]:42477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrUG-0002JH-Jt for patch@linaro.org; Sat, 09 Jun 2018 23:57:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfQ-00043c-Ry for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfP-0004NX-Fu for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:20 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:41364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfP-0004NL-98 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:19 -0400 Received: by mail-pf0-x244.google.com with SMTP id a11-v6so8486595pff.8 for ; Sat, 09 Jun 2018 20:05:19 -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=+n2lKBW6p5nuY81WSsCh3TN8fpItL8XwNfAloRWOuKc=; b=kgFGz6PqVoLlrRqQ4V/WvlH9zivsCclVPhRVMRMTCfjfg0LvdjasJRAojShIx46UL/ BMxPTebmE17ux37Aodz9x3StcaUMu7EmimDsQXJSCBn547imNpO3jCt0KHvDXYjCEMbY /qevr+vS/hUWpkGMhN2wjQ1x3yNFB5iawQoe8= 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=+n2lKBW6p5nuY81WSsCh3TN8fpItL8XwNfAloRWOuKc=; b=F9mtVF9F7fZNY2iL2IWd6SlE5fdN6SSLbaefSEZh9OVIgzZ/7mXQPsvwwOLbrwfpBi ErUXrYkRSL0p+zyft2wAjis+0yrZUhM6z6QORPoNutVl38GZCiuIuEWT9c7JDbdRcDng Ff3YkM5eQKKzlnSA74+gIA0khqZTC77NRnIkHZ1eLL4IDsUNrRV8ZLkW6hEiQD5MjAgN 8urmhuPFtgqL8p6LGWHLPmZJCBwA9M1Ke7YDeT3sJm5qVWhiv/pWtqqK7qvjVNOUxVJ0 1iAjMRnkuKl5fPyn0CwpbJZ3AmT07fmmiO7ebdV98gK+xz2iYnsGhHZLXX1vc9Y1DlJW S2rA== X-Gm-Message-State: APt69E0droCI0x4An2xI9DN64XJAmhc65bMpek/IjBueeAR20uLs7KE7 qyScqqpDeLiVQlAOrZZ/5GoO8QPQ94I= X-Received: by 2002:a63:745a:: with SMTP id e26-v6mr10160449pgn.377.1528599917886; Sat, 09 Jun 2018 20:05:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:54 -1000 Message-Id: <20180610030220.3777-83-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:c00::244 Subject: [Qemu-devel] [PATCH v2 082/108] linux-user: Split out chown32, setfsgid32, setfsuid32, setgid32, setuid32 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 | 82 +++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index af96cc95d3..fc7f301519 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7802,6 +7802,21 @@ IMPL(chown) } #endif +#ifdef TARGET_NR_chown32 +IMPL(chown32) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(chown(p, arg2, arg3)); + unlock_user(p, arg1, 0); + return ret; +} +#endif + IMPL(chroot) { char *p = lock_user_string(arg1); @@ -10815,16 +10830,37 @@ IMPL(setfsgid) return get_errno(setfsgid(arg1)); } +#ifdef TARGET_NR_setfsgid32 +IMPL(setfsgid32) +{ + return get_errno(setfsgid(arg1)); +} +#endif + IMPL(setfsuid) { return get_errno(setfsuid(arg1)); } +#ifdef TARGET_NR_setfsuid32 +IMPL(setfsuid32) +{ + return get_errno(setfsuid(arg1)); +} +#endif + IMPL(setgid) { return get_errno(sys_setgid(low2highgid(arg1))); } +#ifdef TARGET_NR_setgid32 +IMPL(setgid32) +{ + return get_errno(sys_setgid(arg1)); +} +#endif + IMPL(setgroups) { int gidsetsize = arg1; @@ -11017,6 +11053,13 @@ IMPL(setuid) return get_errno(sys_setuid(low2highuid(arg1))); } +#ifdef TARGET_NR_setuid32 +IMPL(setuid32) +{ + return get_errno(sys_setuid(arg1)); +} +#endif + #ifdef TARGET_NR_sigaction IMPL(sigaction) { @@ -11943,30 +11986,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_chown32 - case TARGET_NR_chown32: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(chown(p, arg2, arg3)); - unlock_user(p, arg1, 0); - return ret; -#endif -#ifdef TARGET_NR_setuid32 - case TARGET_NR_setuid32: - return get_errno(sys_setuid(arg1)); -#endif -#ifdef TARGET_NR_setgid32 - case TARGET_NR_setgid32: - return get_errno(sys_setgid(arg1)); -#endif -#ifdef TARGET_NR_setfsuid32 - case TARGET_NR_setfsuid32: - return get_errno(setfsuid(arg1)); -#endif -#ifdef TARGET_NR_setfsgid32 - case TARGET_NR_setfsgid32: - return get_errno(setfsgid(arg1)); -#endif #ifdef TARGET_NR_mincore case TARGET_NR_mincore: { @@ -13139,6 +13158,9 @@ static impl_fn *syscall_table(unsigned num) #endif #ifdef TARGET_NR_chown SYSCALL(chown); +#endif +#ifdef TARGET_NR_chown32 + SYSCALL(chown32); #endif SYSCALL(chroot); #ifdef TARGET_NR_connect @@ -13492,8 +13514,17 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(setdomainname); SYSCALL(setfsgid); +#ifdef TARGET_NR_setfsgid32 + SYSCALL(setfsgid32); +#endif SYSCALL(setfsuid); +#ifdef TARGET_NR_setfsuid32 + SYSCALL(setfsuid32); +#endif SYSCALL(setgid); +#ifdef TARGET_NR_setgid32 + SYSCALL(setgid32); +#endif SYSCALL(setgroups); #ifdef TARGET_NR_setgroups32 SYSCALL(setgroups32); @@ -13529,6 +13560,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(settimeofday); SYSCALL(setsid); SYSCALL(setuid); +#ifdef TARGET_NR_setuid32 + SYSCALL(setuid32); +#endif #ifdef TARGET_NR_sigaction SYSCALL(sigaction); #endif