From nobody Wed Feb 11 01:09:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528603165358267.5040933735312; Sat, 9 Jun 2018 20:59:25 -0700 (PDT) Received: from localhost ([::1]:42482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrVk-0003Pp-Jz for importer@patchew.org; Sat, 09 Jun 2018 23:59:24 -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) 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) 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-Google-Smtp-Source: ADUXVKKeBhrIoI2a9+xdBnya/QcF0wGR/uupUbbPX9SDxXw61oU75CbXlxdG4Jq75aHmmoQFE61aGQ== X-Received: by 2002:a63:745a:: with SMTP id e26-v6mr10160449pgn.377.1528599917886; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 82 +++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 24 deletions(-) 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 =20 +#ifdef TARGET_NR_chown32 +IMPL(chown32) +{ + char *p =3D lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret =3D get_errno(chown(p, arg2, arg3)); + unlock_user(p, arg1, 0); + return ret; +} +#endif + IMPL(chroot) { char *p =3D lock_user_string(arg1); @@ -10815,16 +10830,37 @@ IMPL(setfsgid) return get_errno(setfsgid(arg1)); } =20 +#ifdef TARGET_NR_setfsgid32 +IMPL(setfsgid32) +{ + return get_errno(setfsgid(arg1)); +} +#endif + IMPL(setfsuid) { return get_errno(setfsuid(arg1)); } =20 +#ifdef TARGET_NR_setfsuid32 +IMPL(setfsuid32) +{ + return get_errno(setfsuid(arg1)); +} +#endif + IMPL(setgid) { return get_errno(sys_setgid(low2highgid(arg1))); } =20 +#ifdef TARGET_NR_setgid32 +IMPL(setgid32) +{ + return get_errno(sys_setgid(arg1)); +} +#endif + IMPL(setgroups) { int gidsetsize =3D arg1; @@ -11017,6 +11053,13 @@ IMPL(setuid) return get_errno(sys_setuid(low2highuid(arg1))); } =20 +#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, unsigne= d num, abi_long arg1, void *p; =20 switch(num) { -#ifdef TARGET_NR_chown32 - case TARGET_NR_chown32: - if (!(p =3D lock_user_string(arg1))) - return -TARGET_EFAULT; - ret =3D 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 --=20 2.17.1