From nobody Fri Jun 16 15:04:07 2023 X-Original-To: bugs@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 4QjMr82Zppz4fSpg for ; Fri, 16 Jun 2023 15:04:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QjMr81ZYcz49NP for ; Fri, 16 Jun 2023 15:04:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686927848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nqr1tET4m+RCqBYWQtvBUyWIbtwqbPrerm8s37IO+Rg=; b=WtoTRhRQLmKFQOWMSdBuPZzECO45dHuPNokfDtRSWWvYAdYRkBide97L6roSa/f3iamg6F mkFSitVdkCu34hX8oyX1G1xXyf5iEP7Nh3DzIuSDt2A7Y++kon+B78NMRnUI8Y4CP6Ep+1 QJEbnHd/ecytYpLwpXxCZayFQn9UfGuiJXnE8xuvLh3ZWRkCGi1mbmNl5jsaUo/y50vAn+ +gI/rQLnAVdwH8BH2l5ES98zAHJM3niwjj8lH97hQ9BpvMCIMJlaeqPh/JPQK0b54b3UPW Is2wfjmW9/x7ZCUn98swrSlTyusXEKvA5tsjV0mwkCEIqxudELrRla7vwuTiAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686927848; a=rsa-sha256; cv=none; b=e2sEVP5TI+7DWIm1VAtiHCIIqZV7MlxXlHn6YhSIlf+Y72x+JKdtWRUbjW9c2/k6K0gfJZ aIrwyTk+iCoOFNwlNXwCtzSc9gdRjDwKVM8gfkXdQyoRcJh1KewNDV0vHr4XV4FSfqT8Rg BQWQ5Eok1aF8Zxx0ud4iOqdN5lFBexM+bAUCzWmX9TMX6iohQrwX2aKUKjji9/4f7DD1Rc AMiykmtJzCwLjwkBDBHHZ8iBeQ43BpvNZFo2aYN1xEy43xIJ5LZ9hg0mihPvskWNycnSD4 kbIOtrwwtinRJoW9mnVOB2A3l4weU8Heywv0mIArwdaJA0X5rpiXKaYzTf9kbg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QjMr80hSlzXs9 for ; Fri, 16 Jun 2023 15:04:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 35GF48EC033572 for ; Fri, 16 Jun 2023 15:04:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35GF48Lb033571 for bugs@FreeBSD.org; Fri, 16 Jun 2023 15:04:08 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272018] pci_read_vpd() does not always load VPD even when valid VPD exists because of state machine bug Date: Fri, 16 Jun 2023 15:04:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.1-STABLE X-Bugzilla-Keywords: needs-patch, needs-qa X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: se@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272018 Stefan E=C3=9Fer changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |se@FreeBSD.org --- Comment #2 from Stefan E=C3=9Fer --- Created attachment 242810 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242810&action= =3Dedit Simpiified VPD parser The current VPD code uses a state machine to parse an assumed very flexible syntax, while the structure of valid VPD actually follows a quite strict fo= rmat that can be parsed by a very simple parser that hard-codes this structure. After fixing a kernel panic due to invalid VPD data that was not rejected by the existing parser, I have re-implemented the VPD parser based on the documented VPD definition. See review D34268 for the code that I had uploaded as a replacement (after adding many sanity checks to the state machine code that is meant to detect invalid VPD data). I'm not convinced that the current code's VPD checks catch all cases and fo= und that it is much easier to get a correct and safe parser by removing the unnecessary state machine. (The state machine would make sense, if the orde= r of elements in the VPD structure was less strict, but given the simple "linear" definition of VPD this flexibility stands in the way of easy detection of malformed VPD data.) The suggested replacement of the current VPD parser "knows" which element to expect next (with some segments being optional) and thus does not need any state variables. I'd appreciate a review of the patch, which is also attached to the PR (reb= ased to -CURRENT as of today). It has been tested with simulated VPD data (correct and malformed) and real= VPD device data - test code is available on request. --=20 You are receiving this mail because: You are the assignee for the bug.=