From nobody Fri Mar 31 13:55:10 2023 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 4Pp1y63G1qz42mGg; Fri, 31 Mar 2023 13:55:10 +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 4Pp1y62fRYz42QW; Fri, 31 Mar 2023 13:55:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680270910; 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=UaUYgeLciN4sYuiEXg7f7Pejc7fzQuAN5HDSJYvZ0l0=; b=xLNB3IAzwn33X56e2P/LOPHnVB9sKzzLgR69tRtzj/j3SCw1RYwidkHIknMZ85XfGPEzP9 01yXh6BHh/05aAqme2x/pHA8jQs6M4qZ8TW+i9x57qoKZHmKJD5PlS2kG5gH/ApV5T7F19 PlBHHFCQOV+2JnUoFD3WTBL1Ah/b47ri5fIL7XmOUOSUa/a9dE+Hj7QAJG4pxsKmhf0O8g JHCgAyEmZLtgGhxhNh1PvNpJ/YjW+ZdB0BqXySQRYTLW0XmLvZNXZYoh5u0Uk4Fg2kcd9d yUWdjzBUL0dKXXopNWN4nDhKzDjEH3Berh82ypmqlbSNIHntS/pEFeblbEbNmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680270910; 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=UaUYgeLciN4sYuiEXg7f7Pejc7fzQuAN5HDSJYvZ0l0=; b=oz2RRwReq3wxTWYLFOmCwpaG4D907Pgq73PsDcZpre36bVconF55+R5SgwyRpBwTexwfIO rEdWYO7NXjbSTaeijmxu8fFT0bwV4dt54mSl9aHJzSS5ysdMYsP9q0f0PCu6sKRog4QXnm WS4jw8qwWw+NmhEUqPeRxRqRAWUqW/gxhs/icuYS6aicHotL8qa1/xFJXg8RpWvyWb0NWY mjDYldnerkHaWv5gSxn6lS9BsJ/8Ep8Je47AzWnyHdkozssNuM5i8zOD1OHl31XRyRviM+ wxPQWvsdg+o83OHXFsTIYqWKD+IltmlX2oNPhCa4yiIioy0PZKDlJ9vF1noPtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680270910; a=rsa-sha256; cv=none; b=ODEvpgis9GX87M59LkB2ewoO3bKeGBRIwf9dF6Fwfw+u9OR1+aPQZbbkFhQcEVP7aCf1GR 1rvqeVbrwPy1CvE8xx9mxO7pMySoci6ujD4xzuD0lPYsRC2sbRcoiMR5kYOuzbkgsK13Wm zsJ5DC30NAUFdkXdj6XgFLD+cabCuN9qDnbaC4+aMp89OzqqCtYqvEc8rjESB6z42X7QBO C15yLx6xFPyZteWtAEDd3A3z5D8jvmifeN7BTgo0aw5x0+zNaEYQOr52VLf9vt1ETXTand udaes5Rrft4gnboaDDtbh/4BmGzXEs6CPlNA82yVlN2lPVXzodL4nI40qsTOtQ== 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 4Pp1y61hLFzwrf; Fri, 31 Mar 2023 13:55:10 +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 32VDtAQk083101; Fri, 31 Mar 2023 13:55:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32VDtAFq083100; Fri, 31 Mar 2023 13:55:10 GMT (envelope-from git) Date: Fri, 31 Mar 2023 13:55:10 GMT Message-Id: <202303311355.32VDtAFq083100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a54370f4abb6 - main - arm64: Ensure that thread0's PCB flags are initialized 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a54370f4abb6bc4e3ef25da97adb3262bacb5a4b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a54370f4abb6bc4e3ef25da97adb3262bacb5a4b commit a54370f4abb6bc4e3ef25da97adb3262bacb5a4b Author: Mark Johnston AuthorDate: 2023-03-31 13:50:34 +0000 Commit: Mark Johnston CommitDate: 2023-03-31 13:50:34 +0000 arm64: Ensure that thread0's PCB flags are initialized On arm64, the PCB is stored at the top of the thread stack. For thread0 this comes from the static "initstack" region, which is placed in the .init_pagetable section, which is not part of the BSS and thus doesn't get zeroed by locore. (See the comment in ldscript.arm64.) It is thus possible for the pcb_flags field to be uninitialized, which can result in PCB_SINGLE_STEP being set. Fix this by simply initializing the field. A separate commit will move initstack out of the .init_pagetable section, since it has no reason to be there, but it is preferable to explicitly initialize PCB fields anyway. In particular, regular kernel stacks are not zeroed upon allocation, so we should be consistent here. Reviewed by: andrew MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D39343 --- sys/arm64/arm64/machdep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index b87c635048de..d9ea06952c54 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -380,6 +380,7 @@ init_proc0(vm_offset_t kstack) #endif thread0.td_pcb = (struct pcb *)(thread0.td_kstack + thread0.td_kstack_pages * PAGE_SIZE) - 1; + thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; thread0.td_pcb->pcb_vfpcpu = UINT_MAX;