From patchwork Sun May 19 20:37:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164539 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4804516ili; Sun, 19 May 2019 14:16:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqH9aahNtxBU/eMXFsWg7jGqfucYPQGsWdXs0J6yUyEl8a8bKH3FLKTU6z4cmGZB2E5F3+ X-Received: by 2002:a17:906:b2d3:: with SMTP id cf19mr13224392ejb.10.1558300590860; Sun, 19 May 2019 14:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558300590; cv=none; d=google.com; s=arc-20160816; b=qAcJD9B84VYSWg0ddc6mn/R6Vdjws3WvhQ3XAw6baFBpWqUZ+JfBfvydOo9p2wRV+M 0kA5Pkmq3XvdU5x0RXxGZon9JYSOE1HAa2hs7bjkBf8Rhfholtw0COVs5dS3kQqfaSas TFJG8iaq9f2VjdXhdaLN5U4OpTJwP2GhCVozSXo38NjLFZm3DrRlWmWfLLYGlO1uFRdo uPT7nZv/d+hVQyH04RHGpqB1QGYEeYFDX4MzOYp/m85FRQLChJEwwd5BKoAzc3EiS4qn jiAh3kYUZDHuSQfNoinj2oaZFWcNBIe7wBHZrmKMHlFQGKsZUCGBmTqabEUosJbPZk/b tOFg== 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; bh=7L7bsUhZiRxWJXbYkbn2Jh3ZaH0xfMhZkbZE3Jd/+Dw=; b=WURRh+srKu1sVh8jpl/l36HvgPkUfvgn9Kxm1nW4ESsY9E48567PVorx/Lae7ZcrvF NXHOXEbOZRB5T2b393TZTnF91WF57L8dNcmWqW6GGalSKKq4WLR7egN3Plm6XVkmpM/O ZpLlttVuGiarsiz24F43hM2M6kMGn5+LuzEiel7XyfjWTKl/taXs1jRececXhnAIPQLA vqyJkA8lceEatgiSc0VPNUbWKltAFteqJrMRW0pPIh0UWtZnvt3G6hZc0dSa8vMnhoL2 oIOpY534jv5hsWAA+FteITZVb+5FXqOUj1irc4MNqXzyLBzSfMNt4+r42TKckm1H3c9G UrTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Sh/K3TeN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id 6si9945847edu.147.2019.05.19.14.16.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Sh/K3TeN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:53681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTAT-0002uy-PG for patch@linaro.org; Sun, 19 May 2019 17:16:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZq-0003pv-12 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZo-0004gH-VR for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:37 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:44240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZo-0004fA-Ot for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:36 -0400 Received: by mail-pl1-x643.google.com with SMTP id c5so5690934pll.11 for ; Sun, 19 May 2019 13:38:36 -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=7L7bsUhZiRxWJXbYkbn2Jh3ZaH0xfMhZkbZE3Jd/+Dw=; b=Sh/K3TeNlrzQweyPs5RsuWLIuhsyEjrp8RDmgd0ctRv5apJNlUDqc3U+eYEtcPr4lf K350UkXahxGVZIEJPVx1hjBBh+OUn0clBfjwW+3cLw8/8w0bGbb0VqlcRl/+BwwEGpai A8NgRzav+1LoPLKRnTRFCOqEShack4gUCdS19Fy/PItScn2fDCDNvsE3aY3A3LX9ZqKV 1gSBM5YR+HCmoBxHiPCFqTvm487Y4UrFHT4+2IY56RIN7YtZrVWFHSViOnqtoaa7XN3n 6IGtOqATAkcyVhhXB5H6vqcBGbGLzIjoU5fw9B92ckhMouLcb4CU2tTqQyoMsnzvocXq RYFA== 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=7L7bsUhZiRxWJXbYkbn2Jh3ZaH0xfMhZkbZE3Jd/+Dw=; b=N7y7UJ9BsGBelNGj50g6CwBKGK2Vsqy9Z2bPVO0l7QSAvYy53dxb+NhGqS0zhgHbRL S1W+2HO6dT3HUrlJJ+Yi0D91+tT7+FgMFwJ9KeZ/aj7RBiIPt8yeZG0nT/vyxK2TRNKD ryQuNiDjkCiIGBNomKoo7HQVufEww4KbMgKkW41veRyUw0MvYSeOrIrnrHSqBEabzx0F 6LNcVZaDB14twxS48mQZ41uV/Ice1m0+3UJ6MbO7skpxSWWUs5bvKrM4J6pVKAMI/YAE 0X+yG929hUbjCP/fP4c2wImPR80TwDxB6hRGK5sGTAZfwGCJhq2cpC8bmEmfua4dtOsl Gryg== X-Gm-Message-State: APjAAAXlVM3epFQcX/Mo86JGlXhmq9Ghgac/LaSoqj4R+iLDUimeATPy 1bXksEvrmVIQnhK/HVksi7Aebvu+jzs= X-Received: by 2002:a17:902:59c3:: with SMTP id d3mr1085000plj.273.1558298315567; Sun, 19 May 2019 13:38:35 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:05 -0700 Message-Id: <20190519203726.20729-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v7 53/74] linux-user: Split out chroot 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-defs.h | 1 + linux-user/strace.c | 12 ------------ linux-user/syscall-file.inc.c | 13 +++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 3 --- 5 files changed, 14 insertions(+), 21 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index b6538350a3..b93ca1f78a 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -30,6 +30,7 @@ SYSCALL_DEF(chdir, ARG_STR); #ifdef TARGET_NR_chmod SYSCALL_DEF(chmod, ARG_STR, ARG_MODEFLAG); #endif +SYSCALL_DEF(chroot, ARG_STR); SYSCALL_DEF_ARGS(clone, ARG_CLONEFLAG, ARG_PTR, ARG_PTR, ARG_PTR, ARG_PTR); SYSCALL_DEF(close, ARG_DEC); #ifdef TARGET_NR_creat diff --git a/linux-user/strace.c b/linux-user/strace.c index 560284b3c3..787bf41307 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1130,18 +1130,6 @@ print_accept(const struct syscallname *name, } #endif -#ifdef TARGET_NR_chroot -static void -print_chroot(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) -{ - print_syscall_prologue(name); - print_string(arg0, 1); - print_syscall_epilogue(name); -} -#endif - #ifdef TARGET_NR_clock_adjtime static void print_clock_adjtime(const struct syscallname *name, diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index cbde6d906f..6e730e3152 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -88,6 +88,19 @@ SYSCALL_IMPL(chmod) } #endif +SYSCALL_IMPL(chroot) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(chroot(p)); + unlock_user(p, arg1, 0); + return ret; +} + SYSCALL_IMPL(close) { int fd = arg1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 419edceab2..255765aaa7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4241,12 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_chroot: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(chroot(p)); - unlock_user(p, arg1, 0); - return ret; #ifdef TARGET_NR_getpgrp case TARGET_NR_getpgrp: return get_errno(getpgrp()); diff --git a/linux-user/strace.list b/linux-user/strace.list index 61d22ad16b..7679e844b6 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -58,9 +58,6 @@ #ifdef TARGET_NR_chown32 { TARGET_NR_chown32, "chown32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_chroot -{ TARGET_NR_chroot, "chroot" , NULL, print_chroot, NULL }, -#endif #ifdef TARGET_NR_clock_adjtime { TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL }, #endif