From nobody Sat Feb 7 05:54:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592291134; cv=none; d=zohomail.com; s=zohoarc; b=YInSqsYkGPwIrBDkPF0myFPFAr0PnpfEUu+CfXgfAA9C4cq50sXLThGF7r+qvPXXV2Aiy35i+QDozYtPVB+2qPHdQurWmaMYIZ0EBFPTN4de4OjvMjBPwyLJZpRLAcoMlZHdfiPSsrj1FtM3/pkevmMBcb0dc5/AemgT1xKdT4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592291134; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7+O77/1VoIy5ZmKPNfruC/I0o10kheFBwNmfaZ48ahQ=; b=IKW67hvT0SIDF8Ma63v7fKWxvgJSw580IbArB5gatWSNyZ7F/faXftdz0KBT9ksuiHLk8FIEqFLSzh0ZFZYbrcM3ZwdaCSYDYMd+oo6N0NcYNm42xeEHMqgsoOtV5jZ5GQnJECwMhM6XIR/ZQ3Smjps5eACGTvU6Vo7m6UziBwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592291134569674.4521634723541; Tue, 16 Jun 2020 00:05:34 -0700 (PDT) Received: from localhost ([::1]:53650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jl5f3-0005xQ-8J for importer@patchew.org; Tue, 16 Jun 2020 03:05:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jl5NE-0002Sf-NQ for qemu-devel@nongnu.org; Tue, 16 Jun 2020 02:47:08 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:34096 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jl5NC-0005pv-SI for qemu-devel@nongnu.org; Tue, 16 Jun 2020 02:47:08 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-BpUU166TNLGiW5zzvbSN7g-1; Tue, 16 Jun 2020 02:47:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F68B184D179; Tue, 16 Jun 2020 06:47:03 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-13-222.pek2.redhat.com [10.72.13.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BD0A90345; Tue, 16 Jun 2020 06:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592290026; 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=7+O77/1VoIy5ZmKPNfruC/I0o10kheFBwNmfaZ48ahQ=; b=Hht22yIgQl8z0PR1TWGERaVpdpezt6SZH9zjMGFovnrCa+AHD7vdZ63r4pVvtYN6pDkJ0u ci1sX7nCQgF+QDaekMGSfQRNr76qIzJ7Akh6rGZ+GKN1MRJYoipHO6qOVBkbIDwzKzrGvl XM1uyci7SCb5FsYKgIHSG9mm0EPwqGA= X-MC-Unique: BpUU166TNLGiW5zzvbSN7g-1 From: Jason Wang To: peter.maydell@linaro.org Subject: [PULL 31/33] hw/net/e1000e: Do not abort() on invalid PSRCTL register value Date: Tue, 16 Jun 2020 14:45:42 +0800 Message-Id: <1592289944-13727-32-git-send-email-jasowang@redhat.com> In-Reply-To: <1592289944-13727-1-git-send-email-jasowang@redhat.com> References: <1592289944-13727-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 02:45:57 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Jason Wang , qemu-stable@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 libFuzzer found using 'qemu-system-i386 -M q35': qemu: hardware error: e1000e: PSRCTL.BSIZE0 cannot be zero CPU #0: EAX=3D00000000 EBX=3D00000000 ECX=3D00000000 EDX=3D00000663 ESI=3D00000000 EDI=3D00000000 EBP=3D00000000 ESP=3D00000000 EIP=3D0000fff0 EFL=3D00000002 [-------] CPL=3D0 II=3D0 A20=3D1 SMM=3D0 HLT= =3D0 ES =3D0000 00000000 0000ffff 00009300 CS =3Df000 ffff0000 0000ffff 00009b00 SS =3D0000 00000000 0000ffff 00009300 DS =3D0000 00000000 0000ffff 00009300 FS =3D0000 00000000 0000ffff 00009300 GS =3D0000 00000000 0000ffff 00009300 LDT=3D0000 00000000 0000ffff 00008200 TR =3D0000 00000000 0000ffff 00008b00 GDT=3D 00000000 0000ffff IDT=3D 00000000 0000ffff CR0=3D60000010 CR2=3D00000000 CR3=3D00000000 CR4=3D00000000 DR0=3D00000000 DR1=3D00000000 DR2=3D00000000 DR3=3D00000000 DR6=3Dffff0ff0 DR7=3D00000400 EFER=3D0000000000000000 FCW=3D037f FSW=3D0000 [ST=3D0] FTW=3D00 MXCSR=3D00001f80 FPR0=3D0000000000000000 0000 FPR1=3D0000000000000000 0000 FPR2=3D0000000000000000 0000 FPR3=3D0000000000000000 0000 FPR4=3D0000000000000000 0000 FPR5=3D0000000000000000 0000 FPR6=3D0000000000000000 0000 FPR7=3D0000000000000000 0000 XMM00=3D00000000000000000000000000000000 XMM01=3D00000000000000000000000000= 000000 XMM02=3D00000000000000000000000000000000 XMM03=3D00000000000000000000000000= 000000 XMM04=3D00000000000000000000000000000000 XMM05=3D00000000000000000000000000= 000000 XMM06=3D00000000000000000000000000000000 XMM07=3D00000000000000000000000000= 000000 =3D=3D1988=3D=3D ERROR: libFuzzer: deadly signal #6 0x7fae4d3ea894 in __GI_abort (/lib64/libc.so.6+0x22894) #7 0x563f4cc59a1d in hw_error (qemu-fuzz-i386+0xe8ca1d) #8 0x563f4d7c93f2 in e1000e_set_psrctl (qemu-fuzz-i386+0x19fc3f2) #9 0x563f4d7b798f in e1000e_core_write (qemu-fuzz-i386+0x19ea98f) #10 0x563f4d7afc46 in e1000e_mmio_write (qemu-fuzz-i386+0x19e2c46) #11 0x563f4cc9a0a7 in memory_region_write_accessor (qemu-fuzz-i386+0xec= d0a7) #12 0x563f4cc99c13 in access_with_adjusted_size (qemu-fuzz-i386+0xeccc1= 3) #13 0x563f4cc987b4 in memory_region_dispatch_write (qemu-fuzz-i386+0xec= b7b4) It simply sent the following 2 I/O command to the e1000e PCI BAR #2 I/O region: writew 0x0100 0x0c00 # RCTL =3D E1000_RCTL_DTYP_MASK writeb 0x2170 0x00 # PSRCTL =3D 0 2813 static void 2814 e1000e_set_psrctl(E1000ECore *core, int index, uint32_t val) 2815 { 2816 if (core->mac[RCTL] & E1000_RCTL_DTYP_MASK) { 2817 2818 if ((val & E1000_PSRCTL_BSIZE0_MASK) =3D=3D 0) { 2819 hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero"); 2820 } Instead of calling hw_error() which abort the process (it is meant for CPU fatal error condition, not for device logging), log the invalid request with qemu_log_mask(LOG_GUEST_ERROR) and return, ignoring the request. Cc: qemu-stable@nongnu.org Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/e1000e_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index d567687..bcd186c 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -34,9 +34,9 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/log.h" #include "net/net.h" #include "net/tap.h" -#include "hw/hw.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "sysemu/runstate.h" @@ -2816,11 +2816,15 @@ e1000e_set_psrctl(E1000ECore *core, int index, uint= 32_t val) if (core->mac[RCTL] & E1000_RCTL_DTYP_MASK) { =20 if ((val & E1000_PSRCTL_BSIZE0_MASK) =3D=3D 0) { - hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero"); + qemu_log_mask(LOG_GUEST_ERROR, + "e1000e: PSRCTL.BSIZE0 cannot be zero"); + return; } =20 if ((val & E1000_PSRCTL_BSIZE1_MASK) =3D=3D 0) { - hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero"); + qemu_log_mask(LOG_GUEST_ERROR, + "e1000e: PSRCTL.BSIZE1 cannot be zero"); + return; } } =20 --=20 2.5.0