svn commit: r328535 - head/sbin/decryptcore
Author: def Date: Mon Jan 29 09:21:08 2018 New Revision: 328535 URL: https://svnweb.freebsd.org/changeset/base/328535 Log: Fix misspelling of encryptedcore. PR: 223991 Submitted by: Trond EndrestolApproved by: pjd (mentor) Modified: head/sbin/decryptcore/decryptcore.8 Modified: head/sbin/decryptcore/decryptcore.8 == --- head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:15:38 2018 (r328534) +++ head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:21:08 2018 (r328535) @@ -96,7 +96,7 @@ Specify location of a private key file which will be u file. .It Fl k Ar keyfile Specify location of a dump key file. -.It Fl e Ar encrytpedcore +.It Fl e Ar encryptedcore Specify location of an encrypted core. .It Fl c Ar core Specify location of a resulting decrypted core dump. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r313459 - head/sbin/decryptcore
Author: def Date: Wed Feb 8 23:17:23 2017 New Revision: 313459 URL: https://svnweb.freebsd.org/changeset/base/313459 Log: Don't decrypt a core if a vmcore file already exists by default. Allow to change this behaviour using the -f flag. Approved by: pjd (mentor) Modified: head/sbin/decryptcore/decryptcore.8 head/sbin/decryptcore/decryptcore.c Modified: head/sbin/decryptcore/decryptcore.8 == --- head/sbin/decryptcore/decryptcore.8 Wed Feb 8 20:31:54 2017 (r313458) +++ head/sbin/decryptcore/decryptcore.8 Wed Feb 8 23:17:23 2017 (r313459) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2016 +.Dd February 9, 2017 .Dt DECRYPTCORE 8 .Os .Sh NAME @@ -32,13 +32,13 @@ .Nd "decrypt a core dump of the operating system" .Sh SYNOPSIS .Nm -.Op Fl Lv +.Op Fl fLv .Fl p Ar privatekeyfile .Fl k Ar keyfile .Fl e Ar encryptedcore .Fl c Ar core .Nm -.Op Fl Lv +.Op Fl fLv .Op Fl d Ar crashdir .Fl p Ar privatekeyfile .Fl n Ar dumpnr @@ -70,10 +70,20 @@ file where corresponds to .Ar dumpnr . .Pp +By default +.Nm +does not overwrite an old core dump as a user might want to store the core +somewhere else for the future. +This behaviour can be changed using the +.Fl f +flag. +.Pp The .Nm utility can be started with the following command line arguments: .Bl -tag -width ".Fl e Ar encryptedcore" +.It Fl f +Remove a decryped core dump if it already exists. .It Fl L Write log messages to .Xr syslogd 8 . Modified: head/sbin/decryptcore/decryptcore.c == --- head/sbin/decryptcore/decryptcore.c Wed Feb 8 20:31:54 2017 (r313458) +++ head/sbin/decryptcore/decryptcore.c Wed Feb 8 23:17:23 2017 (r313459) @@ -55,8 +55,8 @@ usage(void) { pjdlog_exitx(1, - "usage: decryptcore [-Lv] -p privatekeyfile -k keyfile -e encryptedcore -c core\n" - " decryptcore [-Lv] [-d crashdir] -p privatekeyfile -n dumpnr"); + "usage: decryptcore [-fLv] -p privatekeyfile -k keyfile -e encryptedcore -c core\n" + " decryptcore [-fLv] [-d crashdir] -p privatekeyfile -n dumpnr"); } static int @@ -115,8 +115,8 @@ failed: } static bool -decrypt(const char *privkeyfile, const char *keyfile, const char *input, -const char *output) +decrypt(int ofd, const char *privkeyfile, const char *keyfile, +const char *input) { uint8_t buf[KERNELDUMP_BUFFER_SIZE], key[KERNELDUMP_KEY_MAX_SIZE]; EVP_CIPHER_CTX ctx; @@ -124,14 +124,14 @@ decrypt(const char *privkeyfile, const c FILE *fp; struct kerneldumpkey *kdk; RSA *privkey; - int ifd, kfd, ofd, olen, privkeysize; + int ifd, kfd, olen, privkeysize; ssize_t bytes; pid_t pid; + PJDLOG_ASSERT(ofd >= 0); PJDLOG_ASSERT(privkeyfile != NULL); PJDLOG_ASSERT(keyfile != NULL); PJDLOG_ASSERT(input != NULL); - PJDLOG_ASSERT(output != NULL); privkey = NULL; @@ -142,11 +142,14 @@ decrypt(const char *privkeyfile, const c pid = fork(); if (pid == -1) { pjdlog_errno(LOG_ERR, "Unable to create child process"); + close(ofd); return (false); } - if (pid > 0) + if (pid > 0) { + close(ofd); return (wait_for_process(pid) == 0); + } kfd = open(keyfile, O_RDONLY); if (kfd == -1) { @@ -158,11 +161,6 @@ decrypt(const char *privkeyfile, const c pjdlog_errno(LOG_ERR, "Unable to open %s", input); goto failed; } - ofd = open(output, O_WRONLY | O_CREAT | O_TRUNC, 0600); - if (ofd == -1) { - pjdlog_errno(LOG_ERR, "Unable to open %s", output); - goto failed; - } fp = fopen(privkeyfile, "r"); if (fp == NULL) { pjdlog_errno(LOG_ERR, "Unable to open %s", privkeyfile); @@ -247,8 +245,7 @@ decrypt(const char *privkeyfile, const c } if (olen > 0 && write(ofd, buf, olen) != olen) { - pjdlog_errno(LOG_ERR, "Unable to write data to %s", - output); + pjdlog_errno(LOG_ERR, "Unable to write core"); goto failed; } } while (bytes > 0); @@ -269,9 +266,11 @@ main(int argc, char **argv) { char core[PATH_MAX], encryptedcore[PATH_MAX], keyfile[PATH_MAX]; const char *crashdir, *dumpnr, *privatekey; - int ch, debug; + int ch, debug, error, ofd; size_t ii; - bool usesyslog; + bool force, usesyslog; + + error = 1; pjdlog_init(PJDLOG_MODE_STD); pjdlog_prefix_set("(decryptcore) "); @@ -281,10 +280,11 @@ main(int argc, char **argv) crashdir = NULL; dumpnr = NULL;
svn commit: r313195 - in head/sbin: decryptcore savecore
Author: def Date: Sat Feb 4 14:10:16 2017 New Revision: 313195 URL: https://svnweb.freebsd.org/changeset/base/313195 Log: Fix bugs found by Coverity in decryptcore(8) and savecore(8): - Perform final decryption and write decrypted data in case of non-block aligned input data; - Use strlcpy(3) instead of strncpy(3) to verify if paths aren't too long; - Check errno after calling unlink(2) instead of calling stat(2) in order to verify if a decrypted core was created by a child process; - Free dumpkey. Reported by: Coverity, cem, pfg Suggested by: cem CID: 1366936, 1366942, 1366951, 1366952 Approved by: pjd (mentor) Modified: head/sbin/decryptcore/decryptcore.c head/sbin/savecore/savecore.c Modified: head/sbin/decryptcore/decryptcore.c == --- head/sbin/decryptcore/decryptcore.c Sat Feb 4 12:26:38 2017 (r313194) +++ head/sbin/decryptcore/decryptcore.c Sat Feb 4 14:10:16 2017 (r313195) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -232,8 +231,6 @@ decrypt(const char *privkeyfile, const c pjdlog_errno(LOG_ERR, "Unable to read data from %s", input); goto failed; - } else if (bytes == 0) { - break; } if (bytes > 0) { @@ -249,10 +246,7 @@ decrypt(const char *privkeyfile, const c } } - if (olen == 0) - continue; - - if (write(ofd, buf, olen) != olen) { + if (olen > 0 && write(ofd, buf, olen) != olen) { pjdlog_errno(LOG_ERR, "Unable to write data to %s", output); goto failed; @@ -274,7 +268,6 @@ int main(int argc, char **argv) { char core[PATH_MAX], encryptedcore[PATH_MAX], keyfile[PATH_MAX]; - struct stat sb; const char *crashdir, *dumpnr, *privatekey; int ch, debug; size_t ii; @@ -297,16 +290,23 @@ main(int argc, char **argv) usesyslog = true; break; case 'c': - strncpy(core, optarg, sizeof(core)); + if (strlcpy(core, optarg, sizeof(core)) >= sizeof(core)) + pjdlog_exitx(1, "Core file path is too long."); break; case 'd': crashdir = optarg; break; case 'e': - strncpy(encryptedcore, optarg, sizeof(encryptedcore)); + if (strlcpy(encryptedcore, optarg, + sizeof(encryptedcore)) >= sizeof(encryptedcore)) { + pjdlog_exitx(1, "Encrypted core file path is too long."); + } break; case 'k': - strncpy(keyfile, optarg, sizeof(keyfile)); + if (strlcpy(keyfile, optarg, sizeof(keyfile)) >= + sizeof(keyfile)) { + pjdlog_exitx(1, "Key file path is too long."); + } break; case 'n': dumpnr = optarg; @@ -362,7 +362,7 @@ main(int argc, char **argv) pjdlog_debug_set(debug); if (!decrypt(privatekey, keyfile, encryptedcore, core)) { - if (stat(core, ) == 0 && unlink(core) != 0) + if (unlink(core) == -1 && errno != ENOENT) pjdlog_exit(1, "Unable to remove core"); exit(1); } Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sat Feb 4 12:26:38 2017 (r313194) +++ head/sbin/savecore/savecore.c Sat Feb 4 14:10:16 2017 (r313195) @@ -478,6 +478,7 @@ DoFile(const char *savedir, const char * bool isencrypted, ret; bounds = getbounds(); + dumpkey = NULL; mediasize = 0; status = STATUS_UNKNOWN; @@ -816,6 +817,7 @@ nuke: } xo_close_container_h(xostdout, "crashdump"); xo_finish_h(xostdout); + free(dumpkey); free(temp); close(fd); return; @@ -824,6 +826,7 @@ closeall: fclose(fp); closefd: + free(dumpkey); free(temp); close(fd); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309818 - in head: etc/defaults etc/rc.d sbin sbin/decryptcore sbin/dumpon sbin/savecore share/man/man5 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/ddb sys/dev/null sys/ge
On 12/10/2016 20:20, Justin Hibbits wrote: > On Dec 10, 2016, at 10:20 AM, Konrad Witaszczyk wrote: >> Author: def >> Date: Sat Dec 10 16:20:39 2016 >> New Revision: 309818 >> URL: https://svnweb.freebsd.org/changeset/base/309818 >> >> Log: >> Add support for encrypted kernel crash dumps. >> >> Changes include modifications in kernel crash dump routines, dumpon(8) and >> savecore(8). A new tool called decryptcore(8) was added. >> >> A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump >> configuration in the diocskerneldump_arg structure to the kernel. >> The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 >> for >> backward ABI compatibility. >> >> dumpon(8) generates an one-time random symmetric key and encrypts it using >> an RSA public key in capability mode. Currently only AES-256-CBC is >> supported >> but EKCD was designed to implement support for other algorithms in the >> future. >> The public key is chosen using the -k flag. The dumpon rc(8) script can do >> this >> automatically during startup using the dumppubkey rc.conf(5) variable. Once >> the >> keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O >> control. >> >> When the kernel receives the DIOCSKERNELDUMP I/O control it generates a >> random >> IV and sets up the key schedule for the specified algorithm. Each time the >> kernel tries to write a crash dump to the dump device, the IV is replaced by >> a SHA-256 hash of the previous value. This is intended to make a possible >> differential cryptanalysis harder since it is possible to write multiple >> crash >> dumps without reboot by repeating the following commands: >> # sysctl debug.kdb.enter=1 >> db> call doadump(0) >> db> continue >> # savecore >> >> A kernel dump key consists of an algorithm identifier, an IV and an >> encrypted >> symmetric key. The kernel dump key size is included in a kernel dump header. >> The size is an unsigned 32-bit integer and it is aligned to a block size. >> The header structure has 512 bytes to match the block size so it was >> required to >> make a panic string 4 bytes shorter to add a new field to the header >> structure. >> If the kernel dump key size in the header is nonzero it is assumed that the >> kernel dump key is placed after the first header on the dump device and the >> core >> dump is encrypted. >> >> Separate functions were implemented to write the kernel dump header and the >> kernel dump key as they need to be unencrypted. The dump_write function >> encrypts >> data if the kernel was compiled with the EKCD option. Encrypted kernel >> textdumps >> are not supported due to the way they are constructed which makes it >> impossible >> to use the CBC mode for encryption. It should be also noted that textdumps >> don't >> contain sensitive data by design as a user decides what information should >> be >> dumped. >> >> savecore(8) writes the kernel dump key to a key.# file if its size in the >> header >> is nonzero. # is the number of the current core dump. >> >> decryptcore(8) decrypts the core dump using a private RSA key and the kernel >> dump key. This is performed by a child process in capability mode. >> If the decryption was not successful the parent process removes a partially >> decrypted core dump. >> >> Description on how to encrypt crash dumps was added to the decryptcore(8), >> dumpon(8), rc.conf(5) and savecore(8) manual pages. >> >> EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using >> QEMU. >> The feature still has to be tested on arm and arm64 as it wasn't possible to >> run >> FreeBSD due to the problems with QEMU emulation and lack of hardware. >> >> Designed by:def, pjd >> Reviewed by:cem, oshogbo, pjd >> Partial review:delphij, emaste, jhb, kib >> Approved by:pjd (mentor) >> Differential Revision:https://reviews.freebsd.org/D4712 >> >> Added: >> head/sbin/decryptcore/ >> head/sbin/decryptcore/Makefile (contents, props changed) >> head/sbin/decryptcore/decryptcore.8 (contents, props changed) >> head/sbin/decryptcore/decryptcore.c (contents, props changed) >> Modified: >> head/etc/defaults/rc.conf >> head/etc/rc.d/dumpon >> head/sbin/Makefile >> head/sbin/dumpon/Makefile >> head/sbin/dumpon/dumpon.8 >> head/sbin/dumpon/d
svn commit: r309818 - in head: etc/defaults etc/rc.d sbin sbin/decryptcore sbin/dumpon sbin/savecore share/man/man5 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/ddb sys/dev/null sys/geo...
enable="NO" # Run chkprintca chkprintcap_flags="-d" # Create missing directories by default. dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). dumpdir="/var/crash" # Directory where crash dumps are to be stored +dumppubkey="" # Public key for encrypted kernel crash dumps. + # See dumpon(8) for more details. savecore_enable="YES" # Extract core from dump devices if any savecore_flags="-m 10" # Used if dumpdev is enabled above, and present. # By default, only the 10 most recent kernel dumps Modified: head/etc/rc.d/dumpon == --- head/etc/rc.d/dumponSat Dec 10 15:33:36 2016(r309817) +++ head/etc/rc.d/dumponSat Dec 10 16:20:39 2016(r309818) @@ -16,7 +16,12 @@ stop_cmd="dumpon_stop" dumpon_try() { - if /sbin/dumpon "${1}" ; then + if [ -n "${dumppubkey}" ]; then + /sbin/dumpon -k "${dumppubkey}" "${1}" + else + /sbin/dumpon "${1}" + fi + if [ $? -eq 0 ]; then # Make a symlink in devfs for savecore ln -fs "${1}" /dev/dumpdev return 0 Modified: head/sbin/Makefile == --- head/sbin/Makefile Sat Dec 10 15:33:36 2016(r309817) +++ head/sbin/Makefile Sat Dec 10 16:20:39 2016(r309818) @@ -83,6 +83,7 @@ SUBDIR.${MK_IPFW}+= natd SUBDIR.${MK_ISCSI}+= iscontrol SUBDIR.${MK_NAND}+=nandfs SUBDIR.${MK_NAND}+=newfs_nandfs +SUBDIR.${MK_OPENSSL}+= decryptcore SUBDIR.${MK_PF}+= pfctl SUBDIR.${MK_PF}+= pflogd SUBDIR.${MK_QUOTAS}+= quotacheck Added: head/sbin/decryptcore/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/decryptcore/Makefile Sat Dec 10 16:20:39 2016 (r309818) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= decryptcore + +LIBADD=crypto pjdlog + +MAN= decryptcore.8 + +CFLAGS+=-I${.CURDIR}/../../lib/libpjdlog + +WARNS?=6 + +.include Added: head/sbin/decryptcore/decryptcore.8 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/decryptcore/decryptcore.8 Sat Dec 10 16:20:39 2016 (r309818) @@ -0,0 +1,114 @@ +.\" Copyright (c) 2016 Konrad Witaszczyk <d...@freebsd.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 10, 2016 +.Dt DECRYPTCORE 8 +.Os +.Sh NAME +.Nm decryptcore +.Nd "decrypt a core dump of the operating system" +.Sh SYNOPSIS +.Nm +.Op Fl Lv +.Fl p Ar privatekeyfile +.Fl k Ar keyfile +.Fl e Ar encryptedcore +.Fl c Ar core +.Nm +.Op Fl Lv +.Op Fl d Ar crashdir +.Fl p Ar privatekeyfile +.Fl n Ar dumpnr +.Sh DESCRIPTION +The +.Nm +first decrypts +.Ar keyfile +using +.Ar privatekeyfile +and then uses the resulting key to decrypt +.Ar encryptedcore +saved by +.Xr savecore 8 . +Result is saved in +.Ar core . +.Pp +Alternatively a user can decrypt a core dump numbered +.Ar dumpnr +from the +.Ar crashdir +directory. +In this case a dump key from the +.Pa key.# +file is used and the result is saved in the +.Pa vmcore.# +file where +.Dq # +corr
svn commit: r308641 - head/sys/sys
Author: def Date: Mon Nov 14 12:56:18 2016 New Revision: 308641 URL: https://svnweb.freebsd.org/changeset/base/308641 Log: Move text dump version as it's not an architecture version. Reported by: jhb Approved by: pjd (mentor) Modified: head/sys/sys/kerneldump.h Modified: head/sys/sys/kerneldump.h == --- head/sys/sys/kerneldump.h Mon Nov 14 12:03:08 2016(r308640) +++ head/sys/sys/kerneldump.h Mon Nov 14 12:56:18 2016(r308641) @@ -64,7 +64,8 @@ struct kerneldumpheader { #defineKERNELDUMPMAGIC_CLEARED "Cleared Kernel Dump" chararchitecture[12]; uint32_tversion; -#defineKERNELDUMPVERSION 1 +#defineKERNELDUMPVERSION 1 +#defineKERNELDUMP_TEXT_VERSION 1 uint32_tarchitectureversion; #defineKERNELDUMP_AARCH64_VERSION 1 #defineKERNELDUMP_AMD64_VERSION2 @@ -74,7 +75,6 @@ struct kerneldumpheader { #defineKERNELDUMP_POWERPC_VERSION 1 #defineKERNELDUMP_RISCV_VERSION1 #defineKERNELDUMP_SPARC64_VERSION 1 -#defineKERNELDUMP_TEXT_VERSION 1 uint64_tdumplength; /* excl headers */ uint64_tdumptime; uint32_tblocksize; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308576 - head/share/misc
Author: def Date: Sat Nov 12 18:04:03 2016 New Revision: 308576 URL: https://svnweb.freebsd.org/changeset/base/308576 Log: Add myself (def) as a src committer and pjd as my mentor. Approved by: pjd (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Sat Nov 12 17:58:37 2016 (r308575) +++ head/share/misc/committers-src.dot Sat Nov 12 18:04:03 2016 (r308576) @@ -143,6 +143,7 @@ csjp [label="Christian S.J. Peron\ncsjp@ das [label="David Schultz\n...@freebsd.org\n2003/02/21"] davide [label="Davide Italiano\ndav...@freebsd.org\n2012/01/27"] dchagin [label="Dmitry Chagin\ndcha...@freebsd.org\n2009/02/28"] +def [label="Konrad Witaszczyk\n...@freebsd.org\n2016/11/02"] delphij [label="Xin Li\ndelp...@freebsd.org\n2004/09/14"] des [label="Dag-Erling Smorgrav\n...@freebsd.org\n1998/04/03"] dfr [label="Doug Rabson\n...@freebsd.org\n/??/??"] @@ -683,6 +684,7 @@ philip -> kp phk -> jkoshy phk -> mux +pjd -> def pjd -> kib pjd -> lulf pjd -> oshogbo ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r307321 - in head/sys/arm64: arm64 include
Hi Andrew, On 10/14/2016 17:53, Andrew Turner wrote: > Author: andrew > Date: Fri Oct 14 15:53:48 2016 > New Revision: 307321 > URL: https://svnweb.freebsd.org/changeset/base/307321 > > Log: > Rework how we store the VFP registers in the pcb. This will be used when > creating a floating-point context within the kernel without having to move > the stored values in memory. > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/arm64/arm64/machdep.c > head/sys/arm64/arm64/vfp.c > head/sys/arm64/arm64/vm_machdep.c > head/sys/arm64/include/pcb.h > head/sys/arm64/include/vfp.h [...] > Modified: head/sys/arm64/include/pcb.h > == > --- head/sys/arm64/include/pcb.h Fri Oct 14 15:16:44 2016 > (r307320) > +++ head/sys/arm64/include/pcb.h Fri Oct 14 15:53:48 2016 > (r307321) > @@ -31,6 +31,8 @@ > > #ifndef LOCORE > > +#include > + > struct trapframe; > > #define PCB_LR 30 > @@ -49,13 +51,17 @@ struct pcb { > #define PCB_SINGLE_STEP_SHIFT 0 > #define PCB_SINGLE_STEP (1 << PCB_SINGLE_STEP_SHIFT) > > - /* Place last to simplify the asm to access the rest if the struct */ > - __uint128_t pcb_vfp[32]; > - uint32_tpcb_fpcr; > - uint32_tpcb_fpsr; > + struct vfpstate *pcb_fpusaved; > int pcb_fpflags; > #define PCB_FP_STARTED 0x01 > u_int pcb_vfpcpu; /* Last cpu this thread ran VFP code */ > + > + /* > + * The userspace VFP state. The pcb_fpusaved pointer will point to > + * this unless the kernel has allocated a VFP context. > + * Place last to simplify the asm to access the rest if the struct. > + */ > + struct vfpstate pcb_fpustate; > }; > > #ifdef _KERNEL > > Modified: head/sys/arm64/include/vfp.h > == > --- head/sys/arm64/include/vfp.h Fri Oct 14 15:16:44 2016 > (r307320) > +++ head/sys/arm64/include/vfp.h Fri Oct 14 15:53:48 2016 > (r307321) > @@ -35,6 +35,12 @@ > #ifdef _KERNEL > > #ifndef LOCORE > +struct vfpstate { > + __uint128_t vfp_regs[32]; > + uint32_tvfp_fpcr; > + uint32_tvfp_fpsr; > +}; > + > void vfp_init(void); > void vfp_discard(struct thread *); > void vfp_restore_state(void); These changes break buildworld for arm64: In file included from /usr/home/def/FreeBSD/ekcd/repo/lib/libutil/kinfo_getfile.c:5: In file included from /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/sys/user.h:38: /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/machine/pcb.h:64:18: error: field has incomplete type 'struct vfpstate' struct vfpstate pcb_fpustate; ^ /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/machine/pcb.h:54:9: note: forward declaration of 'struct vfpstate' struct vfpstate *pcb_fpusaved; ^ 1 error generated. --- kinfo_getfile.o --- *** [kinfo_getfile.o] Error code 1 You might want to consider making vfpstate available for userland as in arm case. If so I'm attaching a patch for it. Konrad diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index de99118..9429247 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -32,15 +32,15 @@ #ifndef _MACHINE_VFP_H_ #define _MACHINE_VFP_H_ -#ifdef _KERNEL - #ifndef LOCORE + struct vfpstate { __uint128_t vfp_regs[32]; uint32_t vfp_fpcr; uint32_t vfp_fpsr; }; +#ifdef _KERNEL void vfp_init(void); void vfp_discard(struct thread *); void vfp_restore_state(void); signature.asc Description: OpenPGP digital signature