Message ID | 20230829170240.765996-2-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp91331wrh; Tue, 29 Aug 2023 10:03:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlLu3/UnKHvIlggjhQXtgFEjk6WeUqcFyeemJsy04XLpAPJ6udC5G6L1uG5kYNNZS6LZhw X-Received: by 2002:a05:620a:12c3:b0:76f:338:27a2 with SMTP id e3-20020a05620a12c300b0076f033827a2mr10000405qkl.32.1693328599842; Tue, 29 Aug 2023 10:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693328599; cv=none; d=google.com; s=arc-20160816; b=Yeq29/D/l+IabzI+vYduG0E7y2DRo7b8UNJZkF7tIhJjD69TzxdXhm5buz4lN30MTz 4Ry7cVEcvrqQUdWz0eXV1ye+T3gm40QdTVPVYpn9a1SjiI0rwfOVcbH2E+xWd76bOrMb vtGV2g6TStUsr8lDIrOksINW4SdWcjxLe0yL02kYIqQv6H/cSchtQjgpEQnq6zmcWCBw rM6zx4AfHL1jzfBdA3oWiAWgUkF4PtgGWdxwYMA6noPR530XsLhqDocmu+VvipTz9al9 oqnmfya5u9LdzyDcTNYjm1u+VjaXwDhSYSHWowhAVqeXArBX3GSh7iK+hCKwd8mVAKoD R/bQ== 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=QnrxmU92gMsHZeEkHAnmV6nr411dlIcO/EX0lMM85aLS19lSWaYa/d6gOju01YPnp3 rUXYNyea0uaHcXqVCocvDpfj9MsBtIlYdMKoUGNyiAFWy0FX1G21PBTtXKrXp8OjzPZS VOaCgK8hP0YpVyqyvOUuP6l+DQO1If/0+0hllyYdNENv1PqTxO0kpVyRxHHVxk5ZWz5W ZAgPxpuSZQSmrercyrI4rp5wnuAfCnhi6RjmDlfg7Ew1PHDx8lQwWXNjhzIm0eIDKJIB Ncf76YyZ7axhzwDhdJ8Moh+PrULzHVKBy/zQG7IyX+CBBtlsqv2lgeIVoMzOMhI2eBgh 8fMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMPFPl5a; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w7-20020a05622a134700b0041215aa1b15si5339058qtk.793.2023.08.29.10.03.19 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 10:03:19 -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=AMPFPl5a; 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 <qemu-devel-bounces@nongnu.org>) id 1qb27J-0002Zb-8S; Tue, 29 Aug 2023 13:03:01 -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 <richard.henderson@linaro.org>) id 1qb278-0002Sx-2l for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:52 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1qb272-00051N-I1 for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:46 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1bdb7b0c8afso28366965ad.3 for <qemu-devel@nongnu.org>; Tue, 29 Aug 2023 10:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693328562; x=1693933362; 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; b=AMPFPl5aZoJvEyneJbMUO5oOVau75/4U7nXf+Z/UTSTYLn8WOBXz0/VsmI3YgpO7Hl pc5OEO5uyFbbruIJS9kQqCbVaMG5dSDMywG0W8SwhPezivuO1TLH2LWpFEs+2kigs3XG ABNxwLSm3omtqiISEUCzh3BGzz+uwH+MGqtNungd0YXNA2ebc3U5UzRrfTtGpWReif0h fEkS8ZGa3QawjS3VrvtDSxveqsDUDN5jhy4+kaFxUcUcHxrRlZ7MlSPUVISAVMK7X2WV qOnZW5ReHaISNs1cZOHlM3dHvWhs7f7Nm7pToubd1J0I1lutZvfNa/O124CJ9N7bsx/L ZClw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328562; x=1693933362; 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; b=dNve8gWv4I1MCdq47xu3MadWjerKMUCvQ8uURIL4lsYvBUaOGFIgS9Yr1mnZBW4jaF S23zpzPoeVldIi6oDVrnnaFD1pWRxvP5aUDVhZcC9cBdiRJtdHgU1r37gRUvDG3AbyFg aP3bYxoee4Mw4qGVXAAqoVA6G9z3KC8Hk62R+W0gfzt24oWQG+jDdT9wJm+PRlIwLRlS XQ20k2M+7Bz1ndL//Prw4QwXl7iSlEiRokQP16s+Sd4LMb6UtoYSA5k/2iK3+XGV8h+b kvefIAgL4gXNfQKuMn4YRqsbfIMHFHOnna0VZFLO2IeyN78g1eU3+nKHVA9ahJZUutDp Cjgg== X-Gm-Message-State: AOJu0YycSKHVq6mpbXsDgtL4Y2p94QblPFMgnJJYqaY1pN+ceIDSMkgH 9MvVdZyUHi7KLAjnoxehjOdJkDvbRsuxZNDGL1k= X-Received: by 2002:a17:90a:cb02:b0:25e:d727:6fb4 with SMTP id z2-20020a17090acb0200b0025ed7276fb4mr23520014pjt.2.1693328562484; Tue, 29 Aug 2023 10:02:42 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id cv2-20020a17090afd0200b00267b7c5d232sm10989645pjb.48.2023.08.29.10.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 10:02:42 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> Subject: [PULL 1/4] softmmu: Assert data in bounds in iotlb_to_section Date: Tue, 29 Aug 2023 10:02:37 -0700 Message-Id: <20230829170240.765996-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829170240.765996-1-richard.henderson@linaro.org> References: <20230829170240.765996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
[PULL,1/4] softmmu: Assert data in bounds in iotlb_to_section
|
expand
|
diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 3df73542e1..7597dc1c39 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2413,9 +2413,15 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu, int asidx = cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx]; AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch); - MemoryRegionSection *sections = d->map.sections; + int section_index = index & ~TARGET_PAGE_MASK; + MemoryRegionSection *ret; - return §ions[index & ~TARGET_PAGE_MASK]; + assert(section_index < d->map.sections_nb); + ret = d->map.sections + section_index; + assert(ret->mr); + assert(ret->mr->ops); + + return ret; } static void io_mem_init(void)