From owner-svn-src-head@freebsd.org Tue Feb 28 22:54:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3308CF2834; Tue, 28 Feb 2017 22:54:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2AE21C7; Tue, 28 Feb 2017 22:54:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1SMsqYJ086615; Tue, 28 Feb 2017 22:54:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1SMsq0l086613; Tue, 28 Feb 2017 22:54:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702282254.v1SMsq0l086613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Feb 2017 22:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314429 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2017 22:54:54 -0000 Author: kib Date: Tue Feb 28 22:54:52 2017 New Revision: 314429 URL: https://svnweb.freebsd.org/changeset/base/314429 Log: Initialize pcb_save for thread0. Otherwise kernel traps on NULL dereference if fpu_kern(9) is used from the thread0 context. Reported by: cem Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Feb 28 22:49:45 2017 (r314428) +++ head/sys/amd64/amd64/machdep.c Tue Feb 28 22:54:52 2017 (r314429) @@ -1734,6 +1734,7 @@ hammer_time(u_int64_t modulep, u_int64_t * area. */ thread0.td_pcb = get_pcb_td(&thread0); + thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size); if (use_xsave) { xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) + Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Feb 28 22:49:45 2017 (r314428) +++ head/sys/i386/i386/machdep.c Tue Feb 28 22:54:52 2017 (r314429) @@ -2420,6 +2420,7 @@ init386(int first) * area. */ thread0.td_pcb = get_pcb_td(&thread0); + thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size); if (use_xsave) { xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) +