From nobody Wed Apr 06 08:01:31 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E48921A99555 for ; Wed, 6 Apr 2022 08:01:47 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-21.consmr.mail.gq1.yahoo.com (sonic301-21.consmr.mail.gq1.yahoo.com [98.137.64.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KYH622fFqz3NWh for ; Wed, 6 Apr 2022 08:01:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1649232099; bh=0qP5PJVXjuzYG5RbgVnZi8pHYsjlKNxBYvHV6Eumz8Q=; h=From:Subject:Date:To:References:From:Subject:Reply-To; b=PUquP0WCcFTFyb9/017lC2sGZFSv8FdUz3GKYgQ9HtSg+8YEZ2J9XDveRrkBY8sy5zA5Dj3rCgBSA2c9ugIzXX9PY8Q3Hkrk1Js4Hl0IW3V2QOGU3IC4jFsrb+p0srZrHLcozOuX9une1xaQGu1trDluJlgJoRUvJxXGRkXFDDcJlF6Eiv2bzfMkAPvsfSfQ2sNfTF6c6Uq3uVSy1EYO68Gg1ciwDGEsYYnK6sXxDTOxw6X8i20cfTL32An0cyrbJ+/kfq2icbmQvto4EcT0II2XtYwlfvTR+CfkTFgktRFoz5W1vzRjJUM4889Xry17sXuvNtbmahWL6vKUwc63rg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1649232099; bh=/61Dowxuf9JpVbcWHQr0sWVMG2A54yg3drre63snZlf=; h=X-Sonic-MF:From:Subject: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NF3NGkSa1T1EPvgGvFOPOL5y Gly2usaamgRzqmhuHVzXXAPerp9vN7WpeJCFKkIDhfMS3BP6tlBy9OhWSVkDkvA7BlOwLDAypdcg _47z3zE4hPi3xLYhXqp9eNx1MRpNr19Wg7VZ5rf1onEBXyoZwtdU_BAFIh_9DE70aoEbzZlrjXCT llAIN46wdeYm4lAk5fmcvcVsdO2w5IJ4gW5RgCw7Z7zQdd2ewOhIbaKhQr0pZ94Vi3HgWQnP8E.L _kbiDvbWWBPupC0j1EcPXa5q4x.wWWwkHCLoeGUr8It5y0uu_1ojRfrkQ4gFGm6vk99NOREdPmd_ MLTnTYGHmpcg5DuSLfCfqDhdoOP5H.7xspy2QTiwTDAeGWkt9KJZcpv2RPVDyHdLWTuPSsKzsuLe 5E0W2ZIOLSJ5Emw8N723wO3IAJTyOvAmRvTc3eKJIAlnp3p.xmwumctbsB9r3Lo8FO0y_Rd5cr_J e5AeRkX3GoQlS8qOvNfQjMyeMCOwNAKBlcT90.ubO_nqZXaFpL4ooRZjfkyOuLgFVxldtKqvZFsh aKG6RiHQlHbvqg.kEg8Y- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Wed, 6 Apr 2022 08:01:39 +0000 Received: by hermes--canary-production-bf1-665cdb9985-85ftg (VZM Hermes SMTP Server) with ESMTPA ID 65bd5730589b7fcb224bf667594af052; Wed, 06 Apr 2022 08:01:33 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: https://github.com/pftf/RPi3 UEFI/ACPI based booting: gic_acpi_identify crashes dereferencing a NULL pointer value Message-Id: <6609AB07-942C-4E06-A99A-2B3A0D65D970@yahoo.com> Date: Wed, 6 Apr 2022 01:01:31 -0700 To: Free BSD , "freebsd-acpi@freebsd.org" X-Mailer: Apple Mail (2.3654.120.0.1.13) References: <6609AB07-942C-4E06-A99A-2B3A0D65D970.ref@yahoo.com> X-Rspamd-Queue-Id: 4KYH622fFqz3NWh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=PUquP0WC; dmarc=pass (policy=reject) header.from=yahoo.com; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.64.147 as permitted sender) smtp.mailfrom=marklmi@yahoo.com X-Spamd-Result: default: False [-3.44 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-0.94)[-0.941]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.147:from]; MLMMJ_DEST(0.00)[freebsd-arm]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.147:from]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N https://github.com/pftf/RPi3 UEFI/ACPI use gets a boot crash in FreeBSD's gic_acpi_identify: . . . MAP 1d0000 mode 2 pages 32 MAP 339d0000 mode 2 pages 80 MAP 33a20000 mode 2 pages 256 MAP 37000000 mode 2 pages 400 MAP 37190000 mode 2 pages 592 kbd0 at kbdmux0 acpi0: acpi0: Power Button (fixed) acpi0: Could not update all GPEs: AE_NOT_CONFIGURED psci0: on acpi0 Fatal data abort: x0: ffff000086ffe6b4 (crypto_dev + 858f044c) x1: ffff00000103d0d0 (initstack + 30d0) x2: ffff00000080ed2c (madt_handler + 0) x3: ffff00000103d0d0 (initstack + 30d0) x4: d2d9fffc x5: 0 x6: ffffffffffffffff x7: 2001 x8: 0 x9: 400 x10: 800 x11: 0 x12: ffff00000103d8dc (initstack + 38dc) x13: b6 x14: 551 x15: 16c x16: 0 x17: 1 x18: ffff00000103d0d0 (initstack + 30d0) x19: ffff000086ffe598 (crypto_dev + 858f0330) x20: ffffa00000dba200 x21: ffff00000103d0e0 (initstack + 30e0) x22: ffffa00000c37a40 x23: ffff000000ec8000 (devsoftc + 88) x24: ffff00000097fe1a (digits + 102f6) x25: 3800000 x26: ffff000000e74000 (gdb_tx_u + a98) x27: ffff000000e74000 (gdb_tx_u + a98) x28: ffff00004042bd28 (crypto_dev + 3ed1dac0) x29: ffff00000103d8e0 (initstack + 38e0) sp: ffff00000103d0d0 lr: ffff00000080e908 (gic_acpi_identify + 7c) elr: ffff00000080e90c (gic_acpi_identify + 80) spsr: 600000c5 far: 14 esr: 96000004 panic: vm_fault failed: ffff00000080e90c error 1 cpuid =3D 0 time =3D 1 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x30 vpanic() at vpanic+0x178 panic() at panic+0x44 data_abort() at data_abort+0x2bc handle_el1h_sync() at handle_el1h_sync+0x10 --- exception, esr 0x96000004 gic_acpi_identify() at gic_acpi_identify+0x80 bus_generic_new_pass() at bus_generic_new_pass+0x44 bus_generic_new_pass() at bus_generic_new_pass+0xb0 bus_generic_new_pass() at bus_generic_new_pass+0xb0 root_bus_configure() at root_bus_configure+0x40 mi_startup() at mi_startup+0x224 virtdone() at virtdone+0x7c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x48: undefined f901c11f This turns out to have gic_acpi_identify+0x80 with the code shown below: ffff00000080e904 bl ffff00000011d640 = ffff00000080e908 ldr x8, [sp, #8] ffff00000080e90c ldrb w8, [x8, #20] and the register dump above shows: x8: 0 Looking up the source ( sys/arm/arm/gic_acpi.c ) there is the likes of: struct madt_table_data { device_t parent; ACPI_MADT_GENERIC_DISTRIBUTOR *dist; ACPI_MADT_GENERIC_INTERRUPT *intr[MAXCPU]; }; . . . bzero(&madt_data, sizeof(madt_data)); madt_data.parent =3D parent; madt_data.dist =3D NULL; acpi_walk_subtables(madt + 1, (char *)madt + = madt->Header.Length, madt_handler, &madt_data); /* Check the version of the GIC we have */ switch (madt_data.dist->Version) { So it appears that madt_data.dist held a NULL pointer value that was not checked for. (I've no clue if such a NULL is supposed to be possible --but I do know it occured.) The following lines are: case ACPI_MADT_GIC_VERSION_NONE: case ACPI_MADT_GIC_VERSION_V1: case ACPI_MADT_GIC_VERSION_V2: break; default: goto out; } . . . out: acpi_unmap_table(madt); } That might suggest that madt_data.dist=3D=3DNULL should lead to a "goto out". =3D=3D=3D Mark Millard marklmi at yahoo.com