From patchwork Mon Mar 27 21:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 667411 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1314657wrt; Mon, 27 Mar 2023 14:19:55 -0700 (PDT) X-Google-Smtp-Source: AK7set/9xVIIMeFzL3bsr1YIQa6u2+mmSvOdfEar1jO5lEuOfXSsdiyYGlZFx3MnJb1r0RKN8esa X-Received: by 2002:ac8:58cd:0:b0:3e1:b06d:e9e0 with SMTP id u13-20020ac858cd000000b003e1b06de9e0mr23704337qta.56.1679951995469; Mon, 27 Mar 2023 14:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679951995; cv=none; d=google.com; s=arc-20160816; b=ItBnUXuyKLJQGq8QsJvWbwCzEvi25Dvd7ZTSlmTXDBAFYq0zx+XA2P8G4il3gP6gMF tj8pt4r7jjNFL17nJ6gEzOiurF+yV82vfT7Ckigh640eF7akmnqXxDpCH1Iqvw0rKMYf qYHlQbMIFoKBdV0pj+JI1okH6jYTx1xX9EgNJIGLXWuCRWI2l7W1lTf5poC6MgITb8D1 VSJWyO7o4sov6gCFdYQ27X/m/Dt+6Vq6ueQ9zTKBafFabCSIKMTy32lB7GZ1E1+2tW3b ezIrH9K6j16r9LHqNPJkH8acRMF0PZ3zoK30DRbwMW2j4X5ld6r5vRvCMZZljh3bzAk2 mx6A== 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=d+avOkff6EBvJ8K9x1TsSkw5p9567zBA1o+YX6GdDwE=; b=sCrEN6pHzkc0iTi6bu58WLsdhs2W6UFzVlacUhWM8dDKDgNc+C1WfXCLwfzVkDyWK+ y62h9jo5VDlj0zoa3LRvMKuvvoAdZwtbVvDuMhV22IGq2+uESRaWrt5s91hktENqqHDq o5p9dFz8pw+yhTDeJD88s0yBCIdbDf7NtdrRMCd1uvrJiSmPDqmHBjrFz6410WDeuuQh 0nAaq8enqpKMg4pSaMv6c7CAYExt+P8MSsXnJ4oFHJzjht3NdViYuJAqyjjkEfdw4uU1 bDGYUoLMBbbSUQoxYB3dW298g3dsJieBiNmjwEKBoTkLipnE1UE8tL5lwDD05Uix9Wag xTMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TCzfkKKs; 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 v66-20020a379345000000b007465bacb887si16991508qkd.467.2023.03.27.14.19.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Mar 2023 14:19:55 -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=TCzfkKKs; 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 1pguEf-00044u-Kq; Mon, 27 Mar 2023 17:18:37 -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 1pguEc-000433-Id for qemu-devel@nongnu.org; Mon, 27 Mar 2023 17:18:34 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pguEY-0005vY-Fj for qemu-devel@nongnu.org; Mon, 27 Mar 2023 17:18:33 -0400 Received: by mail-pj1-x1035.google.com with SMTP id r7-20020a17090b050700b002404be7920aso9130837pjz.5 for ; Mon, 27 Mar 2023 14:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679951909; 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=d+avOkff6EBvJ8K9x1TsSkw5p9567zBA1o+YX6GdDwE=; b=TCzfkKKs10VF3min8GWMfhC1dbK/MvRK57QxVGTJFEDSxd5JdNRX5DoRmEUQYyCV24 nbDUcPn1jmaDiqTyEd6QC4C6akTJd7s7juXn2UaPZazniydFDM1YKpCfHIePJvc/ljLN l0XSfJFHFUVhba+XBmkHB9YlR2AOfHLnF5axMQ6uAvwdbjIFv3Ude9hkyORWnao8qSCw 8zSsRK121GyM+/jpQx+++Bc+e+5nGjNzNXpmy0bsFgX+6+Uuc9uTAQnnktI93XJr0K93 vn3GnPMtakYuJOEE6X9aC5dCYnfeP9kiFAqbbiyzB274joMWaU1a6AELES+A09vwvPg3 Nukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679951909; 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=d+avOkff6EBvJ8K9x1TsSkw5p9567zBA1o+YX6GdDwE=; b=pBinLOhmG146CnL111v5tRqCK4s+gn4BDpMqVSoFySOhrRwi1YQe/YV8qCWJFNU/il 4KJ2ZGxx8346C9RTteAVgEOSYBa5yogT3WnaQmech0bpG2+fumNc0Q5l6/TulwtnOosJ gJ4j4SZmAREBdBKNglImWYc+t1nLId+oKQleZQXeNSMEhsP8YRsipKWgyAVwWBwD/8XS bHVneYc5bK5I1zfO1L5mFA+Ih07E0SRMDZexuhVRMdAmJ1Dlzpc5xHNFl7JIAItu3pIo UIYNINQUExuO91SCq63UXIO9GtC6TLjFcpzmvc9BvMf4dA4wLQB9YXcNJ58UFZLSzv90 E5xQ== X-Gm-Message-State: AAQBX9e5S/x9fOcT8HEy+bqdBrZoJP+xOQUqz1LC2R6RL/Sn2w973ZDQ SudbiuvII0yS5u5Zu9POTRttvykp34BEKbdIX+8= X-Received: by 2002:a17:90b:1e01:b0:23f:b35b:7789 with SMTP id pg1-20020a17090b1e0100b0023fb35b7789mr14505680pjb.28.1679951908770; Mon, 27 Mar 2023 14:18:28 -0700 (PDT) Received: from stoup.. ([2602:ae:1544:6601:6705:aa17:3641:e634]) by smtp.gmail.com with ESMTPSA id d2-20020a17090a6f0200b0023440af7aafsm7902708pjk.9.2023.03.27.14.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 14:18:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH for-8.0 v2 03/12] linux-user: Diagnose misaligned -R size Date: Mon, 27 Mar 2023 14:18:15 -0700 Message-Id: <20230327211824.1785547-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230327211824.1785547-1-richard.henderson@linaro.org> References: <20230327211824.1785547-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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 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 We have been enforcing host page alignment for the non-R fallback of MAX_RESERVED_VA, but failing to enforce for -R. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/main.c b/linux-user/main.c index 4b18461969..39d9bd4d7a 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -793,6 +793,12 @@ int main(int argc, char **argv, char **envp) */ max_reserved_va = MAX_RESERVED_VA(cpu); if (reserved_va != 0) { + if (reserved_va % qemu_host_page_size) { + char *s = size_to_str(qemu_host_page_size); + fprintf(stderr, "Reserved virtual address not aligned mod %s\n", s); + g_free(s); + exit(EXIT_FAILURE); + } if (max_reserved_va && reserved_va > max_reserved_va) { fprintf(stderr, "Reserved virtual address too big\n"); exit(EXIT_FAILURE);