From patchwork Mon Jul 17 21:35:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 703728 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp1215147wrt; Mon, 17 Jul 2023 14:36:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlG126Tx7kysx/DpWQafBPY6qBA9IklzJy61HGVlDGYKwAWvtaEa/u8AdtJNVwtyBnI4RkeH X-Received: by 2002:a05:622a:408:b0:403:e853:17c3 with SMTP id n8-20020a05622a040800b00403e85317c3mr7366296qtx.38.1689629788280; Mon, 17 Jul 2023 14:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689629788; cv=none; d=google.com; s=arc-20160816; b=R25QSWiltqei5gpe5HctAT/AXrIGhZ+kFADPodooYjWSDuO4CBlbQ7WzfUDobGK9wF XFMfLi/0I3risuzlfmimRHHTOfQERyyP3pWBKqM7m1R7eOl0H6A6PG2WJm0Kqu2oJ0YB vDhZUBKHaC6Y/7kaAceYwWkYf25QMDXZnOPdMT8sozC9Cc+0YzNIhgKWI4TjELDFsHDp Hpf2lqM/OzadlvTYcPYAmYkt0UqSGo6WNc70lISjVNVC6dMZHpV4EsSIsOUFeREOfr+L 9CcI//ZBdSF9uQfy0Y3acfbJ8N2xwkSVhyVzABewYg7DU4kaVqc5KEKdP9ecHE2zWPE7 j/0Q== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=CkIVAjPbnRqMhnZOipZLpkQ7/XZwRySBWQuizCDexjw=; fh=4fL8SapEQKkcjxcfFvqdaIHM9KgKokvaMHA14gUPc54=; b=mOOc+cC0IxJPZ6WpcGbz4ClAUBvDNvFUmPn6WPVi6GaMbCiBN8wrszSMbw0CSk7QNj tgzO86hmmg+woRGq7+EP5t0XvwWz/AvWFPGic+WlsPAGdBwI0uJ41xSnC+CbEUb4Q8gu DE5KxShNpsZBeUz8VwY4x5tCy7x4KG0vMrhJ8RvUzLL/CJ+eK2VT7RrYXS+ctlPZcikl mCptZi3FtB7KP4Esae09OOzA1ly+OxrryORz+TcN7mUoNfSvq+wY5hSkob+Vx0NibnUf Xo5/h572fyARa3tQVqbifcKW88aUvAtds9eA3WjzXJ9EOAREcxnl/ioVODb2CQeqhgnq n/Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EEz92TuZ; 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 c14-20020ac87d8e000000b004009bab311esi305529qtd.146.2023.07.17.14.36.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jul 2023 14:36:28 -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=EEz92TuZ; 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 1qLVsD-0001xd-4C; Mon, 17 Jul 2023 17:35:17 -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 1qLVs8-0001wx-FX for qemu-devel@nongnu.org; Mon, 17 Jul 2023 17:35:14 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLVs6-0007uU-Sg for qemu-devel@nongnu.org; Mon, 17 Jul 2023 17:35:12 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-316feb137a7so1762003f8f.1 for ; Mon, 17 Jul 2023 14:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689629708; x=1692221708; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CkIVAjPbnRqMhnZOipZLpkQ7/XZwRySBWQuizCDexjw=; b=EEz92TuZ7uARSNHf+Q5K6ajiKQxz3t6P9mXo7/UWOPpZjGfcPAOD5WAfuhvkwy8Ui/ 7e5dI42LsPuQwe5u4ffyq2wwPpgGTK7BHycuwm1S7748KXVr6qz9Lv5HxsQaVXhT7qjK 23G6p21lYQC4fvQb+q4L+CFHosQiIiUFFW9dkwEN4/94wvOEqjLsEYFlKpZ+7Lm0tcX4 OUOSgO8kRZRsItbOKXyMiTSw+GrPI5lJby3TfhhbBWNuTONuSC21bObvan6U9tBIzWZh PVRk1FDP+76xrAYCU1zzjGYF7at5NlkUiHOcONCzhx6O5XwklOB/m2JcnV+cvzOVhNxJ NBeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689629708; x=1692221708; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CkIVAjPbnRqMhnZOipZLpkQ7/XZwRySBWQuizCDexjw=; b=AxsgxBFsEpvWgJw9WzyvpONTVQPNdJtyvbNyqqkyQhB4UGkZ9hUYr3t7Y43Gs+kgO8 i8GcPFVhdxaVR7or5Unx4YaTLsNg2Yn3fO4t2Yn8ZgWhDuXVPV49YB5lho9WneVopu/8 Y1OjvuxttvQHozVE3jugCBShrLeLZK+7GoM7h0nS+Zw9ji93mTpDf+O7SjWtJ9aHlCnX bH0IbfEghbSU+W9OfE4mkgtHEq1MbEV4+lPp2u2CTZK9By6B4mCU5Q3/ehwEQuw8DsZn 49hdO8oUQxJ/LNPvfULjkaTxhhQNuhEvwHgKBbKXkawKy5mY3QkKuG9cS0kS5VsU5VSJ YKag== X-Gm-Message-State: ABy/qLZE+KQqOL4npWRxHHdzDBNNUAvd5Io4kEdSfEoagahPgX9LSn4B J2HoaYrf8lLwKQ7trPvd7d2Tx6V+2yCXOhlHsMo= X-Received: by 2002:a05:6000:114f:b0:316:fb39:e049 with SMTP id d15-20020a056000114f00b00316fb39e049mr5350623wrx.46.1689629708622; Mon, 17 Jul 2023 14:35:08 -0700 (PDT) Received: from localhost.localdomain ([176.176.144.39]) by smtp.gmail.com with ESMTPSA id s3-20020a5d6a83000000b003143801f8d8sm455073wru.103.2023.07.17.14.35.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 17 Jul 2023 14:35:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH for-8.1 v2 0/2] target/mips: Avoid shift by negative number in page_table_walk_refill() Date: Mon, 17 Jul 2023 23:35:02 +0200 Message-Id: <20230717213504.24777-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 This is a respin of Peter's patch, but - pass already-evaluated values to walk_directory() instead of an assert(), - check 'ptew > 1' instead of directory/leaf_shift == -1, - use unsigned type Since v1: walk_directory() doesn't have to rely on the to sanitize the input values. Peter, if you don't see this as an improvement I'll take your original patch. Regards, Phil. Supersedes: <20230717162940.814078-1-peter.maydell@linaro.org> Philippe Mathieu-Daudé (2): target/mips: Pass directory/leaf shift values to walk_directory() target/mips: Avoid shift by negative number in page_table_walk_refill() target/mips/tcg/sysemu/tlb_helper.c | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-)