From patchwork Tue Mar 17 15:50:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1256627 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48hdQH6hmcz9sR4 for ; Wed, 18 Mar 2020 03:08:55 +1100 (AEDT) Received: from localhost ([::1]:35612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEElx-0000N7-Ol for incoming@patchwork.ozlabs.org; Tue, 17 Mar 2020 12:08:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36985) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEEVK-0004mZ-Hd for qemu-devel@nongnu.org; Tue, 17 Mar 2020 11:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEEVJ-0007EP-73 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 11:51:42 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:54317) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEEVI-00079j-RX for qemu-devel@nongnu.org; Tue, 17 Mar 2020 11:51:41 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1McY0J-1jqsm43zJN-00d2SH; Tue, 17 Mar 2020 16:51:30 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL v2 07/37] linux-user: do prlimit selectively Date: Tue, 17 Mar 2020 16:50:46 +0100 Message-Id: <20200317155116.1227513-8-laurent@vivier.eu> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200317155116.1227513-1-laurent@vivier.eu> References: <20200317155116.1227513-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:wBTezntg/MGI6bIrWXYV24/VFgMTo/4yH9qxUNAdIuMFnrbVA+b hoKDBk8xoVYGFS+shBZUfImZs3gumy+OZNemHwN2NAwC8raOfvytsyZ0QayUiIz2zoB0vHi r3VDHI8Uzm5YNB8qrWiLgZ9tpDnVwn0mhZBKTtAwUQyoYFVrJQsIfNCXAWcjFn021upODTu nM9puZ38jTtGwqpOH92Sg== X-UI-Out-Filterresults: notjunk:1; V03:K0:3n5A30sRZOk=:q+v60rWe96GsEilf3haQjG 6qQrOgT9GPmTBnr5reBqypx060yAlgRUwiFEHDmM7o8HoMUG5sTtaKpnXEigwJfpxU4aBqtG9 VTBo3xniCrsI0vo/EcZxDX88FutJeRejO+RMtNkCvYowmkzGMxafZeNBBzF9wRHdRmHXa4uFo jyEIxbrW4nNIiU0z8+iY1ZKjKEuYaSX9HqJCnjMhgIrsN1NSJXMDxndEvimd2NXr4oZLdS0jq D9Dp5UV9c36XeMdi3lAiYWDC8AYIXXvs4gMtQUhUKavZ3OFR7omVRcHb4TE3ZtXqP43jjCl8x Z4pX7gE0f+DkIG5J3aAqZiYuyTm3EZii0q5Jh2qwf/caDM59Y16pB8iB0X8+JDuj/ZKAfhiJU BgG2Or24a8KXul7RAVSFB+cBsqNYcYnzk309nlrSMxbUJASCQyW9cj776NjuAzHEXs8X89S22 ouYrlYoZ+oswXqr0ghDmieRexkGG/PFwi4IUlYTU4fbuEPuyOrTV/U5FCRDZoQbnATyk7xW0Q jI6orkiPKlja7aqjXoQYIeXcW17EmNVdqUXYu/9HYvrnoIesMEh7Y9OsbLdlBrqDVpmMbgEvr 6aqv6xYoPrHzJp/plbGxFwW0476M5mFS7YWVkdkhIkjLgJ1f7yQYJIV5zhYZRp4ahqcSn+Pd9 T5mXhH8l7t4HEI7uy03XrHbilXPaKhjFFdG5VqMG8X4T2XXwmobTN3P9mNhLKUO+EmoxrKIJR IyALpdmIThHpMoDHrbM/F9fJQefxB5uOzrhGz8PKBIW+hWQrh2l4cW/Hlo2/pHVqyWnEgduAi CVLIdMGpWY7S2wDkM0Qd8D/UiT3Q2UGAJhBuxZqYHubePCl4k8hnJVAjMBCUEPony9v4Xlf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , Tobias Koch Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Tobias Koch Analogous to what commit 5dfa88f7 did for setrlimit, this commit selectively ignores limits for memory-related resources in prlimit64 calls. This is to prevent too restrictive limits from causing QEMU itself to malfunction. Signed-off-by: Tobias Koch Reviewed-by: Laurent Vivier Message-Id: <20200305202400.27574-1-tobias.koch@nonterra.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 811495c3a0bc..be676c3a4fb4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11904,7 +11904,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, struct target_rlimit64 *target_rnew, *target_rold; struct host_rlimit64 rnew, rold, *rnewp = 0; int resource = target_to_host_resource(arg2); - if (arg3) { + + if (arg3 && (resource != RLIMIT_AS && + resource != RLIMIT_DATA && + resource != RLIMIT_STACK)) { if (!lock_user_struct(VERIFY_READ, target_rnew, arg3, 1)) { return -TARGET_EFAULT; }