From nobody Tue Nov 29 01:10:55 2022 X-Original-To: dev-commits-src-main@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 4NLkmc1R6Hz4jSbf; Tue, 29 Nov 2022 01:10:56 +0000 (UTC) (envelope-from git@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 4NLkmc11pGz42gN; Tue, 29 Nov 2022 01:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669684256; 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; bh=TqahUs5tM/j1l5lhurXmwjuFXVH9LTQckicW19Od/MI=; b=ELLdUy40Lu96fgbcqOb2R+Z4GBnMv8ZpcAjRJNPe6230HDTaoNb2DKpq/rr3L7jj3ldchM pqkBZENguVJA1jHWD6ccenYPjOCwrcxCxeJNrLy7RiH5jngvJ6AVidmAnSMEfVcUGhaSC8 o15LRXjU6yJkOw7mHj5quoXzOR19/cY+Nbf0yWwITXZwKHeUOCd4FKpS/d35d0hjh/LiH7 9WX+e4NgYvlYzQIXtGEpExzcLv5PFikOQd9X4E4RA9wj//gPUWPDINOS/ccdF6GNl/6sCu HdI2PVlhhIcbP2KjHy2nKaC6Htw0q8YsJw31ft/pVAo8SsMGK2NhP+FZ0434tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669684256; 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; bh=TqahUs5tM/j1l5lhurXmwjuFXVH9LTQckicW19Od/MI=; b=NFe5fXu5v99HErB64WcRYXeuBYwjwQBI/ZY4vu5ofYTWxaSOsCyhHyCVosJIDbMVh6P3it Dz0M/mxIwHQRdRauD7HbyHyQq/mzSIngiNnbj7omiUXgsuV+S5nxTw1tCoAxU2piizplHI CFUmpOISAIYIhHK5JZMp6cbnubiutcodbF+s++KNilg3I4QP4jv3CpPkbpudMEwS3n/9y3 gcNNYrcpNl0/V8u7wvPfqmKmENoMdYwlUDZb9af54rhYcFfMl47eIR5+EG/zDNHJrWL6ka sAmUofPU4jn+em6FcK+j5xICvmokXlnaEA4040dfh71ndujrf9U9A+SzJsIGfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669684256; a=rsa-sha256; cv=none; b=I7fV0saQRx7C2ZYUjygPVt/dyV0kTdceW6t2VkVkChQ4FnFPLBenWAfKoq3llAtUOReABA ZgZwfcSTg8Xj/SfkJaEzYmlTklLC2MtgASGMfKjfpm7+kiP8eSweKJwrcxt13kOrvvnNy8 6zvI3DwOj16tW/Ma7gqfrIoXyvSYR8euBMhRGeSuDkJ1dBaX9TXIHsjq0yvFhlrpmqelOp /sjQczz3H4mDY1sffnpNRKv+5g7/Atba7IBQIdYs5kwTvaydQzyMgTpHpmxDWEvNOXMM67 frwwm8plI1hrD3+BTyydxeKGUR/8I5mK8S/I1n+zvLDeQQLo/LqYyIaEdfge/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4NLkmc07yXzynv; Tue, 29 Nov 2022 01:10:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AT1AtQE045213; Tue, 29 Nov 2022 01:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AT1Atdq045212; Tue, 29 Nov 2022 01:10:55 GMT (envelope-from git) Date: Tue, 29 Nov 2022 01:10:55 GMT Message-Id: <202211290110.2AT1Atdq045212@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1d9e8a9e6095 - main - bhyve: Don't leak uninitialized bits in NVMe completion statuses. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d9e8a9e60953b148a036b39d1fe7037fdbb40a3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1d9e8a9e60953b148a036b39d1fe7037fdbb40a3 commit 1d9e8a9e60953b148a036b39d1fe7037fdbb40a3 Author: John Baldwin AuthorDate: 2022-11-29 01:08:36 +0000 Commit: John Baldwin CommitDate: 2022-11-29 01:08:36 +0000 bhyve: Don't leak uninitialized bits in NVMe completion statuses. In some cases, some bits in the 16-bit status word were never initialized. Reported by: GCC Reviewed by: corvink, chuck, markj Differential Revision: https://reviews.freebsd.org/D37486 --- usr.sbin/bhyve/pci_nvme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 6572781e939c..98f4a7de72c8 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1530,6 +1530,7 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nvme_command* command, DPRINTF("%s identify 0x%x nsid 0x%x", __func__, command->cdw10 & 0xFF, command->nsid); + status = 0; pci_nvme_status_genc(&status, NVME_SC_SUCCESS); switch (command->cdw10 & 0xFF) { @@ -2383,6 +2384,7 @@ pci_nvme_io_done(struct blockif_req *br, int err) /* TODO return correct error */ code = err ? NVME_SC_DATA_TRANSFER_ERROR : NVME_SC_SUCCESS; + status = 0; pci_nvme_status_genc(&status, code); pci_nvme_set_completion(req->sc, sq, req->sqid, req->cid, status); @@ -2447,6 +2449,7 @@ nvme_write_read_ram(struct pci_nvme_softc *sc, else dir = NVME_COPY_FROM_PRP; + status = 0; if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, prp1, prp2, buf + offset, bytes, dir)) pci_nvme_status_genc(&status, @@ -2594,6 +2597,7 @@ pci_nvme_dealloc_sm(struct blockif_req *br, int err) bool done = true; uint16_t status; + status = 0; if (err) { pci_nvme_status_genc(&status, NVME_SC_INTERNAL_DEVICE_ERROR); } else if ((req->prev_gpaddr + 1) == (req->prev_size)) {