From patchwork Fri Aug 4 01:45:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 710216 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:606:b0:129:c516:61db with SMTP id eh6csp233170rwb; Thu, 3 Aug 2023 18:47:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXl7z3JhdP7y4sO+tQYA/MU9EltQSYmC9T285zDPPYfmLHty7EAwpUU0C1qRVoS2Yb/cH4 X-Received: by 2002:a05:622a:15ce:b0:401:e1e7:a2a4 with SMTP id d14-20020a05622a15ce00b00401e1e7a2a4mr664051qty.35.1691113662423; Thu, 03 Aug 2023 18:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691113662; cv=none; d=google.com; s=arc-20160816; b=WMmOpieGTOCGxuXklfxioYYSU6FmyamTF4I5sGW40QHY6L1Yd+VvuLsee44+8Yp1wu uGYkaoxkRJBunoOqFuzJ19jw9NbKMr2NDgWp3P6C1IJ4fyxxs24Fe6U3rqwwmi5RcAcx i6dXLFw0qEcWelY8nuvZWvjJTIVwIRPF4LnmOv3Fct8cIMV1cfQonJOV+wyofulkOpbF GP456yACrQv2HlFGXRxJCxjgkTO8xqmaYJBFbJ9cCsQs5tGicBMlA+d5q/wg1THnT7Hp cfN0lIjfNzDdLkYPQ2zpMHHcaGy6PggIAFl5H2avUFnBuunmM1lZXjpuKGKMd/fhLZgB goWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VNYrY2Waoll+LErzR9Xgbts1EKTxuONltL+p3Yeklu4=; fh=oY0Hqs0mb1Sbw8XbQT7Frqsb6/GXc1LASz4nvWEMVJQ=; b=bepbjg0n78I7FjvJdguklKoyDUxs0/bORYokGV3d1h1hrwaHTLhb4/62pQIScaV3eI 32RQjLvuy4f4i1LJP33RoHLbFBDz/zVAtrNVgbCckt3k6Kl6EGqIfRjHTEkduH49jvEO Tb0C9V+baHIueMSIXHygtvzaMwK7oDsgroqsXkOxB2oWEusU099yNprQx8CbT/3k0dyV CP9BLyQPZ6WshxYdkjKipLKIG2lAMfhkHVYjUwDfj99Xu4Px8wjVcEEurFYsOpQsL3Du sdWoc38hByaTJhhpZh4gerIpOIfYNwJxZYwSKssVlDhthEMRuKiEAkm5oqjm4CxjjAwJ E+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hezjGjvI; 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=pass (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 v13-20020a05622a188d00b00405435d6c52si632294qtc.393.2023.08.03.18.47.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Aug 2023 18:47:42 -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=pass header.i=@linaro.org header.s=google header.b=hezjGjvI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qRjsy-0002jQ-2D; Thu, 03 Aug 2023 21:45:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qRjsc-0002cp-Ch for qemu-devel@nongnu.org; Thu, 03 Aug 2023 21:45:38 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qRjsZ-000596-OF for qemu-devel@nongnu.org; Thu, 03 Aug 2023 21:45:25 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686e0213c0bso1190384b3a.1 for ; Thu, 03 Aug 2023 18:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691113522; x=1691718322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VNYrY2Waoll+LErzR9Xgbts1EKTxuONltL+p3Yeklu4=; b=hezjGjvIUwn7VHvPnCOepORUiXejBF9owFMLMPDqZjEmKd+mZlZvDkYFVnBRdqzirF C1KRCpqdpxAxQQZ55NFTDMtPAbIShopqEUbcwzqZO8qfR5tHtH3hwvSzZioXG8z2cRBS BUjFKelcz05tuJI3VmR5nTOfzrIp1845yJgZKCwo8bZEBz20rHpXPgB4ucVjulqlzZBz PpTUOATIcsLpF3LfBpJMKtws8m7UIKeo6hyHGanEzJOglUZqw+DoYgc7gan4PU8jEeMf hkAVoFNwWcl3q1OK87RI9DbVP3nrum2RoLmIzkN58Q/aZ6NhC4rIcBqZZAN8UFGWnqFM PmlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691113522; x=1691718322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VNYrY2Waoll+LErzR9Xgbts1EKTxuONltL+p3Yeklu4=; b=c9ItJdfNX+/IdnndqINKN9Kn5Bug34xGq9x5wf2e6dqlRbjfnX8cBnu3QYCsaxWTO8 mCv+ECDiaBwhDveFBa2GLMbU0fgTeZTpsfC+NSg2+8E3QYhwsRg/PCfEtENupY3XDXhn cc50n0nWn2tT+29xpsktRfhQcBydfFCPrg3YVWv15DkdGQGBhzsgGhurwKNOrLMBXT2G cYMQt7gtdXo+N+rqikUqxd9IycRjjS18Y3eAQXI71/saFCc2me1ek6tLBZXZ1c6d0gTL UTKdCy3MPdDujTSQ0NWbj148NFW2kdw3Z8i1BGQOx9pCYL0Sx+FX/OirT+YAoDtWQjKb +zbA== X-Gm-Message-State: AOJu0YwMXqKPy8NFfwPWep+yL2AtfUR3T9wkuv2kRnPrr3m/Br1t1KRj UgRg1TvEyqY4lAqU1dLzs0CFTMjzhGL28bcYXzo= X-Received: by 2002:a05:6a00:2301:b0:686:efda:76a2 with SMTP id h1-20020a056a00230100b00686efda76a2mr356858pfh.29.1691113522489; Thu, 03 Aug 2023 18:45:22 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:9d52:4fe8:10ce:5c3]) by smtp.gmail.com with ESMTPSA id c5-20020aa78c05000000b0066f37665a63sm456138pfd.73.2023.08.03.18.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 18:45:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: joel@jms.id.au, akihiko.odaki@daynix.com, laurent@vivier.eu, deller@gmx.de Subject: [PATCH v8 05/17] linux-user: Do nothing if too small brk is specified Date: Thu, 3 Aug 2023 18:45:05 -0700 Message-Id: <20230804014517.6361-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804014517.6361-1-richard.henderson@linaro.org> References: <20230804014517.6361-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 From: Akihiko Odaki Linux 6.4.7 does nothing when a value smaller than the initial brk is specified. Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Reviewed-by: Helge Deller Signed-off-by: Akihiko Odaki Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f64024273f..e1436a3962 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -820,14 +820,14 @@ abi_long do_brk(abi_ulong brk_val) /* brk pointers are always untagged */ - /* return old brk value if brk_val unchanged or zero */ - if (!brk_val || brk_val == target_brk) { + /* return old brk value if brk_val unchanged */ + if (brk_val == target_brk) { return target_brk; } /* do not allow to shrink below initial brk value */ if (brk_val < initial_target_brk) { - brk_val = initial_target_brk; + return target_brk; } new_brk = TARGET_PAGE_ALIGN(brk_val);