From nobody Mon Feb 9 23:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529375378787653.0659564017172; Mon, 18 Jun 2018 19:29:38 -0700 (PDT) Received: from localhost ([::1]:38633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6Oo-0001hI-4M for importer@patchew.org; Mon, 18 Jun 2018 22:29:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5hr-0001SH-Tl for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5hr-0008Lq-2e for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:15 -0400 Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]:43938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5hq-0008LR-UZ; Mon, 18 Jun 2018 21:45:15 -0400 Received: by mail-oi0-x235.google.com with SMTP id t133-v6so16695364oif.10; Mon, 18 Jun 2018 18:45:14 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id b4-v6sm7199667otf.79.2018.06.18.18.45.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RFRfs+e+5HIlKSdEH+KaNnrDTCCndMdD1Qd832KxdSs=; b=quLfbyN/Y1MTlmRNYyFAYZGSSnXF6HJY0uodD2tWUEr51tf3cM2zXC1mQfM1TatBEL 0WHYEOzlvaIT9bvhK2urygea1/sOcWJlvm+CpJouiKSN/TdsETY5T/lL8rrDDNDZr/w2 YZMYSbEKhI7kYnaUtecxcJhJgzksOaHbC3WoexpGHbu/NCCc3BR9JIY89GYbNatkqqPo rGrsyZtmQ0gXhLjWcT9WyUzhfMz1szBouzVGc/VfMbfreBVY9+jjPttj/veXXM1BH3oN wQJpIsDTUgNe9Nr4/4Ogsff5J3Uo25WbiSnzz0NpnvDU37GTL0827uz7CxoHkSPsBdVT 9lbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=RFRfs+e+5HIlKSdEH+KaNnrDTCCndMdD1Qd832KxdSs=; b=l4Dp2JcQ343GRI3+fOAwHrYZqun/jyrhuf/5dEirbpqroOPTeQsIwsKL7elEjqVxGU NkoMhq6o/kif0tfDPJpmNPQh3qcpCAwGpBTjoxcZgA8wBKIEGlMVEPRUi9t0rTA05npv SiJm5cgJjOFT85vKLCK0D3OEQcVh/nWRD0KbgRaC7jPn4YbWgfw58OYC4EX+oa/M8Kio CScU3ky2BZC2TQAK52t85U24UeWHMEGQ6XI/YAfv0kh5jnJpxWA3+h3645IHSffv+nB5 BnDTxJnzBB8OxKh8szlJ6fdV2/vw2YWo+KSPNOsK2KEr50vqndcsumwsD9DFfGCoGo+a zyFw== X-Gm-Message-State: APt69E0Mx4MOEWT6rIxwLjdnRb7TJ5jXwbKa3RBWrp/VmAoBFu4AisLt cI2HPESKcpQX4r0e5T4tWSbgrlHG X-Google-Smtp-Source: ADUXVKKO7rfBvrxU/5wLerylo9GsLAOiPqDT0iYIUY6RO0MMp25JJrRhXb6qHbD/qFyETE9ZUtXuuw== X-Received: by 2002:aca:52cb:: with SMTP id g194-v6mr6297797oib.241.1529372713733; Mon, 18 Jun 2018 18:45:13 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:41:58 -0500 Message-Id: <20180619014319.28272-33-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::235 Subject: [Qemu-devel] [PATCH 032/113] address_space_map: address_space_to_flatview needs RCU lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini address_space_map is calling address_space_to_flatview but it can be called outside the RCU lock. The function itself is calling rcu_read_lock/rcu_read_unlock, just in the wrong place, so the fix is easy. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Paolo Bonzini (cherry picked from commit ad0c60fa572d4050255b698ecdb67294dd4c0125) Signed-off-by: Michael Roth --- exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 7c4fb68368..e30155c113 100644 --- a/exec.c +++ b/exec.c @@ -3395,7 +3395,7 @@ void *address_space_map(AddressSpace *as, hwaddr l, xlat; MemoryRegion *mr; void *ptr; - FlatView *fv =3D address_space_to_flatview(as); + FlatView *fv; =20 if (len =3D=3D 0) { return NULL; @@ -3403,6 +3403,7 @@ void *address_space_map(AddressSpace *as, =20 l =3D len; rcu_read_lock(); + fv =3D address_space_to_flatview(as); mr =3D flatview_translate(fv, addr, &xlat, &l, is_write); =20 if (!memory_access_is_direct(mr, is_write)) { --=20 2.11.0