From patchwork Thu Aug 3 01:52:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 709585 Delivered-To: patch@linaro.org Received: by 2002:ab3:5b92:0:b0:238:c968:2573 with SMTP id j18csp1354265ltf; Wed, 2 Aug 2023 18:55:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlGavPllXBZfYcxVAXV6xVO47Hs7de6cXYP2LQeQm7KKywB8dqZUz+yJAQDi+kxLHtQvtpPt X-Received: by 2002:ad4:5184:0:b0:626:80f:a05e with SMTP id b4-20020ad45184000000b00626080fa05emr18204373qvp.26.1691027705473; Wed, 02 Aug 2023 18:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691027705; cv=none; d=google.com; s=arc-20160816; b=HdjmXQS+iVJK8bbKTc32L9DIStAqVHEMiXo92oyiihcxtSdkOpKT2PUgElrpMWQJ2m 0S6us9jQ0ahdiYIPhnagAxbstJ5bDSc99DZSmxLNoUT5ss/CO93Oa9piSLEKjIf5xDc5 vRQXh8YONuLwz4HThoijUa/ppC0NZzzHLQ3Gnc9ESr7L6SIQ2MHzf5kdw8vKdQXlUQO0 5Sab1kmsk68/oeaymgvFnPlFd+DA//BmxOhPSeG+DIVxwJUNdPSUq5Up3Gywck0Q5cCl 7UDgc5oa5dWQs0RdlE+KN80/J4q39ZNhxd5VL54wp4f6p2+ayPtuuFta2sp5wKT2kQ/p z1Tg== 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=fmVFRXV+XPDbp8+eafcQB359/x6dDRQDsVzPMZJ0Hao=; b=TirB/rozRu7wubKpXYEJZtf9nh1Dv/jjXqUMi0kBm2b4rX6NUsC0VyHwoXT+mpIMG7 RSjZ12WR4IFER2A+ACFK1knIgdK0Ku/rD7oBnkxGvPA41e4IJsTWMs2Ul01idvW0TuHg apIvhlZ8P6g+OOLd5H8BDNXAcbkHoTRxFHD6RdPMCskVyd5pN2Dfd0tZ48UohOgwOt8x jprN+BpQtyLwBxIm6S5XWGjaxBDJ9gvhCWhYSYUdrcv/kmT+s6r2EtQOlAT2me2Pz6aL XsT3NNc7wYtXyuNLxEz2hLfjNBGDZx9t/FcVRXpO40x+lfYth4vGzm4Xytupka/8CtDD N8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rCbGeD2c; 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 b14-20020a0cf04e000000b0063a2f8b6ce1si9259485qvl.270.2023.08.02.18.55.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Aug 2023 18:55:05 -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=rCbGeD2c; 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 1qRNWc-0000gP-VM; Wed, 02 Aug 2023 21:53:14 -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 1qRNWZ-0000eY-FB for qemu-devel@nongnu.org; Wed, 02 Aug 2023 21:53:11 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qRNWX-0000kj-Nh for qemu-devel@nongnu.org; Wed, 02 Aug 2023 21:53:11 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-686c06b806cso297401b3a.2 for ; Wed, 02 Aug 2023 18:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691027588; x=1691632388; 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=rCbGeD2c0E16GfrYdJuv+93Z3QI+nn23DdOSbwqRoiO9Ms3DCqp2WsHU99QzBBy5pW N/LRlt4Uaicx+IMlo1hm21OJORHK79hCuFEQMVXGp5z5Yx7RSxeL+qvkRY7W2UcxQSI8 acYUfW+d9fez7BMwlHPDr6sbEILvxoe7NExXux/727zc83ezpVPix6Xm+NqZsYEs8l6A sSs9egYqAKWK8USdLXD1YEzQa7H/em2WMdcuyqmwdbbfIwpNuDkI6Qa5iBkMoaFgg/Sd Iiia6ONsaJ5BeIljB5wvHbgxSvvfOfHEDyNqKqr3G2M3OkpoR2nHVzVBl6w+WHCtaVB2 fDwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691027588; x=1691632388; 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=BQqOUIwFDkIZiH9XDCsJigwWMhz6fJfgDd6CiuE0k1ue+H0yZm7w2MdXtD1uzfMofC W7r9kzP8YGxKq2ybKY19Jc2f/ie5Foovy1dFIWiiKIi0vpXFRO6/Xy1cg9tgJ3l6ShgW Y6rfvU41fM3JY844eGa+9jmq1TcEwDcD3NjFaMlcm5G7srHrbIQGrB/1ZTdyuox2vsHk TcRRALn++KlHgpNu7AoHMRGs0v7+HvkzK/goLXT9zqrmwLCNu5QccfsbE1m79WvT9011 CXmZ90VjQwkDi5xBLpgfD1Bvnf/I6rIdrrvUHItbnP8uGM5+CQ+oQpdGe/Rhk01l46pt 5f4w== X-Gm-Message-State: ABy/qLYL+MrkTXhqbLdObsyQzAcwG3xk8rV+ZbkArJ42ulVAdJj+3VWY CfEd9VZx3/2V5TyBSpmNfyrQn8aY6FJ9ugAiYlM= X-Received: by 2002:a05:6a00:2e06:b0:66d:263f:d923 with SMTP id fc6-20020a056a002e0600b0066d263fd923mr20213091pfb.20.1691027588220; Wed, 02 Aug 2023 18:53:08 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:b659:bbad:1a22:7ef9]) by smtp.gmail.com with ESMTPSA id s25-20020a63a319000000b005649cee408fsm157123pge.0.2023.08.02.18.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 18:53:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de, laurent@vivier.eu, akihiko.odaki@daynix.com, joel@jms.id.au Subject: [PATCH v7 05/14] linux-user: Do nothing if too small brk is specified Date: Wed, 2 Aug 2023 18:52:53 -0700 Message-Id: <20230803015302.407219-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803015302.407219-1-richard.henderson@linaro.org> References: <20230803015302.407219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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);