From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F1C9C48BE5 for ; Mon, 21 Jun 2021 07:22:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D7C2610CA for ; Mon, 21 Jun 2021 07:22:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D7C2610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvEG1-0000uE-7u for qemu-devel@archiver.kernel.org; Mon, 21 Jun 2021 03:22:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvEES-00006A-M3 for qemu-devel@nongnu.org; Mon, 21 Jun 2021 03:20:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvEEP-00059I-Nv for qemu-devel@nongnu.org; Mon, 21 Jun 2021 03:20:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624260025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vsXUSK6ZD4Fee1nNz6aLER3jhcLjEILpG4euEHcmUY0=; b=T+p46OO2f+Mh/+PNYOUaxqQFl/7JtyZsDNTQlVDy1uvAGcPIK2vFibk/CxjuhBy644xRSu bvV5F3rW7F+yiRpldDcgPrgpriwNKKytRlaEr+ps+384ZlqSZIkInhkQmxcNN+0gqu8I+c 5yc0WXk7RPrGzE2yHjAkBcWUdz0pN34= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-WuwUOZYdO8eJ8DhD6Sro_w-1; Mon, 21 Jun 2021 03:20:22 -0400 X-MC-Unique: WuwUOZYdO8eJ8DhD6Sro_w-1 Received: by mail-pg1-f198.google.com with SMTP id t28-20020a63461c0000b0290221e90ef795so11298065pga.6 for ; Mon, 21 Jun 2021 00:20:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=vsXUSK6ZD4Fee1nNz6aLER3jhcLjEILpG4euEHcmUY0=; b=aKb2RT0xtGtU98C5TiXQUg8rbe/08tlKTbb04DucvxEAHx07Yk2kdYZqsW1Xa2WR3G twxeiqPn43h2ltHNBfh/VwiF2zrjkuXuK3K6PKhsl0RzGKFAwl6PaS3m/JW6+u+eiAI4 7lJAlyp2PVFaytgj3k7gdLyccgLygS5zWhPm6dbDHEBrHFy9YvRvW/9Tshjil5NRHlmt cA7POnOT6LiBiMucbHQaR+oWB6SIUiPdDD+My7SJCykAPBpfy/i1tfu+LooE33GKIAH2 hJbER2V9sCvBAGsUXua1dW3Slnxn5LeEJgchb5oR3KpnisusEqdzzwXA3GCrB4rxT+QK 3MXQ== X-Gm-Message-State: AOAM533XyW7xnpcLQjsGwY+Bar5Z04tfUZ9/oJq0+5n5RoMbVTXLGjrB 7c7REYrZrrMry389ibBFzVCmX1hnr0HnZY/FXfNhNLq66iyWU7kghImOx2WCWfRTBxkTQuw36HN MUOoqdSbYMxQ7M6U= X-Received: by 2002:a63:2503:: with SMTP id l3mr5514635pgl.237.1624260021810; Mon, 21 Jun 2021 00:20:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpzISdRRDkzKzZcGV1vyGwNT1mAuCWdaQeH8obTbujSecUlti53hAKXfeVsaqKM7149aaFug== X-Received: by 2002:a63:2503:: with SMTP id l3mr5514622pgl.237.1624260021583; Mon, 21 Jun 2021 00:20:21 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id g5sm8711666pfb.191.2021.06.21.00.20.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 00:20:21 -0700 (PDT) Subject: Re: [PATCH 09/15] hw/net/e1000e: Fix impl.min_access_size To: Richard Henderson , qemu-devel@nongnu.org References: <20210619172626.875885-1-richard.henderson@linaro.org> <20210619172626.875885-10-richard.henderson@linaro.org> From: Jason Wang Message-ID: Date: Mon, 21 Jun 2021 15:20:15 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210619172626.875885-10-richard.henderson@linaro.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=216.205.24.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.299, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: alex.bennee@linaro.org, pbonzini@redhat.com, Dmitry Fleytman , mark.cave-ayland@ilande.co.uk, f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 在 2021/6/20 上午1:26, Richard Henderson 写道: > There are certainly architectural 2 byte writes, as evidenced > by the e1000e_set_16bit function. I also saw a 1 byte write, > though that may have been the fuzzer. > > Cc: Jason Wang > Cc: Dmitry Fleytman > Signed-off-by: Richard Henderson > --- > hw/net/e1000e.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c > index ea3347fbb4..ad73e39ebc 100644 > --- a/hw/net/e1000e.c > +++ b/hw/net/e1000e.c > @@ -185,7 +185,7 @@ static const MemoryRegionOps mmio_ops = { > .write = e1000e_mmio_write, > .endianness = DEVICE_LITTLE_ENDIAN, > .impl = { > - .min_access_size = 4, > + .min_access_size = 1, I'm not sure this can work. Looks like at least e1000e_get_reg_index_with_offset() was wrote with the assumption that min_access_size is 4: static inline uint16_t e1000e_get_reg_index_with_offset(const uint16_t *mac_reg_access, hwaddr addr) {     uint16_t index = (addr & 0x1ffff) >> 2;     return index + (mac_reg_access[index] & 0xfffe); } Thanks > .max_access_size = 4, > }, > }; > @@ -195,7 +195,7 @@ static const MemoryRegionOps io_ops = { > .write = e1000e_io_write, > .endianness = DEVICE_LITTLE_ENDIAN, > .impl = { > - .min_access_size = 4, > + .min_access_size = 1, > .max_access_size = 4, > }, > };