From patchwork Sun Jun 10 03:01:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138155 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2606911lji; Sat, 9 Jun 2018 21:02:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ/2t9VFBVMPEZF9RWKGSX/nsfhmzlbqWFeTqMGLtERu6v/FL9bjMYfMM1r31rqMRkZcyt2 X-Received: by 2002:a0c:93a2:: with SMTP id f31-v6mr10924493qvf.151.1528603370856; Sat, 09 Jun 2018 21:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603370; cv=none; d=google.com; s=arc-20160816; b=QBGFzCy7FUbGBczA1EgWRYjy+GHGnY7qPCd8tQXBDeTiUH4HLoXD8HpyTAQWc6StdG oXX0XHFRa3uAxUZnMg4c9POcvjx/mJtWcpV48gyqlPI+gjy/E48d2Pc0sC5r3hFRyuIh 67OQmiaktg9LuJQCjbo5uadL1syjfRjnzO5Y2hP/aNFBlltgwogjfAdpv89XG807r4Mj A8FOleLtAvH19lZPnNw6Rad8SuUuhj4tYdUoiQ/8dqAn9/jGebOH295ObmVmw2oKZoQI hB0oIvi2ZM3vwNLJvYNAqRdWIEvvWoXxgpURSxnnIkC/PB6p8bjxjdJFYnNzm6RMCp8V m8dA== 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=PAMvoUup1MEEtHTT+kodKawFkMWQPuORADOIcTcuknQ=; b=gbJABDLXKB14N7sWZ6LxOyTghLfSwgtrw0e7Sn18w9qXgSjT0V2hbgw106GVQ3MaBR W1DSBqOBUVHgknp+IfDspVx2jT9tTSmnIOrourg04zfKyr2JOeIrRbpNQ1qau5jN7aIW 2czPTZb4zsQ1HQA80bEOJZ8cduorgfJocQRqO8iDM2amK+HyKmr3CivWQ3PouuS6wImm NhwgIgKkNeegrjfINTbFRbL3wYX6BV1Z8/zfjpLcS7bxF2pq/TfDHKef7wbO+yHwIjhh S5V9bkMmusNMlRmbWXf1/7eIBr/rXWeerH//2UODXXx+yXeJxom0jjXlsavnXtVJqQck hwTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KwyHBJYz; 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 29-v6si6404824qkv.336.2018.06.09.21.02.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:02:50 -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=KwyHBJYz; 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]:42509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrZ4-0006q8-6c for patch@linaro.org; Sun, 10 Jun 2018 00:02:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfC-0003oH-3i for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqf9-0004JO-EX for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:06 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:41588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqf9-0004J0-7g for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:03 -0400 Received: by mail-pl0-x242.google.com with SMTP id az12-v6so10380849plb.8 for ; Sat, 09 Jun 2018 20:05:03 -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=PAMvoUup1MEEtHTT+kodKawFkMWQPuORADOIcTcuknQ=; b=KwyHBJYzhxQDZAwsdWuSE35u4KxqKD2T5mqP0XaLiS1bIwPk4ZNvSYzJG2x6e8sx0s MzICptw6WhlC4yf/X4cFzZJYMnKMZ7WtOCpXUZGpIUkoC0P7BZgG2Lujwf0JrEDvPvxN xIQZrnv68/m3CE924k5b+BVulr0JN8tTRSdGw= 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=PAMvoUup1MEEtHTT+kodKawFkMWQPuORADOIcTcuknQ=; b=UK9gQZEMaZegFzLOpIF9vDmzJzk2m+vrAHKEWLw4AF9Ehdr+vxVKf0nb2A4Jy5nt21 kdJ8Syqt7LeEO0h7g9ZsqjAfcUaqpSVUUyFpzFKGcdktHaGBvXXShxyuhq1PGx4MJNVi ZlVDGkQ17kYRtGvKKMmfKODKPLGZ7hU8YwhpR26EO585GxnTSYfHBY9+e8tscs9Xy1jN Jtn0hV5S1Bjygg+cdkZtSGNeH0fIFlmUhiSCXrHfpgO3zTOsnqE1aZTVcrW2clRoLIFN puBgHaEXEU7y6pdYuv/yXejgt3s4HM7fIrOLFOiAOeCPzystyHkWuYwiHTOLcg0Zua3j bapg== X-Gm-Message-State: APt69E0TyGlTGOvXkBGradl32IsuFdlTXOLnyVX/a1R2mQDLLjkGdLSC tsLlQ0nkGUxqhzgNKO2fu0yAqMkXmro= X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr12943077pls.18.1528599902081; Sat, 09 Jun 2018 20:05:02 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:46 -1000 Message-Id: <20180610030220.3777-75-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::242 Subject: [Qemu-devel] [PATCH v2 074/108] linux-user: Split out fchown, fchownat, setresgid, setresuid 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" All targets define fchownat; remove the ifdef. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 66 +++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 23 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 915e1f1a91..75b869fb33 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8103,6 +8103,25 @@ IMPL(fchmodat) return ret; } +IMPL(fchown) +{ + return get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); +} + +IMPL(fchownat) +{ + char *p = lock_user_string(arg2); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(fchownat(arg1, p, low2highuid(arg3), + low2highgid(arg4), arg5)); + unlock_user(p, arg2, 0); + return ret; +} + #ifdef TARGET_NR_fcntl IMPL(fcntl) { @@ -10540,6 +10559,22 @@ IMPL(setregid) return get_errno(setregid(low2highgid(arg1), low2highgid(arg2))); } +#ifdef TARGET_NR_setresgid +IMPL(setresgid) +{ + return get_errno(sys_setresgid(low2highgid(arg1), low2highgid(arg2), + low2highgid(arg3))); +} +#endif + +#ifdef TARGET_NR_setresuid +IMPL(setresuid) +{ + return get_errno(sys_setresuid(low2highuid(arg1), low2highuid(arg2), + low2highuid(arg3))); +} +#endif + IMPL(setreuid) { return get_errno(setreuid(low2highuid(arg1), low2highuid(arg2))); @@ -11512,23 +11547,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_fchown: - return get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); -#if defined(TARGET_NR_fchownat) - case TARGET_NR_fchownat: - if (!(p = lock_user_string(arg2))) - return -TARGET_EFAULT; - ret = get_errno(fchownat(arg1, p, low2highuid(arg3), - low2highgid(arg4), arg5)); - unlock_user(p, arg2, 0); - return ret; -#endif -#ifdef TARGET_NR_setresuid - case TARGET_NR_setresuid: - return get_errno(sys_setresuid(low2highuid(arg1), - low2highuid(arg2), - low2highuid(arg3))); -#endif #ifdef TARGET_NR_getresuid case TARGET_NR_getresuid: { @@ -11543,12 +11561,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, } return ret; #endif -#ifdef TARGET_NR_getresgid - case TARGET_NR_setresgid: - return get_errno(sys_setresgid(low2highgid(arg1), - low2highgid(arg2), - low2highgid(arg3))); -#endif #ifdef TARGET_NR_getresgid case TARGET_NR_getresgid: { @@ -13094,6 +13106,8 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(fchdir); SYSCALL(fchmod); SYSCALL(fchmodat); + SYSCALL(fchown); + SYSCALL(fchownat); #ifdef TARGET_NR_fcntl SYSCALL(fcntl); #endif @@ -13378,6 +13392,12 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(setpgid); SYSCALL(setpriority); SYSCALL(setregid); +#ifdef TARGET_NR_setresgid + SYSCALL(setresgid); +#endif +#ifdef TARGET_NR_setresuid + SYSCALL(setresuid); +#endif SYSCALL(setreuid); SYSCALL(setrlimit); #ifdef TARGET_NR_setsockopt