From nobody Tue Aug 2 18:12:15 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 4Ly33z3cFXz4Xqw9; Tue, 2 Aug 2022 18:12:15 +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 4Ly33z39nMz40Ps; Tue, 2 Aug 2022 18:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659463935; 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=sjxyHUO4XykCf/00Nq29vsDDpSNW47vCBeKNoxtBiYs=; b=qg6HI+SVJkr3Lntcno/wcoGWYcz1ehMEydMUlSNkXKHJ7ta86KO7ea6+QOHcK7DzttEgoW G15eogEA/yprDhIyb0uJbUCiZiaH5p+eGyN0BaasD8pAXTNf8ih6FEQZ5onq0VLsvRIZg5 V4FYQk1JHnHY9Y9DzdMmSTHwcevF+vp11ucBbG+dWgOM57gzE6chSbzP/YDNQ/B5W1bt6t 4IItQ1V7i0MF2jUWABdDOghWaQUsphurJqotLxaBt10ijmeCRRcrdk/9KzI2PlAEmswJwr OsExpLa4U2mUFGVbW0scw6cwnWvjZ4z2sGXSbt+x7TxCt53TSWU8H9votDpaxA== 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 4Ly33z2DXNzMLm; Tue, 2 Aug 2022 18:12:15 +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 272ICF6Y000500; Tue, 2 Aug 2022 18:12:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 272ICFNe000499; Tue, 2 Aug 2022 18:12:15 GMT (envelope-from git) Date: Tue, 2 Aug 2022 18:12:15 GMT Message-Id: <202208021812.272ICFNe000499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4a5ec55af6d0 - main - amd64: expicitly re-init td_frame in copy_thread() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a5ec55af6d0bfa659f67483e346d55f90ba0856 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659463935; 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=sjxyHUO4XykCf/00Nq29vsDDpSNW47vCBeKNoxtBiYs=; b=Ew5SqsT+EBsyxjoCfx6KacTjAAQosIGvqnheWDFDV+gQw/+piMhMoPrTxNzP5P4L8tUQLc 1CDkhsCso13v8yfM2MK8Xo8jImPiVWBCV9rHZaVTTgQ2fZl854wiH8V5ORrRWJmTyTVhmk OlW3F+Afyzj7vToR0QhtMLRQYlN9By/H3QhKKfEzsmokDsSf1bVPHCn+OKQUaGRasNI22b X5tFQP3tel6RHfMLU/kbVpvkrmJRkTW8V116z80MnAfiq6bpy7cqhBXpurBZoWfhh/ZXz1 pa5lnpUc2WL7t4ZIqGGmoXZErYf6auw+rayteMBoJQyjzDJ0jdD86KhjTy2kkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659463935; a=rsa-sha256; cv=none; b=iTsdHNvOdmYk7kAL+a+2PIb046dSUSxTegEHtvw7uU1bL7P0RmhN7znJlpVkRffvbaFA6r Fv9LbupvRIAy9rGJ6tE2umtLhDclCUN1xD01XNjDq0Qu1vs0tgbHgMhibOoc3chex/FhNe oZGIhZQgAddIjbGM4lPEaK/qquM3KHVFDV1GFYCH4qtSoLpWJoSpKkkbirXs+7oQGpx0Z5 8ENyPS2k1Gx/eBIqZ5FGX94AaVLyKWXUAiQIfe+KAQSIU/XKxh69sfc8LrnFjZZeyPeVFX fG+RrctEFBIR7t5vzQhWoTvse5ZE6vKF39ZWieA/hZ6SwpDu7BQMgQ8i2NCJYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4a5ec55af6d0bfa659f67483e346d55f90ba0856 commit 4a5ec55af6d0bfa659f67483e346d55f90ba0856 Author: Konstantin Belousov AuthorDate: 2022-07-21 16:26:26 +0000 Commit: Konstantin Belousov CommitDate: 2022-08-02 18:11:09 +0000 amd64: expicitly re-init td_frame in copy_thread() Otherwise we are using whatever the value was left from the previous thread run on kernel entry from usermode. Typically it would be the desired value as is, but it is not guaranteed. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35888 --- sys/amd64/amd64/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index c9c498180c7e..cc90e659ff11 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -170,6 +170,8 @@ copy_thread(struct thread *td1, struct thread *td2) cpu_max_ext_state_size); } + td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; + /* * Set registers for trampoline to user mode. Leave space for the * return address on stack. These are the kernel mode register values.