From nobody Fri Nov 14 05:15:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1584610145; cv=none; d=zohomail.com; s=zohoarc; b=M6Cq5rPWvS2/qwLqWwKeYR1R5MMMarXhwj1riX01dlSscNiEx3SKiB4Jd9uT7o6vWY0IFep3jieNjBhpZgGLE+v5IfW79okZ1/DC/lYPKzOn9lAtp7CrDhzOlj1+6vUgvewIz6Er9meFQuUKQ28LB28eUa1vzBXdWBl5xkCVV2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584610145; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tfwa9+k4oguKoKRFixWNpUbEhdBEAILlIencBW/kqiQ=; b=U8WMxmY+Ag2mf6Kd/7qTqU8SBzl0yU0ABIKFPC6+MABcoy+IQSnxdVibboHg03N/ns2mhyv+PZI0ZswhaREbasnVy9Zqxzn6lAlmFK2U0/10WdjS76qWsVpm6HnetR3IdUhfQOENgCOOqr2T0+qunwbU0Vb4KUYeG3+dA5pP/44= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584610145831256.05385823268307; Thu, 19 Mar 2020 02:29:05 -0700 (PDT) Received: from localhost ([::1]:35262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jErU8-0001cW-GA for importer@patchew.org; Thu, 19 Mar 2020 05:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40800) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jErRo-0005Cw-Pg for qemu-devel@nongnu.org; Thu, 19 Mar 2020 05:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jErRn-00043Z-Pr for qemu-devel@nongnu.org; Thu, 19 Mar 2020 05:26:40 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:37157) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jErRn-0003zU-H7 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 05:26:39 -0400 Received: from localhost.localdomain ([82.252.135.106]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1McZfZ-1jrDX714V3-00cvwS; Thu, 19 Mar 2020 10:26:36 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL v3 07/16] linux-user: do prlimit selectively Date: Thu, 19 Mar 2020 10:26:18 +0100 Message-Id: <20200319092627.51487-8-laurent@vivier.eu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200319092627.51487-1-laurent@vivier.eu> References: <20200319092627.51487-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:rNWNRgLphq1+tfycTpE6pfTbHrdBb7OgawwDi5sc66TjRBIsEHh cQOxF7RlCXjGUNa1UxxofphRkVUc7NicCDMcNGtDZGLZKmjLfz96f6tqsLqN9XvZ4Bh21JQ ZwGv5D0i4xr1/d1DeQeZjHVbags0OhRB/HBwNACdwVWmC3ECEWLaSO4bWME8Bub9JxA+46q 72oV1py5fEJm/dbisLVKA== X-UI-Out-Filterresults: notjunk:1;V03:K0:KOVr46hHLfw=:Q5ocxgyiKCGl33lpHGkJRF NE+awer5gjCNnPgr7JDRx5l14a5xYkSTadwA5/7yySF0/msUvbxhIIVQ6oPEMoq3npEKnyLuQ g+0PteqzOlej7meneDJXIMG9HitxmTnxQ4yx39WknyWPrA9GpHc67y8h/G2jFg0LvpRCz2BIe EZ2aqWKFOI+85OCDs6zO3VeaixQRNzQ8vn291sjvBmkAFPV/eHIV5egYO0E3hz8MuTffptrdf xoVHASTUxMEPH7TJJ4puyX4WlONP1APxrLR+3+ccwnb9sVviLDl8IImpHnK5r7li5DpX7coRc 6U+ey3vdkrpjUUPNF1SwdyiKoy1dowSA7X2W9WkFYdfjZyDjZixnQLeq7c1tEqgPorTj376gK 0p3UkE/A2TZBydWAu87gYY1kqnoQr5/JRBCzSw0DBpAdqyxWQO938PJw65u+MXL+XUd7/iXKM 3qClhrVVQD9SIoqQqFDKKMexoEkdiyDZrnMlB+nYzJqBZj+neeEOVlXgqk84S532x6Be7CiNT 3xCTlBudkPl1mEKtaVNYyRhgJHuP41XcUt92KOVUTPusFZnABCQZxJZQypAPzmKUG72k0mgvJ k56DwvF6culRd0G5oZ0klXLeozQwAUT1cRkAqlWlQUQIhz6mZoAh+Ti3ytdK9Rz0Wn7J+u7gR OiATUHd0gmpleiaCAoTpuKkDZPWfjXQYslifHV01DR0M7yHzRL5RuUgCRCnyirpJRNVztZgA5 TIchcgx1KIoISAkpzc8G6ERMzXIhCwsV8oEvx/fNRqB/ufSCur2ZbxJLhmrahnMF/TiTFUWYe IhyO1hhE0y7ibzGy0+8Uk2YKP4WrGZEo3+u42g+KSSWZZ6yvxY8M2lPUZjgwSuA2ZFrfNTe X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 =3D 0; int resource =3D target_to_host_resource(arg2); - if (arg3) { + + if (arg3 && (resource !=3D RLIMIT_AS && + resource !=3D RLIMIT_DATA && + resource !=3D RLIMIT_STACK)) { if (!lock_user_struct(VERIFY_READ, target_rnew, arg3, 1)) { return -TARGET_EFAULT; } --=20 2.25.1