From owner-dev-commits-src-all@freebsd.org Wed Mar 10 17:29:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEA48571574; Wed, 10 Mar 2021 17:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DwfGT5yTKz3slb; Wed, 10 Mar 2021 17:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 52EF03790; Wed, 10 Mar 2021 17:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 953a7d7c61f3 - main - Arch64: Clear VFP state on execve() To: Alex Richardson , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103101245.12ACjLn7064810@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Wed, 10 Mar 2021 09:29:51 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202103101245.12ACjLn7064810@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 17:29:53 -0000 On 3/10/21 4:45 AM, Alex Richardson wrote: > The branch main has been updated by arichardson: > > URL: https://cgit.FreeBSD.org/src/commit/?id=953a7d7c61f3b2f5351dfe668510ec782ae282e8 > > commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8 > Author: Alex Richardson > AuthorDate: 2021-03-09 19:11:40 +0000 > Commit: Alex Richardson > CommitDate: 2021-03-10 12:44:42 +0000 > > Arch64: Clear VFP state on execve() > > I noticed that many of the math-related tests were failing on AArch64. > After a lot of debugging, I noticed that the floating point exception flags > were not being reset when starting a new process. This change resets the > VFP inside exec_setregs() to ensure no VFP register state is leaked from > parent processes to children. > > This commit also moves the clearing of fpcr that was added in 65618fdda0f27 > from fork() to execve() since that makes more sense: fork() can retain > current register values, but execve() should result in a well-defined > clean state. > > Reviewed By: andrew > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D29060 FYI, cpu_thread_copy() should copy the creating thread's state to the new thread, not reset it. POSIX actually says that new threads inherit the "floating point environment" from the creating thread for pthread_create(). I have a patch I'm testing to fix thix for x86. -- John Baldwin