From patchwork Wed Oct 13 18:22:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515733 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp119652ime; Wed, 13 Oct 2021 11:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrQjZUNDw+y5lUqHy5rCJPnJaNpB80erdLSiNYa9cWuI4h8iUithR2hAVLWtW92OiTVUOS X-Received: by 2002:a37:34a:: with SMTP id 71mr769918qkd.242.1634149468703; Wed, 13 Oct 2021 11:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634149468; cv=none; d=google.com; s=arc-20160816; b=KgqlVLg/Cvoppxx8Nry2JiGFWgZ2U4x+extN4IVQBxC2WRfwqWJhGoZnagiqFlfO4i 48qDtut7wUDmHr58kzYXoxW+ORIP0eth/cZ+e6SsUfcQfCYwq7MAzPIs8nI1GDjbDTmk JSxAlOwHBNQVasdLTWs4jHxstv84v+BdA+hx99xSxqi6Q1VDExQdkVoFXePOLCyFuzc4 Lujbll++LfX5LlnoeHS0YTOLQHT7D3qpwQAJk+HbNJPM/oBLZO3WrKSZhARm37IFhIeA 6Bxvofk1lUfKgtwIqS++iG0pcjjyJjXcfEu15ivDumLi4ukEyLjIiP2DFXzLsmaWHlw4 bDMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=OcQ/8dg+uyCnQNjoef3iDXLc5D161p75+kxjS6wsxRk=; b=WwqomSe04AViB6Gr8NgcZQrQ7+fcLEA1ntDU7ZLFzo4Z4QEdUeQo9xej5Yu1Fd+bZ7 U3zAoPgEgTmEl7RdwBE25folbmeK22iyhluAfjR+C6MnMLY6F+tbs+BSAIxU4joYzjIf HXEziEm9mqTNm8F+qpnrIhSAjCyghZM4NoY4ok2T/vnBf28Rop6wDaCBozTaQA1Mpc+6 Ds+oFcfT9zX03SnRQ0OpSk0TTymOQUNkfYwtBdyGu56FsFUZZxR2lHI2bAFBXua2q9o/ swnlsizLIL+fOn+OYHheEfHO+F/YX8Dxt6KuGi27+ccC469zsM8msaPjpI6ibAGuBfKV HNbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CVuXOrOq; 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=fail (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 s20si158819qve.223.2021.10.13.11.24.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Oct 2021 11:24: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=fail header.i=@linaro.org header.s=google header.b=CVuXOrOq; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maivU-0003dE-6x for patch@linaro.org; Wed, 13 Oct 2021 14:24:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maitq-0003bd-10 for qemu-devel@nongnu.org; Wed, 13 Oct 2021 14:22:46 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:39647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maito-0002y0-Ea for qemu-devel@nongnu.org; Wed, 13 Oct 2021 14:22:45 -0400 Received: by mail-pj1-x102d.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso5061926pjb.4 for ; Wed, 13 Oct 2021 11:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OcQ/8dg+uyCnQNjoef3iDXLc5D161p75+kxjS6wsxRk=; b=CVuXOrOqNEEerpD7YUjAQB/oP8P7/+YUHVk4TPZD7rGBqIbMRRwYxqkVOhFrKYKTXm 4+dg0QO3G/iGPMlGM7u4KqrOl3oWHvC1mZYXBAu9CG8hh9CQdmAQOu1hP2mBR87IJ2Nk Qp+Hajm1O5XGKBPtNwLGYG/V7NC5vginvA/0Wthjs4fJla/slr2qtcu6Sddim7fL913f Ke5axfKFpWBzSdvwQucU0aWONvrpzVa9sinYy3lJVQq79I96GLmv0WK4cBOFCTP4gYeH tNuT1qUvD+M32HJgr9FGY+kE2Bh57FdMdOTAkh8wRvZ+Zd4t3sxKtHIOJxTgU4JUPk7h iEdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OcQ/8dg+uyCnQNjoef3iDXLc5D161p75+kxjS6wsxRk=; b=4JmJDr2zvf3bgfIflOpTyhFnz4/tOmjdGum5sfaoeXhWaRVBxy6oDjWTXuUgeqAlzB gQpklTF/NYYwflTqsmla7o8SMdwyXqm5dz1GfRgoe2jKVdoOTxP1sA3FQ8zH4IElQFZM B7DMwzCXKpxlQGgNtccdPh8xcmJfd/tRHDz5Jowx1bRO1QbQSg34tgUHAizriEIFrLIv LeNIAR5Y+VAk9fPDA/deRz93VxamBf9aSv6OarnKMXHwGJ5AbCOts42i9DnrJr+0S8kp qhcrPOsTaNzj2YxeL7Mxca9B68P/V0v1XbVg4t9OOKffD0aqePbT9vQo0aLMok12OI5a ycVQ== X-Gm-Message-State: AOAM531EYcfBYblzCnFhWEvxqAqQ4sKFRefvhTmoxptojqMVM5e3nXlb Lk8zwqO2oFmdaiZJsN7RxEX0CfoW9L/3/Q== X-Received: by 2002:a17:90b:4ac9:: with SMTP id mh9mr873392pjb.173.1634149362930; Wed, 13 Oct 2021 11:22:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id z2sm177140pfe.210.2021.10.13.11.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 11:22:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/15] memory: Log access direction for invalid accesses Date: Wed, 13 Oct 2021 11:22:25 -0700 Message-Id: <20211013182239.991127-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013182239.991127-1-richard.henderson@linaro.org> References: <20211013182239.991127-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan In memory_region_access_valid() invalid accesses are logged to help debugging but the log message does not say if it was a read or write. Log that too to better identify the access causing the problem. Reviewed-by: David Hildenbrand Signed-off-by: BALATON Zoltan Message-Id: <20211011173616.F1DE0756022@zero.eik.bme.hu> Signed-off-by: Richard Henderson --- softmmu/memory.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/softmmu/memory.c b/softmmu/memory.c index db182e5d3d..e5826faa0c 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1378,17 +1378,17 @@ bool memory_region_access_valid(MemoryRegion *mr, { if (mr->ops->valid.accepts && !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) { - qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr " - "0x%" HWADDR_PRIX ", size %u, " - "region '%s', reason: rejected\n", + qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX + ", size %u, region '%s', reason: rejected\n", + is_write ? "write" : "read", addr, size, memory_region_name(mr)); return false; } if (!mr->ops->valid.unaligned && (addr & (size - 1))) { - qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr " - "0x%" HWADDR_PRIX ", size %u, " - "region '%s', reason: unaligned\n", + qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX + ", size %u, region '%s', reason: unaligned\n", + is_write ? "write" : "read", addr, size, memory_region_name(mr)); return false; } @@ -1400,10 +1400,10 @@ bool memory_region_access_valid(MemoryRegion *mr, if (size > mr->ops->valid.max_access_size || size < mr->ops->valid.min_access_size) { - qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr " - "0x%" HWADDR_PRIX ", size %u, " - "region '%s', reason: invalid size " - "(min:%u max:%u)\n", + qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX + ", size %u, region '%s', reason: invalid size " + "(min:%u max:%u)\n", + is_write ? "write" : "read", addr, size, memory_region_name(mr), mr->ops->valid.min_access_size, mr->ops->valid.max_access_size);