From patchwork Tue Aug 19 08:32:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35561 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 980392136C for ; Tue, 19 Aug 2014 08:39:59 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf50937862pdb.1 for ; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=kWk4KP6DVrjCTDasITRec1InBHOuJNo2M7oqpFK3JSA=; b=OgeLWaLU32e7ipMuGSOyMR7mpQ8CSGb83mJFZgnXtGZ/pC2vCCaVM+JXUG6oN/n9TZ E5198tdgKZ/kPXjSp5yYSL4yyNGxIbJDXei8biCBor45m5tkGWtZWqlDUyyLmfjdUYm+ OjdSTR1Pi0WObzmr5Bmt8Erf2C5CaN3iz+FThFJh56wSfKgxp4w91dYiWv1G4xRFBugJ +00+1aUFgfgZO6PlB6PfJAFsqxBeVkg1FRr6iCrFNGLhI2wxB6/iOM0ftpgwFgFXOU1A 22iLB/LWRZfxpcHusOr2vWS6sJL4odDS9ZSgLyGhMyT8k24fw1vLnaApyp5NgOlyCnkP Th4A== X-Gm-Message-State: ALoCoQkaXJvl3G1nIw+v18ssaEU++zWmGqmcweKpJPNh9Ary4dy4cO9R0zyYmmKmYdGO133bGgF+ X-Received: by 10.70.41.230 with SMTP id i6mr4834267pdl.2.1408437598947; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.148 with SMTP id p20ls2746024qgp.50.gmail; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr29036583vcb.19.1408437598836; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id w17si2504977vcp.52.2014.08.19.01.39.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so7030816vcb.35 for ; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr5889991vdb.8.1408437598718; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp220583vcb; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) X-Received: by 10.140.82.71 with SMTP id g65mr60574863qgd.75.1408437598107; Tue, 19 Aug 2014 01:39:58 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v109si28002326qge.121.2014.08.19.01.39.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:39:58 -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; Received: from localhost ([::1]:49120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJexR-0003hP-Mq for patch@linaro.org; Tue, 19 Aug 2014 04:39:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeqr-0000yy-Kh for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJeql-0001ZW-GL for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:09 -0400 Received: from afflict.kos.to ([92.243.29.197]:35158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeql-0001Ym-99 for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:03 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id BB688265A9; Tue, 19 Aug 2014 10:33:01 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:44 +0300 Message-Id: <1c4fb7dfbcb9e43cab18bf153cfb87760cb991ee.1408436940.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Riku Voipio Subject: [Qemu-devel] [PULL v2 09/23] linux-user: add setns and unshare X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Riku Voipio Add support for the setns and unshare syscalls, trivially passed through to the host. Based on patches by Paul Burton, added configure check. Signed-off-by: Paul Burton Signed-off-by: Riku Voipio --- configure | 20 ++++++++++++++++++++ linux-user/strace.list | 3 +++ linux-user/syscall.c | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/configure b/configure index 3d0ab1b..c4e47e1 100755 --- a/configure +++ b/configure @@ -3470,6 +3470,23 @@ if compile_prog "" "" ; then timerfd=yes fi +# check for setns and unshare support +setns=no +cat > $TMPC << EOF +#include + +int main(void) +{ + int ret; + ret = setns(0, 0); + ret = unshare(0); + return ret; +} +EOF +if compile_prog "" "" ; then + setns=yes +fi + # Check if tools are available to build documentation. if test "$docs" != "no" ; then if has makeinfo && has pod2man; then @@ -4541,6 +4558,9 @@ fi if test "$timerfd" = "yes" ; then echo "CONFIG_TIMERFD=y" >> $config_host_mak fi +if test "$setns" = "yes" ; then + echo "CONFIG_SETNS=y" >> $config_host_mak +fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi diff --git a/linux-user/strace.list b/linux-user/strace.list index 147f579..d5b8033 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1191,6 +1191,9 @@ #ifdef TARGET_NR_set_mempolicy { TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL }, #endif +#ifdef TARGET_NR_setns +{ TARGET_NR_setns, "setns" , NULL, NULL, NULL }, +#endif #ifdef TARGET_NR_setpgid { TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL }, #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 74c5d49..e5c3ebb 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9680,6 +9680,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif +#if defined(TARGET_NR_setns) && defined(CONFIG_SETNS) + case TARGET_NR_setns: + ret = get_errno(setns(arg1, arg2)); + break; +#endif +#if defined(TARGET_NR_unshare) && defined(CONFIG_SETNS) + case TARGET_NR_unshare: + ret = get_errno(unshare(arg1)); + break; +#endif + default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);