Compare commits

...
294 Commits
Author SHA1 Message Date
Xin LI 8d2708de5d Fix multiple vulnerabilities of OpenSSL.
Security:	FreeBSD-SA-17:11
Approved by:	so
2017-11-29 05:59:12 +00:00
Gordon Tetlow 9b542f9396 Properly bzero kldstat structure to prevent information leak. [SA-17:10]
Approved by:    so
Security:       FreeBSD-SA-17:10.kldstat
Security:       CVE-2017-1088
2017-11-15 22:50:20 +00:00
Gordon Tetlow addd736e91 Fix kernel data leak via ptrace(PT_LWPINFO). [SA-17:08]
Approved by:    so
Security:       FreeBSD-SA-17:08.ptrace
Security:       CVE-2017-1086
2017-11-15 22:40:15 +00:00
Gordon Tetlow 7a91f2a2ca Update timezone database information. [EN-17:09]
Approved by:	so
2017-11-02 15:39:49 +00:00
Gordon Tetlow ffeffa017d Fix WPA2 protocol vulnerability. [SA-17:07]
Approved by:	so
2017-10-17 17:56:03 +00:00
Xin LI 3960f7bb67 Fix OpenSSH Denial of Service vulnerability. [SA-17:06]
Fix VNET kernel panic with asynchronous I/O. [EN-17:07]

Approved by:	so
2017-08-10 06:59:26 +00:00
Xin LI 590b756bb0 Fix heimdal KDC-REP service name validation vulnerability [SA-17:05]
Approved by:	so
2017-07-12 08:07:36 +00:00
Xin LI 8d9fb88b24 Fix ipfilter(4) fragment handling panic.
Security:	FreeBSD-SA-17:04.ipfilter
Approved by:	so
2017-04-27 06:52:30 +00:00
Xin LI 8d40add9a4 Fix multiple vulnerabilities of ntp. [SA-17:03]
Xen migration enhancements. [EN-17:05]

Approved by:	so
2017-04-12 06:24:35 +00:00
Xin LI c612d5e6c5 Fix multiple vulnerabilities of OpenSSL. [SA-17:02]
Fix system hang when booting when PCI-express HotPlug is enabled.
[EN-17:01]

Fix NIS master updates are not pushed to NIS slave. [EN-17:02]

Fix compatibility with Hyper-V/storage after KB3172614 or
KB3179574. [EN-17:03]

Make makewhatis output reproducible. [EN-17:04]

Approved by:	so
2017-02-23 07:11:48 +00:00
Xin LI b24c303d30 Fix multiple vulnerabilities of OpenSSH.
Security:	FreeBSD-SA-17:01.openssh
Security:	CVE-2016-10009
Security:	CVE-2016-10010
Approved by:	so
2017-01-11 06:01:23 +00:00
Xin LI c7bf4422a7 Fix multiple vulnerabilities of ntp.
Approved by:	so
2016-12-22 16:19:05 +00:00
Gleb Smirnoff a4b6a5f2ac Merge r309688: address regressions in SA-16:37.libc.
PR:		215105
Submitted by:	<jtd2004a sbcglobal.net>
Approved by:	so
2016-12-07 23:29:42 +00:00
Gleb Smirnoff 01d8642325 Fix possible login(1) argument injection in telnetd(8). [SA-16:36]
Fix link_ntoa(3) buffer overflow in libc. [SA-16:37]
Fix possible escape from bhyve(8) virtual machine. [SA-16:38]
Fix warnings about valid time zone abbreviations. [EN-16:19]
Update timezone database information. [EN-16:20]
Fix incorrectly defined unicode character(s). [EN-16:21]

Security:	FreeBSD-SA-16:36.telnetd
Security:	FreeBSD-SA-16:37.libc
Security:	FreeBSD-SA-16:38.bhyve
Errata Notice:	FreeBSD-EN-16:19.tzcode
Errata Notice:	FreeBSD-EN-16:20.tzdata
Errata Notice:	FreeBSD-EN-16:21.localedef
Approved by:	so
2016-12-06 18:49:38 +00:00
Gleb Smirnoff 25aff0f987 Merge r308330 by bapt:
localedef: Fix ctype dump (fixed wide spread errors)

See original commit for longer description.

Errata Notice:	EN-16:21
Approved by:	so
2016-12-06 00:09:52 +00:00
Gleb Smirnoff 0497163ea3 Update tzdata to 2016i.
Note: because of what appears to be a missing MFC to stable branches,
these patches were generated by doing:

 % rsync -av stable/11/contrib/tzdata releng/11.x/contrib
 % svn add releng/11.x/contrib/tzdata

Errata Notice:	EN-16:20
Submitted by:	gjb
Approved by:	so
2016-12-06 00:06:16 +00:00
Gleb Smirnoff f9d939902f Merge r307358 from stable/11:
Incorporate a change from OpenBSD by [email protected]

    Don't warn about valid time zone abbreviations.  POSIX
    through 2000 says that an abbreviation cannot start with ':', and
    cannot contain ',', '-', '+', NUL, or a digit.  POSIX from 2001
    on changes this rule to say that an abbreviation can contain only
    '-', '+', and alphanumeric characters from the portable character
    set in the current locale.  To be portable to both sets of rules,
    an abbreviation must therefore use only ASCII letters."  Adapted
    from tzcode2015f.

Errata Notice:	EN-16:19.tzcode
Submitted by:	bapt
Approved by:	so
2016-12-05 23:17:05 +00:00
Xin LI 356feb8285 Fix Fix OpenSSH remote Denial of Service vulnerability.
Security:	FreeBSD-SA-16:33.openssh
Approved by:	so
2016-11-02 07:23:19 +00:00
Gleb Smirnoff cd8f3c74f4 Revised SA-16:15. The initial patch didn't cover all possible overflows
based on passing incorrect parameters to sysarch(2). [1]

Fix unchecked array reference in the VGA device emulation code. [2]

Security:	SA-16:15 [1]
Security:       SA-16:32 [2]
Approved by:	so
2016-10-25 17:11:20 +00:00
Gleb Smirnoff a56209fc18 EN-16:18: loader may hang during boot
A programming error in GELIBoot causes the loader to attempt to read past
the end of the disk if the size of the final partition is not a multiple of
4 kB.

Merge r306834 from stable/11.

Approved by:	so
2016-10-25 16:50:10 +00:00
Glen Barber 34bd347501 Update releng/11.0 to 11.0-RELEASE-p1.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-28 23:06:03 +00:00
Ed Maste 0a66c4b08a MFS r306418: portsnap: only move expected snapshot contents from snap/ to files/
Previously it was possible to smuggle in addional files that would
be used by later portsnap runs. Now we only move those files expected
to be in the snapshot into files/ and require that there are no
unexpected files.

This was used by portsnap attacks 2, 3, and 4 in the "non-cryptanalytic
attacks against FreeBSD update components" anonymous gist.

Approved by:	re (gjb)
2016-09-28 22:04:07 +00:00
Ed Maste 336408d8fb Merge from stable/11 bspatch, portsnap, and libarchive fixes:
=== bspatch ===

MFS r306213: bspatch Capsicumization, sanity checks, and other improvements

r304691: bspatch: apply style(9)

Make style changes (and trivial refactoring of open calls) now in order
to reduce noise in diffs for future capsicum changes.

r304807 (allanjude): Capsicumize bspatch

Move all of the fopen() and open() calls to the top of main()

Restrict each FD to least privilege (read/seek only, write only, etc)

cap_enter(), and make all except the output FD read/seek only.

r304821: bspatch: remove output file in the case of error

r305486: bspatch: add sanity checks on sizes to avoid integer overflow

Note that this introduces an explicit 2GB limit, but this was already
implicit in variable and function argument types.

This is based on the "non-cryptanalytic attacks against freebsd
update components" anonymous gist. Further refinement is planned.

r305737: bspatch: remove superfluous newlines from errx strings

r305822: bspatch: use #define for header size instead of magic number

r306026: bspatch: Remove backwards-compatibility sys/capability.h support

bspatch previously included sys/capability.h or sys/capsicum.h based
on __FreeBSD_version, as FreeBSD is the upstream for bsdiff and we may
see this file incorporated into other third-party software.

The Capsicum header is now installed as sys/capsicum.h in stable/10 and
FreeBSD 10.3, so we can just use sys/capsicum.h and simplify the logic.

With this change, bspatch is identical between head, stable/11 and releng/11.0.

=== portsnap ===

MFS r305648 (delphij): MFC r305469:

Ensure that we always open only files that is named by explicitly
using shell redirections instead of having gzip(1) to decide what
file to open.

Issue reported in the "non-cryptanalytic attacks against freebsd
update components" anonymous gist.

=== libarchive ===

MFS r305754 (mm): MFC r305422:

Sync libarchive with vendor

Vendor issues fixed:
PR #777: Multiple bugfixes for setup_acls()

This includes a bugfix for a bug that caused ACLs not to be read properly
for files and directories inside subdirectories and as a result not being
stored or being incorrectly stored in tar archives.

MFS r306321 (mm): MFC r305819:

Sync libarchive with vendor including important security fixes.

Issues fixed (FreeBSD):
PR #778: ACL error handling
Issue #745: Symlink check prefix optimization is too aggressive
Issue #746: Hard links with data can evade sandboxing restrictions

This update fixes the vulnerability #3 and vulnerability #4 as reported in
"non-cryptanalytic attacks against FreeBSD update components".
https://gist.github.com/anonymous/e48209b03f1dd9625a992717e7b89c4f

Fix for vulnerability #2 has already been merged.

Approved by:	re (gjb), so (glebius)
2016-09-27 19:36:12 +00:00
Gleb Smirnoff 819ec55864 Merge r306343 by jkim:
Merge OpenSSL 1.0.2j.

Approved by:	so
Approved by:	re (implicit)
2016-09-26 20:26:19 +00:00
Glen Barber 671fb7df97 Prepare for 11.0-RELEASE builds.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 19:16:08 +00:00
Glen Barber 792e18eda4 Anticipate when we will be ready to announce 11.0-RELEASE.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 19:05:41 +00:00
Glen Barber 4372a8abb9 Statically set __FreeBSD_version for 11.0-RELEASE.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 19:04:08 +00:00
Glen Barber ee2ac57fcd Remove dual-revision entries, and prefer the latter, unbreaking
URLs to svnweb.

Submitted by:	jkim
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 18:51:37 +00:00
Glen Barber 512b217070 Add a link to the 'installation.html' section for freebsd-update(8)
usage information.

Suggested by:	theraven
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 18:31:50 +00:00
Glen Barber 67e9d9f440 Change the entity for arm64 from 'aarch64' to 'arm64'.
Submitted by:	emaste
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 18:19:12 +00:00
Glen Barber 17fd01f05d Document r306198, OpenSSL 1.0.2i.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-22 18:12:59 +00:00
Jung-uk Kim 17ed644781 MFS: r306195
Merge OpenSSL 1.0.2i.

Approved by:	re (gjb, implicit), so (delphij)
2016-09-22 15:55:27 +00:00
Bryan Drewery 60c3a17946 Regenerate.
Approved by:	re (gjb, implicit)
2016-09-21 21:30:46 +00:00
Bryan Drewery 3b2158e5ad Disable SYSTEM_COMPILER by default.
This is a direct commit to releng/11.0.

Having it enabled can lead to a situation where building
on one system and installing on another will fail due
to not finding cc in the OBJDIR.

An actual fix will be made on head separately.

PR:		212877
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
Approved by:	re (gjb)
2016-09-21 21:23:09 +00:00
Glen Barber 62bbb5c601 Add c++filt, missed in the previous commit.
Submitted by:	emaste
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 18:12:38 +00:00
Glen Barber 8802b72b4e Fix ELF Tool Chain revision for releng/11.0.
Replace elfcopy with objcopy/strip.

Submitted by:	emaste
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 18:07:06 +00:00
Glen Barber fe73edb427 Correct the entry for r291292, if_enc(4) was updated to be loaded via
kldload(8) during runtime, not newly added.

Submitted by:	Harry Schmalzbauer
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 15:29:35 +00:00
Glen Barber 33aff35778 - Remove various '[arch]' references where it is redundant.
- Further clarifications to the CUBIEBOARD2 kernel rename,
  iwn(4) addition, explicitly noting ia64 is Itanium(tm),
  various other fixes.

Submitted by:	theraven
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 15:26:38 +00:00
Glen Barber 7c79f14cff Document r301033 was sponsored by the FreeBSD Foundation.
Submitted by:	trasz
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 14:59:43 +00:00
Glen Barber 5b4e1ec6a8 Document r296177, dtsec(4) driver addition.
Document r298237, SMP booting for Book-E platforms was fixed.
Document r297001, Book-E can address up to 36-bits of physical RAM.
Document r297977, Book-E now supports e500mc and e5500.

Submitted by:	jhibbits
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 14:56:07 +00:00
Glen Barber f49310563e Document r291292, if_enc(4) addition.
Submitted by:	ae
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 14:19:01 +00:00
Glen Barber 613505b093 Document r298243, BIOS+UEFI addition to bsdinstall(8).
Submitted by:	martymac
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-21 14:11:18 +00:00
Glen Barber 190ecec782 Revise the entry for r287197, ifconfig(8) did not change, the wireless
networking stack changed.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 23:16:36 +00:00
Glen Barber ff7167d87b Document physical wireless devices are no longer listed by default
in ifconfig(8) output.

Submitted by:	woodsb02
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 23:04:39 +00:00
Glen Barber 0b2bc2f1d2 Fix an incorrect svn revision.
Link to the binmiscctl(8) manual in the r266531 entry.

Submitted by:	sbruno
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 22:05:52 +00:00
Glen Barber 89f3b03b54 Tweak the nvi(1) entry to be less clumsy-sounding.
Submitted by:	lidl
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 21:33:57 +00:00
Glen Barber 80f08e175b Tweak wording and add clarifications for several sections.
Submitted by:	dhw
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 20:32:35 +00:00
Glen Barber 1e9a4fa85c Update the manual page path for 11.0-RELEASE.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 19:15:39 +00:00
Glen Barber 7109dada7c Document r291716, camdd(8).
Submitted by:	ken
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 19:11:40 +00:00
Glen Barber 0d3ec54958 Document r297678, uuencode(1) '-r' option.
Document r302558, ul(1) truncation bug fix.

Submitted by:	gahr
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 18:38:16 +00:00
Glen Barber 11637f5724 Wording fixes and further clarifications.
Submitted by:	cperciva
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 18:02:16 +00:00
Glen Barber 08f8bf6588 Document r300779, dummynet(4) AQM addition.
Submitted by:	truckman
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 17:53:33 +00:00
Glen Barber 29479789b4 Document r289315, resolver reloads resolv.conf if mtime changes.
Fix a spacing nit while here.

Submitted by:	vangyzen
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 17:30:34 +00:00
Glen Barber 7d55fc9230 - Remove redundant wording.
- Update MK_ARM_EABI entry to note it is the default.
- Reword the entry for r290910.
- Fix various wording nits.
- Remove redundant '[arch]' tags where they are already specified.
- Various rewordings.

Submitted by:	theraven (first pass from his feedback)
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 17:26:02 +00:00
Glen Barber 827f2d8e5c Expand the r285387 entry to include information for cases where
NUMA may be disabled due to system BIOS.

Submitted by:	vangyzen
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:55:59 +00:00
Glen Barber 0be478f83f Update the entry for r279463, and move it to the correct
section.

Submitted by:	rstone
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:48:25 +00:00
Glen Barber 9fec72cb49 Fix a typo.
Submitted by:	vangyzen
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:39:41 +00:00
Glen Barber e20fd6cb7b Fix an incorrect revision.
Submitted by:	avos
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:36:55 +00:00
Glen Barber 6b44e7fe78 Document 285307, cloudabi
Submitted by:	ed
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:35:57 +00:00
Glen Barber 45bb561ccc Document r298002, NCQ TRIM support, CAM_IOSCHED_ADATPIVE.
Submitted by:	imp
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:30:59 +00:00
Glen Barber f411688074 Document bsdinstall(8) hardening menu.
Submitted by:	robak
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-20 16:14:42 +00:00
Glen Barber abefffa73c Connect the installation/article.xml to the build.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 19:18:40 +00:00
Glen Barber 51b0565b0b Add the installation documentation files.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 19:18:01 +00:00
Glen Barber 396875fe9e - Fix various entities in the release.ent file.
- Update the readme.html copyright year.
- Fix a malformed URL.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 18:40:54 +00:00
Glen Barber f1b919399c - Remove the Security Advisories and Errata Notices section, which
are not relevant for a dot-zero release.
- Reword the entry for r261498.
- Remove a duplicate entry.
- Document byacc(1) update to 20160324.
- Document mdocml(1) update to 20160116.
- Capitalize 'Sendmail'.
- Document svnlite(1) update to 1.9.4.
- Document tzdata update to 2015g.
- Reword the entry for r288090, and update upstream version.
- Reword the entry for r301169.
- Fix spacing for r296277 entry.
- Remove the empty 'Boot Menu', 'Ports', and 'Documentaton' sections.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 17:17:29 +00:00
Glen Barber 8b3112669f Sort by SVN revision.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 16:05:10 +00:00
Glen Barber e78b4e5988 Whitespace fixes to the 11.0 release notes. No content changes.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 15:39:24 +00:00
Glen Barber 640c199940 Remove entry for r304246.
Update entry for r299142.
Update entry for r260910.
Add entry for r296277.

Submitted by:	jhb, vangyzen
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-19 15:17:38 +00:00
Justin Hibbits 526e8ae9ee MF stable/11 r305901:
MFC r305894:

 Increase the boot1 file size on the HFS boot image.

 The boot1.elf is too fat for 30k, it's now 32k on powerpc64, and 34k on powerpc.
 Without this, boot1 will fail with odd behaviors.

Approved by:	re(gjb@)
2016-09-17 19:38:56 +00:00
Glen Barber ef384e0d40 Update releng/11.0 to RC3 status as part of the 11.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-14 00:00:11 +00:00
Glen Barber 368f1ba3f9 Switch the pkg(8) repository to use the 11.0 release package set for
consistent DVD image creation.

This is a direct commit to releng/11.0.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-09-13 22:56:21 +00:00
John Baldwin b3bc68d93c MFS11: 305776
Document PCI_HP and PCI_IOV kernel options and various tunables in pci(4).

Describe PCI-related kernel options for HotPlug and SR-IOV support in the
pci(4) manual page.  While here, add a section describing the various
tunables supported by the PCI bus driver as well.

Approved by:	re (gjb)
2016-09-13 17:51:51 +00:00
Andrew Turner 304fd4ea7a Merge from stable/11 305768:
Add a warning about a known erratum we have observed on ThunderX pass 1.1.
As this is evaluation hardware with only a few users, and there is a lack
of information add a warning when booting on this hardware.

Approved by:	re (gjb)
2016-09-13 16:33:33 +00:00
Andrew Turner c8fc89515f Merge from stable/11 305773:
Fix the arm64 kernel build when DDB is disabled, debug_monitor.c
depends on DDB, and is unused when it's disabled.

Approved by:	re (gjb)
2016-09-13 16:31:20 +00:00
Andrey V. Elsukov b46f188dc4 Merge from stable/11 r304415,304419 (by oleg):
Fix command: ipfw set (enable|disable) N (where N > 4).

PR:		212595
Approved by:	re (kib)
2016-09-12 15:57:35 +00:00
Warren Block 30c09759e3 Mention lme's new rc.subr subcommands, 'describe' and 'extracommands'.
Submitted by:	lme
Approved by:	re (gjb, implicit re@)
Sponsored by:	Essen Linuxhotel Hackathon 2016
2016-09-07 18:20:49 +00:00
Ed Maste 702af97a48 MFS r305423: cron: use existing maximum username constant MAXLOGNAME
Previously cron had its own maximum username length limit, which was
smaller than the system's MAXLOGNAME. This could lead to crontab -u
updating the wrong user's crontab (if the name was truncated, and
matched another user).

PR:		212305
Reported by:	Andrii Kuzik
Approved by:	re (kib)
MFH:		r305269
2016-09-05 16:43:57 +00:00
Martin Matuska ac40671ce0 MFS r305188:
MFC r304075,r304989:
    Sync libarchive with vendor including security fixes

    Vendor issues fixed:
    Issue #731: Reject tar entries >= INT64_MAX
    Issue #744: Very long pathnames evade symlink checks
    Issue #748: libarchive can compress, but cannot decompress zip some files
    PR #750: ustar: fix out of bounds read on empty string ("") filename
    PR #755: fix use of acl_get_flagset_np() on FreeBSD
    Issue #767: Buffer overflow printing a filename
    Issue #770: Zip read: be more careful about extra_length

  MFC r304874:
    Temporarily disable two libarchive tests that have not yet been fixed by
    vendor. Tests will be re-enabled after a fix has been merged.

Approved by:	re (gjb)
2016-09-03 00:27:41 +00:00
Glen Barber e38b3d3a99 Turn off debugging options in the arm64/aarch64 GENERIC kernel.
This is a direct commit to releng/11.0.

Approved by:	re (bdrewery)
Sponsored by:	The FreeBSD Foundation
2016-09-02 22:47:57 +00:00
Nathan Whitehorn bc37050e42 MFS11 r305250:
MFC r305108,305109:
Refix operation on sparse CPU mappings as in r302372, temporarily broken
by r304716.

PR:		kern/210106
Approved by:	re (gjb)
2016-09-02 01:41:57 +00:00
Nathan Whitehorn 584adb92ca MFS11 r305249:
MFC r305036:

Some versions of SLOF do not append the partition number to the boot
device argument to the stage-1 bootloader. In such cases, boot1 would
only try to read the entire device rather than checking for partitions.
Instead of panic'ing, fall back to reading the partitions as normal in
such situations. This was preventing boot of installed systems on some
versions of PowerKVM.

PR:		kern/211599
Approved by:	re (gjb)
2016-09-02 00:45:43 +00:00
Glen Barber 2c8efb0f82 MFS11 305232:
MFC r304966 (peter):
 The read-ahead code from r298230 made it likely the boot code would read
 beyond the end of disk. r298900 added code to prevent this.  Some BIOSes
 cause significant delays if asked to read past end-of-disk.

 We never trusted the BIOS to accurately report the sectorsize of disks
 before and this set of changes.  Unfortuately they interact badly with
 the infamous >2TB wraparound bugs.  We have a number of relatively-recent
 machines in the FreeBSD.org cluster where the BIOS reports 3TB disks as 1TB.

 With pre-r298900 they work just fine.  After r298900 they stop working if
 the boot environment attempts to access anything outside the first 1TB on
 the disk.  'ZFS: I/O error, all block copies unavailable' etc.  It affects
 both UFS and ZFS if they try to boot from large volumes.

 This change replaces the blind trust of the BIOS end-of-disk reporting
 with a read-ahead clip to prevent reads crossing the of end-of-disk
 boundary.  Since 2^32 (2TB) size reporting truncation is not uncommon,
 the clipping is done on 2TB aliases of the reported end-of-disk.
 ie: a 3TB disk reported as 1TB has readahead clipped at 1TB, 3TB, 5TB, ...
 as one of them is likely to be the real end-of-disk.

 This should make the loader on these broken machines behave the same as
 traditional pre-r298900 loader behavior, without disabling read-ahead.

PR:		212139
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-09-01 20:01:38 +00:00
Glen Barber badb1d48f4 Add an 'Important Notes' section before the 'Upgrading' section.
Document OpenSSH DSA key deprecation and removal of Protocol 1
support.

Approved by:	re (implicit, relnotes)
Sponsored by:	The FreeBSD Foundation
2016-08-30 13:26:00 +00:00
Glen Barber 3e1942ddba Document r292120, Update to ELF Tool Chain r3272
Document r299142, Native PCIe Hotplug support
Document r298166, libucl has been updated to version 0.8.0
Document r302288, Enable indirect segment I/O by default when running on EC2
Document r302265, Allow ZFS ARC min / max to be tuned at runtime
Document r299142, The leap-seconds file has been updated to
                  leap-seconds.3676752000
Document r302177, WITH_SYSTEM_COMPILER: Enable by default
Document r304246, PCIe HotPlug: Detect bridges that are not really
                  HotPlug capable
Document r301565, Switch arm64 to use intrng by default
Document r299781, Support for the Allwinner Reduced Serial Bus (RSB)
Document r296064, Support for Allwinner A20 HDMI
Document r299393, Default installation directory for modules is /boot/modules
Document r303716, Drop SSH1 support
Document r303719, Disable DSA by default
Document r297633, RCTL resources for limited filesystem IO
Document r300723, Mellanox implementation of iSER
Document r299848, Allow reroot to NFS
Document r301033, Discovery without attaching support in iscsictl
Document r299371, camcontrol reprobe
Document r295212, Add an additional, libucl-based configuration file parser
                  to ctld
Document r287842, Change default regulatory domain from DEBUG to FCC in ifconfig
Document r301875, The SIOCSIFALIFETIME_IN6 ioctl has been removed

These map to r304919, r304923, and r304929 from stable/11 from skreuzer@.

Approved by:	re (implicit, relnotes)
Sponsored by:	The FreeBSD Foundation
2016-08-29 23:57:00 +00:00
Glen Barber a3e93a9010 Update releng/11.0 to RC2 status as part of the 11.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-08-24 04:33:21 +00:00
Bryan Drewery e6e75a30c1 MFS r304717:
MFC r304697:

    FAST_DEPEND: Fix 'make all install' not properly rebuilding based on
    .depend.* files.

Approved by:	re (gjb)
2016-08-24 02:32:40 +00:00
Bryan Drewery dcbfdf410f MFS r304715:
MFC r304322:

    [net80211] correctly lock the ifp before accessing the lladdr.

Approved by:	re (gjb)
2016-08-24 02:31:03 +00:00
Bryan Drewery 506794cf4c MFS r304714:
MFC r304643:

    Fix building on read-only source trees.

PR:		211952
Approved by:	re (gjb)
2016-08-24 02:29:25 +00:00
Stephen Hurd ccf787d164 MFS r304704: Update iflib to support more NIC designs
- Move group task queue into kern/subr_gtaskqueue.c
- Change intr_enable to return an int so it can be detected if it's not
  implemented
- Allow different TX/RX queues per set to be different sizes
- Don't split up TX mbufs before transmit
- Allow a completion queue for TX as well as RX
- Pass the RX budget to isc_rxd_available() to allow an earlier return
  and avoid multiple calls

Approved by:	re (glb), davidch
Requested by:	shurd
2016-08-24 01:56:30 +00:00
Dimitry Andric 661075afaf MFC r304530:
Pull in r265122 from upstream llvm trunk (by James Molloy):

  Fix for pr24346: arm asm label calculation error in sub

  Some ARM instructions encode 32-bit immediates as a 8-bit integer
  (0-255) and a 4-bit rotation (0-30, even) in its least significant 12
  bits. The original fixup, FK_Data_4, patches the instruction by the
  value bit-to-bit, regardless of the encoding. For example, assuming
  the label L1 and L2 are 0x0 and 0x104 respectively, the following
  instruction:

    add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260

  would be assembled to the following, which adds 1 to r0, instead of
  260:

    e2800104 add r0, r0, #4, 2 ; equivalently 1

  The new fixup kind fixup_arm_mod_imm takes care of the encoding:

    e2800f41 add r0, r0, #260

  Patch by Ting-Yuan Huang!

This fixes label calculation for ARM assembly, and is needed to enable
ARM assembly sources for OpenSSL.

Approved by:	re (kib)
Requested by:	jkim
2016-08-23 17:38:06 +00:00
Konstantin Belousov 92e01550f4 MFC r304232:
In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
allocation unwinding.

Approved by:	re (gjb)
2016-08-23 12:22:35 +00:00
Mike Karels 71c931d251 MFC r304546: Disable L2 caching for UDP over IPv6
The ip6_output routine is missing L2 cache invalication as done
in ip_output.  Even with that code, some problems with UDP over
IPv6 have been reported.  Diabling L2 cache for that problem works
around the problem for now.

PR:             211872 211926
Reviewed by:    gnn
Approved by:    gnn (mentor)
Approved by:    re (gjb)
Tested by:      peter@, Mike Andrews
2016-08-22 22:29:57 +00:00
John Baldwin b5e2ba4f5a MF11 304617: Fix various nits in the aio operation manpages.
- Avoid double use of "request" in a single sentence.  Instead, describe
  aio_sigevent as being used to request notification of the associated
  operation's completion.  This matches the language used to describe
  aio_sigevent in aio(4).
- Simplify the prohibition on modifying buffers while requests are in
  flight.
- Fix case mismatch.
- Drop note about not using stack variables. C programmers should be able
  to figure out if a stack variable is safe based on the later warning
  about the life cycle requirements of control blocks.
- Remove prohibition on modifying the I/O buffer for aio_fsync() since
  it does not use an I/O buffer.  For aio_mlock(), prohibit modifications
  to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not
  prohibit modifications to the memory backing the buffer (stores into
  the pages backing the buffer).

Approved by:	re (kib)
2016-08-22 20:23:39 +00:00
Bryan Drewery 3e4c1aa52a MFS r304609:
MFC r304608:

    Bump __FreeBSD_version for C++11 thread_local support in r303795.

PR:             192320
Approved by:	re (gjb)
2016-08-22 16:04:25 +00:00
Konstantin Belousov 7573d5ed7d MFC r303794:
Create namespace for the symbols added during 12-CURRENT cycle.

MFC r303795:
Add __cxa_thread_atexit(3) API implementation.

Approved by:	re (gjb, bdrewery (?))
2016-08-22 07:38:44 +00:00
Baptiste Daroussin e2d4a6a8f3 Import Dragonfly Mail Agent snapshort from 20160806 aka v0.11+
Most important change being:
dma - Fix security hole

Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after
finding out from BSDNow Episode 152. Comments following were from his commit
which explains better than I. Just taking his change and putting it here as well.

* dma makes an age-old mistake of not properly checking whether a file
owned by a user is a symlink or not, a bug which the original mail.local
also had.

* Add O_NOFOLLOW to disallow symlinks.
Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked
about the mail.local bug.

Approved by:	re (kib)
2016-08-22 07:24:02 +00:00
Sepherosa Ziehau 2e1a0dde62 MFC 304251
hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.

    SRB status is set to 0x20 by the hypervisor, if the specified LUN is
    unaccessible, and even worse the INQUIRY response will not be set by
    the hypervisor at all under this situation.  Additionally, SRB status
    is 0x20 too, for TUR on an unaccessible LUN.

    Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
    Scott Long, other values seems improper.

    This commit fixes the Hyper-V disk hotplug support.

    Submitted by:   Hongjiang Zhang <honzhan microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7521

Approved by:	re (kib)
2016-08-22 05:38:44 +00:00
Dimitry Andric c1037f3947 MFC r304319:
Pull in r262772 from upstream clang trunk (by Simon Pilgrim):

  [X86] AMD Bobcat CPU (btver1) doesn't support XSAVE

  btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't
  support XSAVE.

  Differential Revision: http://reviews.llvm.org/D17682

Pull in r262782 from upstream llvm trunk (by Simon Pilgrim):

  [X86] AMD Bobcat CPU (btver1) doesn't support XSAVE

  btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't
  support XSAVE.

  Differential Revision: http://reviews.llvm.org/D17683

This ensures clang does not emit AVX instructions for CPUTYPE=btver1.

Approved by:	re (kib)
Reported by:	Michel Depeige <[email protected]>
PR:		211864
2016-08-20 13:29:58 +00:00
Bryan Drewery ed982599f0 MFS r304512:
MFC r304288:

    Garbage collect _umtx_lock(2)/_umtx_unlock(2) references removed in
    r263318.

Approved by:	re (gjb)
2016-08-20 11:59:19 +00:00
Michael Tuexen 37f9784baa MFC r304519:
* Use names for SCTP and UDPLite when reporting the input histogram.
* Fix the output for scope statistics.

Approved by: re (kib)
2016-08-20 11:42:08 +00:00
Baptiste Daroussin 5d8732b259 MFC r303354,303373,303404,304045,304192
Set date and time formats back to what they were before CLDR

While CLDR brings us a good and up to date source data to generate locales for
all databses we are using for locales, it is not the case of LC_TIME. Where it
does not defines the informations we need.

Put back all the date and time formats from the old locales.
Make it statically for now (in order to be able to merge it now into
11.0-RELEASE). The generation tools will be updated soon.

That gives us time to properly work on LC_TIME during the 12 timeframe.

While here fix abbreviated month for af_ZA (which are already fixed in CLDR
data upstream)

In locales where AP/PM was not defined before CLDR data, remove again the AP/PM
informations

For locales where AP/PM was defined before CLDR data, keep the CLDR information
which was properly translated.

r303354,303373 by kevlo
r303404,304192 by jkim

Approved by:	re (gjb)
2016-08-19 20:37:32 +00:00
Bryan Drewery e4a4adc85c MFS r304475:
MFC r304217:

    Trim unneeded bootstrap after r301470 made 9.1 the minimum supported
    release.

Approved by:	re (gjb)
2016-08-19 19:30:00 +00:00
Bryan Drewery b8112e2e89 MFS r304474:
MFC r304008:

    Avoid taking PROC_LOCK in syscalls if not being traced.

Approved by:	re (XXX)
2016-08-19 19:19:17 +00:00
Bryan Drewery daa9993e80 MFS r304472:
MFC r304006:

    Avoid showing the bootstrap make command for check-old, etc.

Approved by:	re (gjb)
2016-08-19 19:16:10 +00:00
Sean Bruno be17245afc MF stable11 r304337
e1000:  Add support for Kaby Lake IDs
        Fixup some errors when transitioning to/from low power states.

Approved by:	re (kib)
2016-08-19 19:02:18 +00:00
Bryan Drewery c0e055fae0 MFS r304470:
MFC r304005:

    PORTS_MODULES: Don't leak in CC/CXX/CPP.

Approved by:	re (gjb)
2016-08-19 18:40:47 +00:00
Bryan Drewery a34455d414 MFS r304469:
MFC r303929,r303930,r303931,r303932,r303933:

    r303929:
      Fix -S with -b not atomically updating the destination file.
    r303930:
      Support -v for -l.
    r303931:
      Fix -S with -l not being atomic.
    r303932:
      Fix -b failure not restoring flags on the destination file.
    r303933:
      Squelch a false-positive Clang static analyzer warning.

Approved by:	re (gjb)
2016-08-19 18:14:33 +00:00
Bryan Drewery 7eb5f0fd3c MFS r304144:
MFC r303964:

    PROGS: Support INTERNALPROG.prog=yes to not install it.

Approved by:	re (gjb)
2016-08-19 18:08:59 +00:00
Bryan Drewery 02c0075216 MFS r304143:
MFC r303934,r303937,r303942:

    r303934:
      Support rmdir(2).
    r303937:
      Use proper argument length for rmdir(2) for r303934.
    r303942:
      Fix sorting in r303934.

Approved by:	re (gjb)
2016-08-19 17:48:47 +00:00
Dag-Erling Smørgrav 5a26bb96ef MFH (r304142): ensure stripe size is non-zero multiple of 4096
PR:		211361
Approved by:	re (gjb)
2016-08-19 09:11:50 +00:00
Konstantin Belousov 34608b523e MFC r304011:
Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.

MFC r304012:
Fill phdr and phsize for rtld object.

Approved by:	re (gjb)
2016-08-19 08:44:37 +00:00
Eric van Gyzen b794f476db MFC r304433
PCIe HotPlug: Detect bridges that are not really HotPlug capable

Some devices report that they have an MRL when they actually
do not.  Since they always report that the MRL is open, child
devices would be ignored.  Try to detect these devices and
ignore their claim of HotPlug support.  Specifically,
if there is an open MRL but the Data Link Layer is active,
the MRL is not real.

Revert r303645 to re-enable HotPlug support for slots with
power controllers, since it works correctly in my testing.

Start the DLL state-change timer if Presence /or/ MRL state changes,
along with other conditions.  Previously, we started the timer iff
Presence changed.  If there is an MRL, it must be closed for power
to be turned on, so Presence is unlikely to change on an MRL-close event.

Add a printf() of interesting registers on HotPlug interrupts and
commands (one from erj@).  These were very useful for debugging.
Guard them with bootverbose, since they're spam in normal operation.

In collaboration with:	jhb
Relnotes:	yes (re-enable HotPlug support for slots with power controllers)
Approved by:	re (gjb)
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D7509
2016-08-18 22:01:52 +00:00
Michael Tuexen 99062cdd66 MFC r304428:
Ensure that sctp_it_ctl.cur_it does not point to a free object (during
a small time window).
Thanks to Byron Campen for reporting the issue and
suggesting a fix.

Approved by: re (kib)
2016-08-18 19:18:40 +00:00
Dimitry Andric a47474b311 Similar to r256297, disable assertions in llvm and clang for the
releng/11.0 branch.  This reduces the size of the clang executable, and
improves its performance.  Also bump FREEBSD_CC_VERSION.

Approved by:	re (gjb)
2016-08-17 07:07:29 +00:00
Ryan Stone f172e9db6f MFC r304163
Don't enqueue NULL on a drbr

    In one corner case in the bxe TX path, a NULL mbuf could be enqueued onto
    a drbr queue.  This could cause a KASSERT to fire with INVARIANTS enabled,
    or the processing of packets from the queue to be prematurely ended later
    on.

Submitted by: Matt Joras (matt.joras AT isilon.com)
Reviewed by:  davidcs
Sponsored by: EMC / Isilon Storage Division
Approved by:	re (kib)
Differential Revision:        https://reviews.freebsd.org/D7041
2016-08-15 19:18:10 +00:00
Ed Schouten c3b7936afe MFC r303923:
Make cpu_set_user_tls() work when called on the running thread.

  On all the other architectures, this function can also be called on the
  currently running thread. In this case, we shouldn't fix up the address
  in the PCB, but also patch up the register itself. Otherwise it will not
  become active and will simply become overwritten by the next switch.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D7437
Approved by: re
2016-08-15 17:58:12 +00:00
Baptiste Daroussin f4ef939946 MFC: r303685
truss: fix uninitialized trussinfo->curthread in add_threads()/enter_syscall

trussinfo->curthread must be initialized before calling enter_syscall(),
it is used by t->proc->abi->fetch_args().
Without that truss is segfaulting and the attached program also crash.

Submitted by:	Nikita Kozlov ([email protected])
Reviewed by:	jhb
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D7399
2016-08-15 08:20:37 +00:00
Steven Hartland dc45a739f1 MFS r304067:
Fix vtnet hang with max_virtqueue_pairs > VTNET_MAX_QUEUE_PAIR

Approved by:	re (gjb)
Sponsored by:	Multiplay
2016-08-15 08:07:07 +00:00
Michael Tuexen 12c212870e MFC r304082:
Improve a consistency check to not detect valid cases for
unordered user messages using DATA chunks as invalid ones.
While there, ensure that error causes are provided when
sending ABORT chunks in case of reassembly problems detected.
Thanks to Taylor Brandstetter for making me aware of this problem.

Approved by: re (gjb)
2016-08-15 05:07:02 +00:00
Mike Karels 9423e30951 MFC r303978: Fix kernel build with TCP_RFC7413 option
The current in_pcb.h includes route.h, which includes sockaddr structures.
Including <sys/socketvar.h> should require <sys/socket.h>; add it in
the appropriate place.

PR: 211385
Submitted by: Sergey Kandaurov and iron at mail.ua
Reviewed by: gnn
Approved by: gnn (mentor)
Approved by: re (gjb)
2016-08-14 18:30:30 +00:00
Andrey V. Elsukov 6b814739f1 Merge from stable/11 r304079:
Restore "nat global" support.

  Now zero value of arg1 used to specify "tablearg", use the old "tablearg"
  value for "nat global". Introduce new macro IP_FW_NAT44_GLOBAL to replace
  hardcoded magic number to specify "nat global". Also replace 65535 magic
  number with corresponding macro. Fix typo in comments.

  PR:		211256
Approved by:	re (kib)
2016-08-14 16:32:23 +00:00
Glen Barber 82d4204a10 MFs11 r304014:
MFC r303897:
  Pass overrides to make(1) when building ports for arm/armv6
  targets, similar to what is done for the run-autotools-fixup
  override for non-arm targets.

  While here, set SRCBRANCH in release.conf.sample to use
  releng/11.0, which is a direct commit to releng/11.0.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-08-12 19:26:12 +00:00
Glen Barber bfea20cf8b Fix still incorrect __FreeBSD_version values for stable/11 and releng/11.0
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-08-12 00:00:08 +00:00
Glen Barber 555a66dde3 Copy stable/11@r303970 to releng/11.0 as part of the 11.0-RELEASE
cycle.

Prune svn:mergeinfo from the new branch, and rename it to RC1.

Update __FreeBSD_version.

Use the quarterly branch for the default FreeBSD.conf pkg(8) repo and
the dvd1.iso packages population.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-08-11 23:39:23 +00:00
Andriy Gapon 56e01df652 MFC r303763,303791,303869: zfs: honour and make use of vfs vnode locking protocol
ZFS POSIX Layer is originally written for Solaris VFS which is very
different from FreeBSD VFS.  Most importantly many things that FreeBSD VFS
manages on behalf of all filesystems are implemented in ZPL in a different
way.
Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS
functionality or, in the worst cases, badly interacts / interferes
with VFS.

The most prominent problem is a deadlock caused by the lock order reversal
of vnode locks that may happen with concurrent zfs_rename() and lookup().
The deadlock is a result of zfs_rename() not observing the vnode locking
contract expected by VFS.

This commit removes all ZPL internal locking that protects parent-child
relationships of filesystem nodes.  These relationships are protected
by vnode locks and the code is changed to take advantage of that fact
and to properly interact with VFS.

Removal of the internal locking allowed all ZPL dmu_tx_assign calls to
use TXG_WAIT mode.

Another victim, disputable perhaps, is ZFS support for filesystems with
mixed case sensitivity.  That support is not provided by the OS anyway,
so in ZFS it was a buch of dead code.

To do:
- replace ZFS_ENTER mechanism with VFS managed / visible mechanism
- replace zfs_zget with zfs_vget[f] as much as possible
- get rid of not really useful now zfs_freebsd_* adapters
- more cleanups of unneeded / unused code
- fix / replace .zfs support

PR:		209158
Approved by:	re (gjb)
2016-08-11 20:48:03 +00:00
Andriy Gapon feb5de2dde MFC r302836: 6874 rollback and receive need to reset ZPL state to what's on disk
Approved by:	re (gjb)
2016-08-11 20:19:02 +00:00
Sean Bruno 98ceee8409 MFC r303816 r303847
- Update ixl(4) to Intel driver version ixl-1.6.6-k
- Fixup RSS builds of ixl(4) missed during testing.

Approved by:	re (gjb)
2016-08-11 19:13:30 +00:00
Andrew Gallatin e59af6421a MFC r303457:
Call tcp_notify() directly to shoot down routes

Approved by:	re (gjb)
2016-08-11 19:05:47 +00:00
Andrey V. Elsukov 5927bb68f7 MFC r303842:
Fix constructing of setdscp opcode with tablearg keyword.

  setdscp's argument can have zero value that conflicts with IP_FW_TARG
  value. Always set high-order bit if parser doesn't find tablearg keyword.

MFC r303845:
  Fix formatting of setfib opcode.

  Zero fib is correct value and it conflicts with IP_FW_TARG.
  Use bprint_uint_arg() only when opcode contains IP_FW_TARG,
  otherwise just print numeric value with cleared high-order bit.

Approved by:	re (kib)
2016-08-11 10:41:19 +00:00
Michael Tuexen bf248e5b67 MFC r303792:
Fix various bugs in relation to the I-DATA chunk support
This is joint work with rrs.

MFC r303793:
Mark an unused parameter as such.

MFC r303798:
Don't modify a structure without holding a reference count on it.

MFC r303813:
Remove stream queue entry consistently from wheel.
While there, improve the handling of drain.

MFC r303819:
Consistently check for unsent data on the stream queues.

MFC r303831:
Fix a locking issue found by stress testing with tsctp.
The inp read lock neeeds to be held when considering control->do_not_ref_stcb.

MFC r303834:
Fix the sending of FORWARD-TSN and I-FORWARD-TSN chunks. The
last SID/SSN pair wasn't filled in.
Thanks to Julian Cordes for providing a packetdrill script
triggering the issue and making me aware of the bug.

Approved by: re (kib)
2016-08-11 10:14:03 +00:00
Mateusz Guzik 5c401164bd MFC r303583:
amd64: implement pagezero using rep stos

The current implementation uses non-temporal writes. This turns out to
be detrimental to performance if the page is used shortly after, which
is the typical case with page faults.

Switch to rep stos.

Approved by:	re (gjb)
2016-08-11 09:30:25 +00:00
Mateusz Guzik 0b3fd3a792 MFC r303562,303563,r303584,r303643,r303652,r303655,r303707:
rwlock: s/READER/WRITER/ in wlock lockstat annotation

==

    sx: increment spin_cnt before cpu_spinwait in xlock

    The change is a no-op only done for consistency with the rest of the file.

==

    locks: change sleep_cnt and spin_cnt types to u_int

    Both variables are uint64_t, but they only count spins or sleeps.
    All reasonable values which we can get here comfortably hit in 32-bit range.

==

    Implement trivial backoff for locking primitives.

    All current spinning loops retry an atomic op the first chance they get,
    which leads to performance degradation under load.

    One classic solution to the problem consists of delaying the test to an
    extent. This implementation has a trivial linear increment and a random
    factor for each attempt.

    For simplicity, this first thouch implementation only modifies spinning
    loops where the lock owner is running. spin mutexes and thread lock were
    not modified.

    Current parameters are autotuned on boot based on mp_cpus.

    Autotune factors are very conservative and are subject to change later.

==

    locks: fix up ifdef guards introduced in r303643

    Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct
    define.

==

    locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case

==

    locks: fix sx compilation on mips after r303643

    The kernel.h header is required for the SYSINIT macro, which apparently
    was present on amd64 by accident.

Approved by:	re (gjb)
2016-08-11 09:28:49 +00:00
Dag-Erling Smørgrav 64f44a7c96 MFH (r303832): check whether each key file exists before adding it
PR:		208254
Approved by:	re (kib)
2016-08-11 08:29:15 +00:00
Alan Cox 7769821166 MFC r303773
Correct a spelling error.

Approved by:	re (kib)
2016-08-10 20:31:10 +00:00
Konstantin Belousov 9339dd728a MFC r303712:
Merge i386 and amd64 variants of mp_watchdog.c into x86/.

Approved by:	re (gjb)
2016-08-10 13:38:44 +00:00
Konstantin Belousov 2fb0221495 MFC r303710:
Remove unneeded (recursing) Giant acquisition around vprintf(9).

MFC r303715:
Remove ncl_printf(), use printf(9) directly.

Approved by:	re (gjb)
2016-08-10 12:53:30 +00:00
Konstantin Belousov 74fef9f0ed MFC r303704:
Some style changes.  Fix a typo in comment.

MFC r303705:
Remove Giant asserts.  Update comment.

Approved by:	re (gjb)
2016-08-10 12:34:49 +00:00
Konstantin Belousov 5f758babca MFC r303448:
Do not delegate a work to geom event thread which can be done inline.

MFC r303703:
Explain why swapgeom_close_ev() is delegated.

Approved by:	re (gjb)
2016-08-10 12:11:11 +00:00
Roger Pau Monné ae0777121b MFC r303488 and r303771:
xen-netfront: fix trying to send packets with disconnected netfront
xen-netfront: improve the logic when handling nic features from ioctl

Approved by:	re (kib)
2016-08-10 08:05:48 +00:00
Dimitry Andric b6d66342c8 MFC r303676:
Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
or "+" (these are invalid, because there is no preceding operand).

When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
invalid ? or + operators, some later logic in tre_compile_fast() goes
beyond the end of the buffer, leading to a crash.

Fix this by bailing out, and reporting a bad pattern instead.

Approved by:	re (gjb, kib)
Reported by:	Steve Kargl
2016-08-09 19:20:53 +00:00
John Baldwin 1c3a364ea3 MFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.
If a thread is created bound to a cpuset it might already be bound before
its very first timeslice, and td_lastcpu will be NOCPU in that case.

Approved by:	re (gjb)
2016-08-09 18:56:29 +00:00
Glen Barber bca3ac77d0 Update the SRCBRANCH for release.sh to use stable/11 as the
SRCBRANCH.

This is a direct commit to stable/11.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-08-09 15:59:57 +00:00
Luiz Otavio O Souza 9d9b3557fd MFC r303760:
Fix a regression in pf.conf while parsing the 'interval' keyword.

The bug was introduced by r287009.

PR:		210924
Submitted by:	kp@
Sponsored by:	Rubicon Communications (Netgate)
Pointy hat to:	loos
Approved by:	re (gjb)
2016-08-09 03:39:21 +00:00
Bryan Drewery 430c030f8a Regenerate for r303857.
Approved by:	re (gjb, implicit)
2016-08-08 21:19:57 +00:00
Bryan Drewery 19f8e59ed0 MFC r303755:
Still provide freebsd10_* symbols from libc for COMPAT10.

Approved by:	re (gjb)
2016-08-08 21:18:28 +00:00
Bryan Drewery d89bbe5d4b MFC r303729:
Correct some comments.

Approved by:	re (kib)
2016-08-08 20:23:11 +00:00
Bryan Drewery fc653de7d2 MFC r303687:
Add link for getnetgrent_r(3).

Approved by:	re (kib)
2016-08-08 20:15:00 +00:00
Bryan Drewery c81844ff3b MFC r303650:
opencrypto AES-ICM: Fix heap corruption typo

PR:		204009
Approved by:	re (kib)
2016-08-08 19:43:07 +00:00
Oleksandr Tymoshenko 2bf019fe8e MFC r303726
Fix EHCI driver by excluding first 512K from available memory

On Zynq 256K-512K memory region is not accessible by all bus masters.
EHCI driver fails when trying to use it for DMA transfers. Patching
memory node does not help because ubldr overrides values there with
the ones obtained from u-boot. So as a workaround we just mark first
512K as reserved.

PR:		211484
Submitted by:	Thomas Skibo <[email protected]>
Approved by:	re (gjb)
2016-08-08 17:53:51 +00:00
Eric van Gyzen 87dae3d674 MFC r303788
Fix some logic in PCIe HotPlug; display EI status

The interpretation of the Electromechanical Interlock Status was
inverted, so we disengaged the EI if a card was inserted.
Fix it to engage the EI if a card is inserted.

When displaying the slot capabilites/status with pciconf:

- We inverted the sense of the Power Controller Control bit,
  saying the power was off when it was really on (according to
  this bit).  Fix that.

- Display the status of the Electromechanical Interlock:
	EI(engaged)
	EI(disengaged)

Approved by:	re (gjb)
Sponsored by:	Dell Inc.
2016-08-08 15:07:38 +00:00
Glen Barber 89b97df36f MFC r303782:
Fix GCE image publication.  The gcutil utility is deprecated in favor
  of gcloud.

Approved by:	re (delphij, kib)
Sponsored by:	The FreeBSD Foundation
2016-08-08 07:16:13 +00:00
Sepherosa Ziehau 7e2ae2d882 MFC 303737
hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP support

    The Hyper-V on pre-win10 systems will only report SPC-2 conformance,
    but it actually conforms to SPC-3.  The INQUIRY response is adjusted
    to propagate the SPC-3 version information to CAM.

    Submitted by:   Hongjiang Zhang <honzhan microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7405

Approved by:	re (delphij)
2016-08-08 07:09:40 +00:00
Mariusz Zaborski 6a45f16d44 MFC r302966:
Fix nvlist array memory leak.

  When we change nvl_array_next to NULL it means that we want to destroy
  or take nvlist_array. The nvpair, which stores next nvlist of
  nvlist_array element is no longer needed and can be freed.

  Submitted by:	Adam Starak <[email protected]>
  Approved by:	re (gjb)
2016-08-08 06:33:57 +00:00
Mariusz Zaborski 4061526893 MFC r302965:
Fix memory leak in the nvlist string array.

  Submitted by: Adam Starak <[email protected]>
  Approved by:	re (gjb)
2016-08-08 06:29:25 +00:00
John Baldwin 695befa4f7 MFC 303076,303225: Use MTX_SYSINIT for the VESA lock.
303076:
vesa: fix panic on suspend

Fix the following panic seen when migrating a FreeBSD guest on Xen:

panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0
vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570
kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0
__mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630
vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680
vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0
isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0
bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame
[...]

This is caused because vga_sub_configure (which is called if the VGA adapter
is attached after VESA tried to initialize), points to vesa_configure, which
doesn't initialize the VESA mutex. In order to fix it, make sure
vga_sub_configure points to vesa_load, so that all the needed vesa
components are properly initialized.

303225:
Use MTX_SYSINIT for the VESA lock.

vesa_init_done isn't a reliable guard for the mutex init.  If
vesa_configure() doesn't find valid VESA info it will not set
vesa_init_done, but the lock will remain initialized.  Revert r303076
and use MTX_SYSINIT to deterministically init the lock.

PR:		209203
Approved by:	re (gjb)
2016-08-06 23:52:09 +00:00
Konstantin Belousov b8d810f1c9 MFC r303702:
Remove mention of Giant from the fork_return() description.

Approved by:	re (gjb)
2016-08-06 08:20:58 +00:00
John Baldwin d9b7b9d1f6 MFC 303406,303501: Fix panic when using aio_fsync().
303406:
Adjust tests in fsync job scheduling loop to reduce indentation.

303501:
Fix locking issues with aio_fsync().

- Use correct lock in aio_cancel_sync when dequeueing job.
- Add _locked variants of aio_set/clear_cancel_function and use those
  to avoid lock recursion when adding and removing fsync jobs to the
  per-process sync queue.
- While here, add a basic test for aio_fsync().

PR:		211390
Approved by:	re (kib)
2016-08-05 22:23:04 +00:00
John Baldwin 1abf18ad34 MFC 303497,303559,303645: Disable PCI-e hotplug on bridges with power
controllers.

303497:
Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug.

Some systems and/or devices (such as riser cards) do not include a
non-compliant implementation of PCI-e HotPlug that can result in devices
not being attached (e.g. the HotPlug code might assume that a card is
being unplugged and will power the slot off and detach it).  This
tunable can be set to 0 to disable support for PCI-e HotPlug ignoring
the incorrect HotPlug state on these slots.

303559:
Try to declare _hw_pci for all sysctl cases needed after r303497.

303645:
Disable PCI hotplug support for slots with power controllers.

After further review of the spec, I do not think the current HotPlug
code handles slots with power controllers correctly.  In particular,
the power state of the slot is to be inferred from other events, not
from examining the state of the power control bit in SLOT_CTL.  For now,
disable PCI hotplug support on such slots.

PR:		211081
Approved by:	re (gjb)
2016-08-05 18:41:51 +00:00
Alan Cox 817ff25c71 MFC r303492
Remove a probe declaration that has been unused since r292469, when
  vm_pageout_grow_cache() was replaced.

Approved by:	re (gjb)
2016-08-05 17:49:13 +00:00
Luiz Otavio O Souza b55da59d7a MFC r302988:
Fix a random memory overwrite at boot time, simplebus_init() and
simplebus_add_device() expect a simplebus_softc structure associated with
the device.

Add the simplebus_softc as first member in am335x_pwmss_softc structure.

Sponsored by:	Rubicon Communications (Netgate)
Approved by:	re (gjb)
2016-08-05 16:32:09 +00:00
Dag-Erling Smørgrav 44a8f55c90 MFH (r303716, r303719): drop SSH1 support, disable DSA by default
PR:		208254
Approved by:	re (gjb)
Relnotes:	yes
2016-08-05 15:32:35 +00:00
Dag-Erling Smørgrav ddbd946fa1 MFH (r303289): update example section
PR:		211361
Approved by:	re (gjb)
2016-08-05 15:30:05 +00:00
Andrey V. Elsukov e08ff22972 MFC r303657:
Fix NULL pointer dereference.
  ro pointer can be NULL when IPSec consumes mbuf.

  PR:		211486
Approved by:	re (gjb)
2016-08-05 15:12:29 +00:00
Ed Schouten 217f28eaa1 MFC r303486:
Mention that basename(3) and dirname(3) will change in the future.

  Update the existing manual pages for basename(3) and dirname(3) to
  mention that in future versions of FreeBSD, these functions will no
  longer use internal buffers for storing the results.

Approved by:	re@
2016-08-05 05:50:27 +00:00
Glen Barber 0117d25d6a Update stable/11 to BETA4 as part of the 11.0-RELEASE cycle.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-08-05 00:00:02 +00:00
Dimitry Andric 5ceddcfe35 MFC r303631:
Fix non-functional bsdinstall services dialog.

The most recent version of bsdinstall does not seem to respect any of
the checkboxes in the "Choose the services you would like to be started
at boot" dialog.  None of the chosen services end up in the rc.conf file
that is installed onto the target system.

This is caused by the bsdinstall/scripts/hardening script, which
implements the new hardening options dialog.  The script starts by
overwriting the previously written rc.conf.services file:

    echo -n > $BSDINSTALL_TMPETC/rc.conf.services

which is obviously incorrect.  It should clear out rc.conf.hardening
instead.

Approved by:	re (kib)
Reviewed by:	allanjude
PR:		211506
Differential Revision: https://reviews.freebsd.org/D7387
2016-08-04 17:26:32 +00:00
Konstantin Belousov b2dae14c49 MFC r303446:
Fix style and typo.

Approved by:	re (gjb)
2016-08-04 14:34:33 +00:00
Andrey V. Elsukov 2591ec4737 MFC r303615:
An old tables implementation had all tables preallocated,
  so when user did `ipfw table N flush` it always worked, but now
  when table N doesn't exist the kernel returns ESRCH error.
  This isn't fatal error for flush and destroy commands. Do not
  call err(3) when errno is equal to ESRCH. Also warn only when
  quiet mode isn't enabled. This fixes a regression in behavior,
  when old rules are loaded from file.
  Also use correct value for switch in the table_swap().

  Reported by:	Kevin Oberman
Approved by:	re (kib)
2016-08-04 11:26:52 +00:00
Brooks Davis 54acfab938 MFC r303104, r303106:
Update to reflect the fact that pipe() is a wrapper around the pipe2()
system call.

Reviewed by:	jhb, wblock
Sponsored by:	DAPRA, AFRL

Change wording to use function rather than system call in the
description
as well.

Authored by:	zeising
Reviewed by:	brooks

Approved by:	re (gjb)
Sponsored by:	DAPRA, AFRL
2016-08-03 16:10:53 +00:00
Brooks Davis 77dd9999ac MFC r303103:
Minor wording improvements to the note about pipe(2) removal.

Approved by:	re (gjb)
Sponsored by:	DARPA, AFRL
2016-08-03 15:39:58 +00:00
Roger Pau Monné b6581bf2a1 MFC r303490, r303491:
xen-intr: fix removal of event channels during resume
Revert r291022: x86/intr: allow mutex recursion in intr_remove_handler

Approved by:	re (kib)
2016-08-03 13:19:58 +00:00
Konstantin Belousov 794674b5d5 MFC r303393:
Remove empty initializer for the once facility.

Approved by:	re (gjb)
2016-08-03 10:18:52 +00:00
Mike Karels 89a705c439 MFC r303171: Fix per-connection L2 caching in fast path
r301217 re-added per-connection L2 caching from a previous change,
but it omitted caching in the fast path.  Add it.

Reviewed By: gallatin
Approved by: gnn (mentor)
Approved by: re (kostikbel)
Differential Revision: https://reviews.freebsd.org/D7239
2016-08-03 06:32:44 +00:00
Enji Cooper a4ba4f0efa MFC r302550,r302551,r302552,r302553:
Approved by: re (gjb)

r302550:

Deobfuscate cleanup path in clnt_dg_create(..)

Similar to r300836 and r301800, cl and cu will always be non-NULL as they're
allocated using the mem_alloc routines, which always use
`malloc(..., M_WAITOK)`.

Deobfuscating the cleanup path fixes a leak where if cl was NULL and
cu was not, cu would not be free'd, and also removes a duplicate test for
cl not being NULL.

CID: 1007033, 1007344

r302551:

Deobfuscate cleanup path in clnt_vc_create(..)

Similar to r300836, r301800, and r302550, cl and ct will always
be non-NULL as they're allocated using the mem_alloc routines,
which always use `malloc(..., M_WAITOK)`.

CID: 1007342

r302552:

Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to
ANSI C style prototypes

r302553:

Don't test for xpt not being NULL before calling svc_xprt_free(..)

svc_xprt_alloc(..) will always return initialized memory as it uses
mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..).

CID: 1007341
2016-08-03 01:06:51 +00:00
Enji Cooper 352ce54d0d MFC r302576:
Approved by: re (gjb)

r302576:

(Re-do r302574 with corrected commit message..)

Remove redundant declaration for tcp_dooptions

netinet/tcp_var.h already defines this function

PR:		209920
Tested with:	clang 3.8.0, gcc 4.2.1, gcc 5.3.0
2016-08-03 00:19:52 +00:00
Enji Cooper e6b932cf11 MFC r302571,r302572,r302577,r302841:
Approved by: re (gjb)

r302571:

Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix
-Wredundant-decls warning

PR:		209924
Tested with:	devel/amd64-gcc (5.3.0)

r302572:

Remove redundant declarations for intel_fbc_enabled(..) and
i915_gem_dump_object(..) to fix -Wredundant-decls warning

PR:		209924
Tested with:	devel/amd64-gcc (5.3.0)

r302577:

Add missing default case to capable(..) function definition

By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN
aren't possible. Add in a KASSERT safety belt and return false in
!INVARIANTS case if an invalid value is passed in, as it would be a
programmer error.

This fixes a -Wreturn-type error with gcc 5.3.0.

r302841:

Always panic if an invalid capability is passed to `capable(..)` instead of
just with INVARIANTS

rwatson's point was valid in the sense that if the data passed at runtime is
invalid, it should always trip the invariant, not just in the debug case.
This is a deterrent against malicious input, or input caused by hardware
errors.

Requested by: rwatson
2016-08-03 00:03:03 +00:00
Enji Cooper c4e2f7b840 MFC r302581:
Remove redundant declaration for tcp_dooptions, similar to r302576

netinet/tcp_var.h already defines this function

Approved by:	re (gjb)
PR:	209920
2016-08-02 23:34:59 +00:00
Bryan Drewery 653cfd1cdf MFC r303414,r303415,r303417:
r303414:
    opt_random.h was removed in r287558 for opt_global.h
  r303415:
    opt_apic.h is only used on i386.
  r303417:
    opt_bdg.h was removed in r150636.

Approved by:	re (gjb)
2016-08-02 20:56:00 +00:00
Bryan Drewery 3d95659a9b MFC r303410,r303419:
r303410:
    Reconnect pmcstudy, lost in r291021
  r303419:
    Fix non-amd64 build from r292043 after reconnecting in r303410.

Approved by:	re (kib)
2016-08-02 20:18:43 +00:00
Bryan Drewery b99d8e84b5 MFC r303328:
Add links for bit_ffc_at(3) and bit_ffs_at(3).

Approved by:	re (kib)
2016-08-02 19:41:54 +00:00
Brad Davis 8e44e7e022 MFC r303343: Fix the case for some sysctl descriptions.
Approved by:	re (gjb)
2016-08-02 18:46:11 +00:00
Sean Bruno 5dd6aeda91 MFC r303638
Unbreak NETMAP usage with em(4) broken in r293331.

Approved by:	re (gjb)
2016-08-02 15:43:18 +00:00
Gleb Smirnoff f4f76fbb39 Merge r303264 and corrections:
The date format for ru_RU.UTF-8 locale has changed some time ago, adjust
  the ru_RU.UTF-8 calendar files.

Approved by:	re (kib)
2016-08-02 14:14:36 +00:00
Gleb Smirnoff c4fd22683a Merge r303263:
Partially revert r257696/r257713, which have an issue with writing to user
  controlled address. Restore the old code that emulated OSIOCGIFCONF in if.c.

Approved by:	re (kib)
2016-08-02 13:57:20 +00:00
Alan Cox 62648ee887 MFC r303356 and r303465
Remove any mention of cache (PG_CACHE) pages from the comments in
  vm_pageout_scan().  That function has not cached pages since r284376.

Approved by:	re (kib)
2016-08-01 21:21:26 +00:00
Ed Maste ec7f75fb75 MFC r303396: rename ARM's libunwind.S to to avoid conflict with llvm libunwind
llvm libunwind includes a libunwind.cpp, but on ARM libunwind.S is found
first in .PATH. Rename the latter one, since it is not going to be
updated again.

Approved by:	re (kib)
2016-08-01 20:02:59 +00:00
Ed Maste 4aa8790f86 MFC r303338: vt: lock Giant around kbd calls in CONS_GETINFO
Note that keyboards are stored in an array and are not freed (just
"unregistered" by clearing some fields) so a race would be limited to
obtaining stale information about an unregistered keyboard.

Reported by:	CTurt
Approved by:	re (gjb, kib)
2016-08-01 19:50:28 +00:00
Sean Bruno 1d3ef50b29 MFC r303322,303326,303327,303345,303413,303416,303418,303557
Update iwm(4) and iwmfw(4) to current in order to stabilize and improve
functionality.

Approved by:    re (gjb)
2016-08-01 17:51:35 +00:00
Eric van Gyzen 2a36bd13a9 MFC r303520
Fix markup for -j in cpuset(1) synopsis

Approved by:	re (kib)
Sponsored by:	Dell Inc.
2016-08-01 16:39:40 +00:00
Eric van Gyzen 8223b18a34 MFC r303519
Fix two return types in the cpuset(9) and bitset(9) man pages

The *_FFS() and *_COUNT() functions return int, not size_t.

Approved by:	re (gjb)
Sponsored by:	Dell Inc.
2016-08-01 16:24:46 +00:00
Ed Maste af774f5c48 iMFC r303400: libcxxrt: fix demangling of wchar_t
'wchar_t' is 7 characters long, not 6. r303297 (MFC'd in r303398) fixed
this in libelftc, but not the second copy of this file that we have in
libcxxrt.

PR:		208661
Approved by:	re (gjb)
2016-08-01 16:18:01 +00:00
Ed Maste b196907c76 MFC r303521: libunwind: correct return code in unwinding trace log message
Approved by:	re (gjb)
2016-08-01 16:03:20 +00:00
Ed Maste 3e5f5fb53f MFC r303282: avoid building otusfw when WITHOUT_SOURCELESS_UCODE set
PR:		204748
Approved by:	re (kib)
2016-08-01 15:49:50 +00:00
Konstantin Belousov 072ec9c1e6 MFC r302614:
Revive the check, disabled in r197963.

MFC r302999:
On first exec after vfork(), call signotify() to handle pending
reenabled signals.

Approved by:	re (delphij)
2016-08-01 06:34:55 +00:00
Konstantin Belousov 5952003d11 MFC r303424:
Fix typo in comment.

Approved by:	re (gjb)
2016-07-31 15:13:51 +00:00
Dimitry Andric 6b6214dac7 MFC r303456:
Add tblgen to ObsoleteFiles.inc, as it was renamed to llvm-tblgen.

Approved by:	re (kib)
Noticed by:	pluknet
2016-07-31 15:03:31 +00:00
Colin Percival 64ad0a119e MFC r302929: Now that potentially buggy versions of Xen are automatically
detected (see r302635, MFCed as r302895), there is no need to force msix
interrupt migration off via loader.conf.

Reverts:	r302184
Approved by:	re (gjb)
2016-07-30 20:02:08 +00:00
Konstantin Belousov 4fb92ad6c6 MFC r303213:
Add missed required call to xo_finish() when only header is printed.

Approved by:	re (gjb)
2016-07-30 09:46:29 +00:00
Konstantin Belousov 8e0964970b MFC r303211:
Implement mtx_trylock_spin(9).

Approved by:	re (gjb)
2016-07-30 09:28:13 +00:00
Glen Barber 34c461de41 Update stable/11 to BETA3 as part of the 11.0-RELEASE cycle.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-29 00:00:54 +00:00
John Baldwin 175cfb44e1 MFC 303202: Update to note that operations on local files are safe.
Approved by:	re (gjb)
2016-07-28 21:16:18 +00:00
John Baldwin 442ba83795 MFC 303164: Add more documentation regarding unsafe AIO requests.
The asynchronous I/O changes made previously result in different
behavior out of the box. Previously all AIO requests failed with
ENOSYS / SIGSYS unless aio.ko was explicitly loaded. Now, some AIO
requests complete and others ("unsafe" requests) fail with EOPNOTSUPP.

Reword the introductory paragraph in aio(4) to add a general
description of AIO before describing the vfs.aio.enable_unsafe sysctl.

Remove the ENOSYS error description from aio_fsync(2), aio_read(2),
and aio_write(2) and replace it with a description of EOPNOTSUPP.

Remove the ENOSYS error description from aio_mlock(2).

Log a message to the system log the first time a process requests an
"unsafe" AIO request that fails with EOPNOTSUPP. This is modeled on
the log message used for processes using the legacy pty devices.

Approved by:	re (gjb)
2016-07-28 20:31:30 +00:00
Bartek Rutkowski 08abf7e29d MFC r302897:
Add new System Hardening menu and options to bsdinstall.

This patch add new 'hardening' file responsible for new bsdinstall
'System Hardening' menu allowing users to set some sane and carefully
picked system security options (like random process id's, hiding
other users/groups processes and others).

All options are OFF by default in this patch due to POLA principle
with intention to turn change some of them to ON by default in future.

Reviewed by:	adrian, allanjude, bdrewery, nwhitehorn
Approved by:	re@, adrian, allanjude
2016-07-28 15:54:17 +00:00
Konstantin Belousov bc225c5b51 MFC r303154:
Declare aio requests on files from local filesystems safe.

Approved by:	re (gjb)
2016-07-28 12:06:40 +00:00
Konstantin Belousov cc9d6d44c8 MFC r303151:
Provide counter_warning(9) KPI.

MFC r303155:
Hide counted_warning(9) under #ifdef _KERNEL braces.

Approved by:	re (gjb)
2016-07-28 11:43:25 +00:00
Cy Schubert d9d0114bbc MFC r303160.
Update leap-seconds to leap-seconds.3676752000.

As per https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16:

                                  UTC TIME STEP
                            on the 1st of January 2017

 A positive leap second will be introduced at the end of December 2016.
 The sequence of dates of the UTC second markers will be:

                          2016 December 31, 23h 59m 59s
                          2016 December 31, 23h 59m 60s
                          2017 January   1,  0h  0m  0s

 The difference between UTC and the International Atomic Time TAI is:

  from 2015 July 1, 0h UTC, to 2017 January 1 0h UTC   : UTC-TAI = - 36s
  from 2017 January 1, 0h UTC, until further notice    : UTC-TAI = - 37s

Obtained from:	ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3676752000
See also:	https://www.iers.org/SharedDocs/News/EN/BulletinC.html
	https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16

Relnotes:	yes

Approved by:	re@ (delphij@)
2016-07-27 19:39:25 +00:00
John Baldwin e103f9085a MFC 303109: Update crashinfo to work with newer gdb from ports.
If gdb from ports is installed, use it instead of the base system gdb
to extract variables from a kernel.  Note that base gdb and ports gdb
do not support the same options for invoking a single command in batch
mode, so a wrapper shell function is used.  In addition, prefer kgdb
from ports when generating a backtrace if present.

PR:		193335
Approved by:	re (gjb)
2016-07-27 17:55:14 +00:00
Ed Maste cc664b9bec MFC r303279: libelftc: fix demangling of wchar_t
"wchar_t" is 7 characters long, not 6.

PR:		208661
Submitted by:	Daniel McRobb
Approved by:	re (kib)
Obtained from:	ELF Tool Chain r3480
2016-07-27 17:10:09 +00:00
Konstantin Belousov 8c7b03fe3d MFC r303090:
Ensure that the UFS directory vnode' vm_object is properly sized
before UFS_BALLOC() is called.

Approved by:	re (delphij)
2016-07-27 08:47:24 +00:00
Enji Cooper a7da496a8f MFC r302842:
Don't delete usr/share/local/kk_KZ.UTF-8 with "make delete-old" after r302329

kk_KZ.UTF-8 was originally removed in r290494, but restored as an alias to
en_US.UTF-8 in r302329

Approved by: re (kib)
PR: 211046
2016-07-27 06:29:41 +00:00
Bryan Drewery 20528c390f MFC r303274:
Don't disable binutils/elftoolchain bootstrapping with external compiler.

Approved by:	re (kib)
2016-07-27 05:38:09 +00:00
Bryan Drewery fe543455a7 MFC r303272,r303273:
r303272:
    SYSTEM_COMPILER: Rework the logic to allow a 'make test-system-compiler'.
  r303273:
    Fix empty WANT_COMPILER_TYPE when neither compiler is bootstrapped.

Approved by:	re (kib)
2016-07-27 05:17:55 +00:00
Andriy Voskoboinyk 16542d14b1 MFC r303115:
urtwn: fix A-MSDU tx aggregation when encryption is used.

Clear unused (undocumented) CAM bytes while setting a key;
without that, hardware does weird things when A-MSDU bit in QoS header
is set.

Tested with RTL8188CUS (AP) -> RTL8188EU (STA) (A-MSDU transmit).

Reported by:	many
Approved by:	re (gjb)
Obtained from:	https://github.com/s3erios/urtwm
2016-07-26 20:26:03 +00:00
Ed Maste 6ebcad9859 MFC r303034: Include makewhatis in ITOOLS when MK_MAN_UTILS is true
Previously it was conditional on MK_MAN. It's possible to build
FreeBSD with man pages but without man page tools. MK_MAN_UTILS
is the conditional used in share/man/Makefile for determining whether
makewhatis is executed at install time, so it is the proper one for
ITOOLS as well.

PR:		210142
Approved by:	re (gjb)
2016-07-26 15:22:21 +00:00
Pedro F. Giffuni 0f0fde700e MFC r303046:
libc: tag the rune initialization function prototypes visibility as hidden.

It is good practice to export as few symbols as possible from your shared
libraries, so use the GCC visibility attribute in this case, matching what
Apple's libc does.

Reference:
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html

Hinted by:	Apple's libc 1082.20.4
Approved by:	re (gjb)
2016-07-26 14:12:11 +00:00
Emmanuel Vadot dc3a6704e6 MFC: r303039
Do not use TERM_EMU on arm and arm64 as it doesn't behave
well with serial console.

Approved by:	re (gjb)
2016-07-26 05:52:53 +00:00
Allan Jude 0b66401cb9 MFC: r302790, r302795
Add new menu to bsdinstall to allow user to set date and time after
selecting timezone. The 'skip' button is the default selection.

Submitted by:	des
Approved by:	re (gjb)
2016-07-26 05:27:26 +00:00
Allan Jude 20f9c96dbf MFC: r302940
Fix error in bsdinstall triggered when doing a GELI encrypted install to
an MBR formatted disk

Approved by:	re (gjb)
Sponsored by:	ScaleEngine Inc.
2016-07-26 05:26:53 +00:00
Allan Jude e6ca210e3c MFC: r302941
At the start of the installation process, all ZFS pools are exported and
all GELI instances are detached, to allow a restarted install to proceed.

PR:		210814
Approved by:	re (gjb)
2016-07-26 05:26:07 +00:00
John Baldwin 2eee535623 MFC 302899: Add documentation for the sigevent structure.
- Add a sigevent(3) manpage to give a general overview of the sigevent
  structure and the available notification mechanisms.
- Document that AIO requests contain a nested sigevent structure that can
  be used to request completion notification.
- Expand the sigevent details in other manuals to note details such as
  the extra values stored in a queued signal's information or in a posted
  kevent.

Approved by:	re (gjb)
2016-07-25 23:37:47 +00:00
Alan Somers 145b302821 MFC r303091
Fix camdd for host-aware and host-managed SMR disks.
This should've gone in as part of r300207

Approved by:	re (gjb)
2016-07-25 20:02:11 +00:00
Ed Maste ec3e770961 Merge LLVM libunwind fixes
r302475: libunwind: limit stack usage in unwind cursor

This may be reworked upstream but in the interim should address the
stack usage issue reported in the PR.

r303061: libunwind: Properly align _Unwind_Exception.

_Unwind_Exception is required to be double word aligned.  GCC has
interpreted this to mean "use the maximum useful alignment for the
target" so follow that lead.

PR:		206384 (r302475)
Obtained from:	LLVM review D22543 (r303061)
Approved by:	re (gjb)
2016-07-25 19:37:10 +00:00
John Baldwin 4bdfe407a6 MFC 302861: Fix rendering issues.
- Use Ta to separate column headers.
- Correct width of the 'Code' column in the last table.

Approved by:	re (gjb)
2016-07-25 19:16:49 +00:00
Bryan Drewery e7048d68e1 MFC r303195:
Don't run find(1) for __MPATH with NO_MODULES set.

Approved by:	re (gjb)
2016-07-25 18:25:19 +00:00
Bryan Drewery 7ce9a4edc5 MFC r303043:
Increase vt(4) framebuffer maximum size

PR:		210382
Approved by:	re (gjb)
2016-07-25 17:37:02 +00:00
Navdeep Parhar eb75c892ad MFC r303199:
ctld(8): Fix MaxBurstLength negotiation.

The target must reply with the selected value of MaxBurstSize instead of
just echoing back the initiator's offered value.

Reviewed by:	mav@
Approved by:	re@ (gjb@)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7278
2016-07-25 17:17:59 +00:00
John Baldwin bc301e9bf0 MFC 302860: Fix aio system call wrappers in librt.
- Update aio_return/waitcomplete wrappers for the ssize_t return type.
- Fix the aio_return() wrapper to fail with EINVAL on a pending job.
  This matches the semantics of the in-kernel system call.  Also,
  aio_return() returns errors via errno, not via the return value.

Approved by:	re (gjb)
Sponsored by:	Chelsio Communications
2016-07-25 15:56:37 +00:00
Pedro F. Giffuni 7177fe9271 MFC r302911:
mail(1): Avoid closing negative file descriptors.

CID:		1008105, 1008106
Approved by:	re (gjb)
2016-07-25 15:03:14 +00:00
Xin LI b02c62a3c7 Fix bspatch heap overflow vulnerability.
Obtained from:	Chromium
Reported by:	Lu Tung-Pin
Security:	FreeBSD-SA-16:25.bspatch
Approved by:	re (so@ blanket)
2016-07-25 14:52:12 +00:00
Xin LI ebfa5c38a7 MFC r302542:
Use _PATH_DEVNULL instead of hardcoding.

Approved by:	re (kib)
2016-07-25 14:35:48 +00:00
Ed Maste e247bac34b MFC r303157: libcxxrt: add padding in __cxa_allocate_* to fix alignment
The addition of the referenceCount to __cxa_allocate_exception put the
unwindHeader at offset 0x58 in __cxa_exception, but it requires 16-byte
alignment. In order to avoid changing the current __cxa_exception ABI
(and thus breaking its consumers), add explicit padding in the
allocation routines (and account for it when freeing).

This is intended as a lower-risk change for FreeBSD 11. A "more correct"
fix should be prepared for upstream and -CURRENT.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2016-07-25 14:16:28 +00:00
Konstantin Belousov ca17b3e53b MFC r302567:
In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called,
if vnode is VMIO.  For VMIO vnodes, set BO_DEAD in vm_object_terminate().

MFC r302580:
Fix grammar.

Approved by:	re (gjb)
2016-07-25 13:28:59 +00:00
Sean Bruno cf47860dd7 MFC r303032
Fixup DA cable detection routines to not set the cable type to
unknown if they do not match one of two cable types.

PR:		150249
Approved by:	re (gjb)
2016-07-24 16:32:34 +00:00
Michael Tuexen 0a91ab2b4e MFC r302904:
Fix a bug which results in a core dump when running netstat with
the -W option and having a listening SCTP socket.
The bug was introduced in r279122 when adding support for libxo.

MFC r302907:
When calling netstat -Laptcp the local address values are not aligned
with the corresponding entry in the table header. r295136
increased the value width from 14 to 32 without the corresponding
change to the table header. This commit adds the change to the table
header width.

MFC r302917:
Ensure that the -a, -W, -L options for SCTP behave similar
as for TCP.

MFC r302928:
Address a potential memory leak found a the clang static code analyzer
running on the userland stack.

MFC r302930:
Don't free a data chunk twice.
Found by the clang static code analyzer running for the userland stack.

MFC r302935:
Deal with a portential memory allocation failure, which was reported
by the clang static code analyzer.
Joint work with rrs@.

MFC r302942:
Add missing sctps_reasmusrmsgs counter.
Joint work with rrs@.

MFC r302945:
Don't duplicate code for SCTP, just use the ones used for UDP and TCP.
This fixes a bug with link local addresses. This will require and
upcoming change in the kernel to bring SCTP to the same behaviour
as UDP and TCP.

MFC r302949:
Fix the PR-SCTP behaviour.
This is done by rrs@.

MFC r302950:
Add a constant required by RFC 7496.

MFC r303024:
netstat and sockstat expect the IPv6 link local addresses to
have an embedded scope. So don't recover.

MFC r303025:
Use correct order of conditions to avoid NULL deref.

MFC r303073:
Fix a bug in deferred stream reset processing which results
in using a length field before it is set.
Thanks to Taylor Brandstetter for reporting the issue and
providing a fix.

Approved by:	re (kib)
2016-07-24 14:50:16 +00:00
Edward Tomasz Napierala bafd85eb9d MFC r303132:
Add documentation for "ctld -u", the UCL configuration file format.

Submitted by:	jceel@
Approved by:	re (kib)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7222
2016-07-24 10:00:29 +00:00
Baptiste Daroussin fbb4f11b70 MFC: r303219
Add weekday to the date format of more locales
Approved by:	re (kib)
2016-07-24 09:00:16 +00:00
Baptiste Daroussin 2dd8d7bbd6 iDo not try to delete the home of the user if is is not a directory for example
"/dev/null"

PR:		211195
Submitted by:	rday <[email protected]>
Reported by:	eniorm <[email protected]>
Approved by:	re (kib)
2016-07-24 08:12:23 +00:00
Alan Cox 82d9ac3773 MFC r303101
Add a comment describing the 'fast path' that was introduced in r270011.

Approved by:	re (gjb)
2016-07-23 21:56:52 +00:00
John Baldwin 4834b2493e MFC 302858: Move nested include of <sys/queue.h> inside _KERNEL.
This removes namespace pollution for userland brought in by r299122.

PR:		210319
Approved by:	re (kib)
2016-07-23 17:37:59 +00:00
Konstantin Belousov c11ee04c3d MFC r302936:
Explicitely check for the valid range of file descriptor values.

Approved by:	re (gjb)
2016-07-23 08:23:57 +00:00
Konstantin Belousov 7f38d1257c MFC r302919:
In ptrace_vm_entry(), do not call vmspace_free() while owning a vm
object lock.

Approved by:	re (gjb)
2016-07-22 17:34:58 +00:00
Ed Maste ae0d5ab157 MFC libunwind improvements
r302450: libunwind: update to upstream snapshot r272680

The key improvement is that it may be built without cross-unwinding
support, which significantly reduces the stack space requirement.

r302456: libunwind: enable only the native unwinder by default

This significantly reduces stack space requirements, and runtimes
require only native unwinding.

r302475: libunwind: limit stack usage in unwind cursor

This may be reworked upstream but in the interim should address the
stack usage issue reported in the PR.

r303016: llvm-libunwind: use conventional (non-Darwin) X86 register numbers

For historical reasons Darwin/i386 has ebp and esp swapped in the
eh_frame register numbering.  That is:

              Darwin      Other
    Reg #    eh_frame    eh_frame    DWARF
    =====    ========    ========    =====
      4        ebp         esp        esp
      5        esp         ebp        ebp

Although the UNW_X86_* constants are not supposed to be coupled to
DWARF / eh_frame numbering they are currently conflated in LLVM
libunwind, and thus we require the non-Darwin numbering.

PR:		206384
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-07-22 17:34:28 +00:00
Bryan Drewery 90216203de MFC r302908:
Fix dlsym(RTLD_NEXT) handling to only return the next library in last library
  cases.

Approved by:	re (gjb)
2016-07-22 17:24:36 +00:00
Konstantin Belousov 7b3203088f MFC r302893:
Do not allow creation of char or block special nodes with VNOVAL dev_t.

Approved by:	re (gjb)
2016-07-22 17:22:37 +00:00
Ed Maste 63ad51bcb7 MFC r303031: clang++: Always use --eh-frame-hdr on FreeBSD, even for -static
FreeBSD uses LLVM's libunwind on FreeBSD/arm64 today (and we expect to
use it more widely in the future) and it requires the EH frame segment
in static binaries.

Approved by:	re (kib)
2016-07-22 12:55:31 +00:00
Glen Barber 2f93a3f5d2 Update stable/11 to BETA2 as part of the 11.0-RELEASE cycle.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-22 00:00:09 +00:00
Ian Lepore e82dbd8760 Disable debugging options in arm configurations.
Approved by:	re (gjb)
2016-07-21 22:13:40 +00:00
Alan Cox 79a180b126 MFC r302980
Break up vm_fault()'s implementation of the read-ahead and delete-behind
  optimizations into two distinct pieces.  The first piece consists of the
  code that should only be performed once per page fault and requires the
  map to be locked.  The second piece consists of the code that should be
  performed each time a pager is called on an object in the shadow chain.
  (This second piece expects the map to be unlocked.)

  Previously, the entire implementation could be executed multiple times.
  Moreover, the second and subsequent executions would occur with the map
  unlocked.  Usually, the ensuing unsynchronized accesses to the map were
  harmless because the map was not changing.  Nonetheless, it was possible
  for a use-after-free error to occur, where vm_fault() wrote to a freed
  map entry.  This change corrects that problem.

Approved by:	re (gjb)
2016-07-21 20:11:43 +00:00
Gleb Smirnoff a0c0a67188 Merge r302894, r303098: fix regression caused by r302350. Stopping a
not scheduled not running callout should return (-1).

PR:		210884
Approved by:	re (gjb)
2016-07-21 19:18:49 +00:00
Konstantin Belousov 3702299d41 MFC r302981:
Fix another bug after r302350.

Approved by:	re (gjb)
2016-07-21 12:50:23 +00:00
Alexander Motin 864bf172c4 MFC r302960: Restore PIM_ATA_EXT flag handling, lost at r300207.
This re-enables NCQ TRIM usage on capable hardware (bhyve).

Approved by:	re (kib)
2016-07-21 12:15:04 +00:00
Alexander Motin 7af26f7839 MFC r302957: Fix NCQ TRIM emulation.
When this code was written, there was no guests using it to test.

Approved by:	re (kib)
2016-07-21 11:57:41 +00:00
Alexander Motin 71b6d270be Update if_hwassist when interface options are changed.
In particular for me this fixes checksum problem when if_bridge attached
to the interface requests TXCSUM to be disabled, but effectively ignored.

Approved by:	re (kib)
2016-07-21 11:39:43 +00:00
Glen Barber e08b42ec26 MFC r303003:
Make sure we clean up the rdoc and reldoc directories if NODOC
 is not set.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-07-21 10:44:26 +00:00
Baptiste Daroussin e7b6e41f23 MFC: r302916
Revert 302324 and properly fix the crash with ISO-8859-5 locales

PR:		211135
Reported by:	jkim
Tested by:	jkim
Approved by:	re (gjb)
2016-07-20 20:12:58 +00:00
Konstantin Belousov 3eeae56e70 MFC r302770:
Trace timeval parameters to the getitimer(2) and setitimer(2) syscalls.

Approved by:	re (gjb)
2016-07-20 15:02:37 +00:00
Pedro F. Giffuni 307a609d02 MFC r302973:
sed(1): Fix off by one introduced in r299211.

Detected by running the gsed tests.

Submitted by:	Mikhail Teterin
PR:		195929
Approved by:	re (gjb)
2016-07-20 04:45:59 +00:00
Stephen McConnell fe49fb6bb1 MFC r302673
Use real values to calculate Max I/O size instead of guessing.

Reviewed by:	ken, scottl
Approved by:	re(gjb), ken, scottl, ambrisko (mentors)
Differential Revision:	https://reviews.freebsd.org/D7043
2016-07-19 16:46:27 +00:00
Glen Barber 3380bc229c Reduce the disc1.iso size from 850+M to just over 650M.
As a result of this change, the 'kernel-dbg.txz' distribution
is no longer provided on disc1.iso, and deselected by default
in bsdinstall(8).  When 'kernel-dbg.txz' is selected, network
configuration happens before the installer proceeds, to fetch
the distribution from the mirrors.

This is a direct commit to stable/11, as there is intention
to solve this differently for 12.0-RELEASE.

Reviewed by:	nwhitehorn (glanced at)
Approved by:	re (hrs)
Sponsored by:	The FreeBSD Foundation
2016-07-19 16:22:50 +00:00
Dmitry Chagin e4cf35ba6c MFC r302518, r302626:
Add linux_mmap.c to the appropriate conf/files.

Approved by:	re (gjb)
2016-07-18 16:39:53 +00:00
Dmitry Chagin 94b49ea6f9 MFC r302517:
Fix a copy/paste bug introduced during X86_64 Linuxulator work.
FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation
use READ_IMPLIES_EXEC flag, introduced in r302515.

While here move common part of mmap() and mprotect() code to the files in compat/linux
to reduce code dupcliation between Linuxulator's

Approved by:	re (gjb)
2016-07-18 16:38:06 +00:00
Dmitry Chagin 2e33c30fe3 MFC r302516:
Regen for r302515 (Linux personality).

Approved by:	re (gjb)
2016-07-18 16:35:44 +00:00
Dmitry Chagin ffa95dadf4 MFC r302515:
Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag.
In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap().
Linux/i386 set this flag automatically if the binary requires executable stack.

READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit.

Approved by:	re (gjb)
2016-07-18 16:34:11 +00:00
Andriy Gapon 8da1d57aa9 MFC r302772: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of
snapshot's root

The change has been undone in r301275 on the assumption that it was no
longer required.  But that was incorrect, because in this case (and only
in this case) the snapshot root vnode is looked up before z_parent is
fixed up.

Approved by:	re (delphij)
2016-07-18 07:06:44 +00:00
Konstantin Belousov 4daa68ce2a MFC r302573:
Fill tf_trapno for trap frames created for syscall.

Approved by:	re (gjb)
2016-07-18 04:33:12 +00:00
Andrey V. Elsukov fded06be2a MFC r302561,302565:
Flush buffer after output. This fixes adding new data to already
  printed flows.

  PR:		210882
Approved by:	re (kib)
2016-07-18 04:16:53 +00:00
Pedro F. Giffuni 448c31efa2 MFC r302511, r302771, r302845:
mail(1): check for out of memory conditions when calling calloc(3).

Approved by:	re (gjb)
2016-07-17 18:23:20 +00:00
Jamie Gritton 00caa152f1 MFC r302857:
Start jails non-parallel if jail_parallel_start is NO.  This was true
  for an explicitly specified jail list; now it's also true for all jails.

PR:		209112
Approved by:	re (gjb)
2016-07-17 14:07:51 +00:00
Jamie Gritton 3e501082b8 MFC r302856:
Fix up the order in which jail creation processes are run, to preserve
  the config file's order in the non-parallel-start case.

PR:		209112
Approved by:	re (gjb)
2016-07-17 14:06:17 +00:00
Jamie Gritton abae7d14c4 MFC r302855:
Wait for jails to complete startup if jail_parallel_start is YES,
  instead of assuming they'll take less than one second.

PR:		203172
Submitted by:	[email protected]
Approved by:	re (gjb)
2016-07-17 14:05:11 +00:00
Eric van Gyzen 69e303843a MFC r302787
zpool(8): update Hot Spares section to mention zfsd(8)

Approved by:	re (gjb)
2016-07-16 15:52:14 +00:00
Dimitry Andric 3872d54617 MFC r302784:
Fix a page fault in ip6_setpktopt(), occurring when the pflog module is
loaded, and syncthing is started, which uses setsockopt(IPV6_PKGINFO).

This is because pflog interfaces do not normally have an IPv6 address,
causing the ND_IFINFO() macro to dereference a NULL pointer.

Approved by:	re (kib)
Reviewed by:	ae
PR:		210943
2016-07-16 10:50:28 +00:00
Don Lewis dc0822fbf6 MFC r302667
Fix problems in the FQ-PIE AQM cleanup code that could leak memory or
cause a crash.

Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup()
is not able to use callout_drain() to make sure that all callouts are
finished before it returns, and callout_stop() is not sufficient to make
that guarantee.  After pie_cleanup() returns, dummynet will free a
structure that any remaining callouts will want to access.

Fix these problems by allocating a separate structure to contain the
data used by the callouts.  In pie_cleanup(), call callout_reset_sbt()
to replace the normal callout with a cleanup callout that does the cleanup
work for each sub-queue.  The instance of the cleanup callout that
destroys the last flow will also free the extra allocated block of memory.
Protect the reference count manipulation in the cleanup callout with
DN_BH_WLOCK() to be consistent with all of the other usage of the reference
count where this lock is held by the dummynet code.

Submitted by:	Rasool Al-Saadi <[email protected]>
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D7174
2016-07-16 06:41:02 +00:00
Ian Lepore 7b3c77a2bb MFC r302502, r302505:
Consolidate debugging options from all arm kernel configs to std.arm[v6].

  Correct syntax errors that only show up when compiled with INVARIANTS.

Approved by:	re (gjb)
2016-07-15 21:30:19 +00:00
Mark Johnston 688500bf09 MFC r302507:
Avoid truncating the return value of DTrace predicates.

Approved by:	re (gjb)
2016-07-15 20:26:28 +00:00
Bryan Drewery 54859495fb MFC r302674:
META_MODE: Don't require filemon(4) for mergemaster(8)/etcupdate(8)

Approved by:	re (gjb)
2016-07-15 19:58:05 +00:00
Roger Pau Monné b9ca940a88 MFC r302635:
xen: automatically disable MSI-X interrupt migration

Approved by:	re (kib)
2016-07-15 09:44:48 +00:00
Sepherosa Ziehau 777eb5c818 MFC 302541,302605
302541
    hyperv/stor: Fix the INQUIRY checks

    Don't check the area that the host has not filled.

    PR:         https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443
    PR:         https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425
    Submitted by:       Hongjiang Zhang <honzhan microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6955

302605
    hyperv/stor: Save the response status and xfer length properly.

    The current command response handling discards status and xfer
    length unconditionally, so that all of the commands would be
    considered successful, even if errors happened.  When errors
    really happens, this causes all kinds of wiredness, since the
    buffer will not be filled on the host side and sense data will
    be ignored.

    Most of the time, errors do not happen, however, error does
    happen for the request sent immediately after the disk resizing.
    Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
    data (capacity changes) prevents the disk resizing from working
    properly.

    This commit saves the response status and xfer length properly
    for later use.

    Submitted by:       Dexuan Cui <decui microsoft com>
    Noticed by: sephe
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D7181

Approved by:	re (gjb)
2016-07-15 02:24:39 +00:00
Glen Barber 371ab94ebe Remove GENERIC-NODEBUG kernel configurations, missed during
the stable/11 branch.

This is a direct commit to stable/11.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-07-14 08:20:17 +00:00
Glen Barber 3617b98a01 Remove the 'debug.witness.trace' entry, as WITNESS is not
enabled on stable branches by default.

This is a direct commit to stable/11.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2016-07-14 08:19:25 +00:00
Pedro F. Giffuni 20b5df1c81 MFC r302476:
ng_mppc(4):: basic code readability cleanups.

In particular use __unreachable() to appease static analyzers.
No functional change.

CID:		1356591
Approved by:	re (gjb)
2016-07-13 15:51:58 +00:00
Bryan Drewery 78ef5a21aa MFC r302439:
iflib: Fix typo in 'iflib_rx_miss_bufs' sysctl name

Approved by:	re (gjb)
2016-07-12 17:22:13 +00:00
Edward Tomasz Napierala f909c41816 MFC r302503:
Fix ctld(8) to not exit when reloading configuration with invalid
initiator-portal clause.

Approved by:	re (gjb)
2016-07-12 13:12:01 +00:00
Ed Schouten 32f3c06b70 MFC r302448:
Don't forget to set sa->narg for CloudABI system calls.

  It turns out that this value is not used within the system call code
  under normal conditions, except when using tracing tools like ktrace.
  If we forget to set this value, it is set to random garbage. This may
  cause ktrace to hang indefinitely, making it impossible to kill.

Approved by: re@
Reported by: Michael Plass
PR: 210800
2016-07-12 06:25:28 +00:00
Enji Cooper 753105b560 MFC r302532:
Correct OLD_LIBS change done in r298840

libkvm.so lives in /lib, not /usr/lib

Approved by: re (gjb)
2016-07-12 06:06:10 +00:00
Glen Barber d9abcf2842 Fix the branch name in the release notes.
Approved by:	re (implicit, relnotes)
Sponsored by:	The FreeBSD Foundation
2016-07-11 14:24:50 +00:00
Xin LI d01da32b42 MFC r302534:
Allow - in distribution names.  This is needed for freebsd-update to
work with 11.0+, where the debugging symbols use a new naming scheme
for release distribution files.

Errata candidate.

Approved by:	re (gjb)
2016-07-11 04:50:32 +00:00
Glen Barber ed0c0d253f Turn off WITNESS, INVARIANTS, etc., in the powerpc GENERIC64
kernel configuration, missed after the stable/11 branch.

Approved by:	re (kib)
PR:		210974
Sponsored by:	The FreeBSD Foundation
2016-07-10 17:16:56 +00:00
Bryan Drewery 7977155c93 MFC r302449:
Use TARGET here to fix check/delete-old after r302391.

Approved by:	re (gjb)
2016-07-08 21:19:48 +00:00
Enji Cooper 607cd4258a MFC r302438:
Revert r302403

lang/gcc{48,49,5} lacks -fformat-extensions support (causing build errors, which
is what prompted r302403 to be committed). devel/amd64-gcc on the other hand
(which is used by Jenkins), has the support.

This fixes the Jenkins failure emails due to excessive warnings being produced
with "make buildkernel".

Discussed with: lwhsu
Approved by: re (gjb)
2016-07-08 18:54:28 +00:00
Glen Barber 2c6b98f515 Switch 11.0 from -ALPHA6 to -BETA1 to prepare for builds.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 00:26:38 +00:00
Glen Barber 1a3035ea7d Missed a few entries in the previous commit, documentation related.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 00:25:32 +00:00
Glen Barber 4a87fae024 - Remove debugging from GENERIC* kernel configurations
- Enable MALLOC_PRODUCTION
- Default dumpdev=NO
- Remove UPDATING entry regarding debugging features

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 00:22:14 +00:00
Glen Barber 913ef4fc33 Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 00:04:57 +00:00
1819 changed files with 192160 additions and 149732 deletions

No files matched your search

+6 -3
View File
@@ -131,7 +131,8 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
builddtb xdev xdev-build xdev-install \
xdev-links native-xtools stageworld stagekernel stage-packages \
create-world-packages create-kernel-packages create-packages \
packages installconfig real-packages sign-packages package-pkg
packages installconfig real-packages sign-packages package-pkg \
test-system-compiler
# XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
# It will only work for SUBDIR_TARGETS in make.conf.
@@ -151,7 +152,8 @@ TGTS+= ${BITGTS}
META_TGT_WHITELIST+= \
_* build32 buildfiles buildincludes buildkernel buildsoft \
buildworld everything kernel-toolchain kernel-toolchains kernel \
kernels libraries native-xtools showconfig tinderbox toolchain \
kernels libraries native-xtools showconfig test-system-compiler \
tinderbox toolchain \
toolchains universe world worlds xdev xdev-build
.ORDER: buildworld installworld
@@ -207,7 +209,8 @@ SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
.endif
_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
_MAKE= PATH=${PATH} MAKE_CMD=${MAKE} ${SUB_MAKE} -f Makefile.inc1 \
TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
# Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST
# above.
+58 -52
View File
@@ -72,7 +72,8 @@ X${COMPILER}?= ${${COMPILER}}
# If a full path to an external cross compiler is given, don't build
# a cross compiler.
.if ${XCC:N${CCACHE_BIN}:M/*}
MK_CROSS_COMPILER= no
MK_CLANG_BOOTSTRAP= no
MK_GCC_BOOTSTRAP= no
.endif
# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early.
@@ -80,50 +81,68 @@ MK_CROSS_COMPILER= no
.include "share/mk/src.opts.mk"
# Check if there is a local compiler that can satisfy as an external compiler.
.if ${MK_SYSTEM_COMPILER} == "yes" && ${MK_CROSS_COMPILER} == "yes" && \
(${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
!make(showconfig) && !make(native-xtools) && !make(xdev*)
# Which compiler is expected to be used?
.if ${MK_CLANG_BOOTSTRAP} == "yes"
_expected_compiler_type= clang
WANT_COMPILER_TYPE= clang
.elif ${MK_GCC_BOOTSTRAP} == "yes"
_expected_compiler_type= gcc
WANT_COMPILER_TYPE= gcc
.else
WANT_COMPILER_TYPE=
.endif
.if !defined(WANT_COMPILER_FREEBSD_VERSION)
.if ${WANT_COMPILER_TYPE} == "clang"
WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h
WANT_COMPILER_FREEBSD_VERSION!= \
awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \
${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown
WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc
WANT_COMPILER_VERSION!= \
awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
.elif ${WANT_COMPILER_TYPE} == "gcc"
WANT_COMPILER_FREEBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h
WANT_COMPILER_FREEBSD_VERSION!= \
awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \
${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown
WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER
WANT_COMPILER_VERSION!= \
awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \
${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
.endif
.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION
.endif # !defined(WANT_COMPILER_FREEBSD_VERSION)
# It needs to be the same revision as we would build for the bootstrap.
# If the expected vs CC is different then we can't skip.
# GCC cannot be used for cross-arch yet. For clang we pass -target later if
# TARGET_ARCH!=MACHINE_ARCH.
.if ${_expected_compiler_type} == ${COMPILER_TYPE} && \
(${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH})
# It needs to be the same revision as we would build for the bootstrap.
.if !defined(CROSS_COMPILER_FREEBSD_VERSION)
.if ${_expected_compiler_type} == "clang"
CROSS_COMPILER_FREEBSD_VERSION!= \
awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \
${SRCDIR}/lib/clang/freebsd_cc_version.h || echo unknown
CROSS_COMPILER_VERSION!= \
awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
${SRCDIR}/lib/clang/include/clang/Basic/Version.inc || echo unknown
.elif ${_expected_compiler_type} == "gcc"
CROSS_COMPILER_FREEBSD_VERSION!= \
awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \
${SRCDIR}/gnu/usr.bin/cc/cc_tools/freebsd-native.h || echo unknown
CROSS_COMPILER_VERSION!= \
awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \
${SRCDIR}/contrib/gcc/BASE-VER || echo unknown
.endif
.export CROSS_COMPILER_FREEBSD_VERSION CROSS_COMPILER_VERSION
.endif # !defined(CROSS_COMPILER_FREEBSD_VERSION)
.if ${COMPILER_VERSION} == ${CROSS_COMPILER_VERSION} && \
${COMPILER_FREEBSD_VERSION} == ${CROSS_COMPILER_FREEBSD_VERSION}
.if ${MK_SYSTEM_COMPILER} == "yes" && \
(${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
!make(showconfig) && !make(native-xtools) && !make(xdev*) && \
${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \
(${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
# Everything matches, disable the bootstrap compiler.
MK_CLANG_BOOTSTRAP= no
MK_GCC_BOOTSTRAP= no
.if make(buildworld)
USING_SYSTEM_COMPILER= yes
.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE}
USING_SYSTEM_COMPILER?= no
TEST_SYSTEM_COMPILER_VARS= \
USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \
MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \
WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \
WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \
CC COMPILER_TYPE COMPILER_VERSION COMPILER_FREEBSD_VERSION
test-system-compiler: .PHONY
.for v in ${TEST_SYSTEM_COMPILER_VARS}
${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}"
.endfor
.if ${USING_SYSTEM_COMPILER} == "yes" && \
(make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \
make(toolchain) || make(_cross-tools))
.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler.
.endif
.endif # ${COMPILER_VERSION} == ${CROSS_COMPILER_VERSION}
.endif # ${_expected_compiler_type} == ${COMPILER_TYPE}
.endif # ${XCC:N${CCACHE_BIN}:M/*}
# For installworld need to ensure that the looked-up compiler metadata is
# passed along rather than trying to run cc from the restricted
@@ -530,8 +549,7 @@ BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
.endif
# External compiler needs sysroot and target flags.
.if ${MK_CROSS_COMPILER} == "no" || \
(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
.if ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"
.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
BFLAGS+= -B${WORLDTMP}/usr/bin
.endif
@@ -559,7 +577,7 @@ TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
XCFLAGS+= -target ${TARGET_TRIPLE}
.endif
XCFLAGS+= --sysroot=${WORLDTMP}
.endif # ${MK_CROSS_COMPILER} == "no"
.endif # ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"
.if !empty(BFLAGS)
XCFLAGS+= ${BFLAGS}
@@ -884,7 +902,7 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
${LOCAL_ITOOLS}
# Needed for share/man
.if ${MK_MAN} != "no"
.if ${MK_MAN_UTILS} != "no"
ITOOLS+=makewhatis
.endif
@@ -1561,10 +1579,6 @@ _groff= gnu/usr.bin/groff \
_vtfontcvt= usr.bin/vtfontcvt
.endif
.if ${BOOTSTRAPPING} < 900002
_sed= usr.bin/sed
.endif
.if ${BOOTSTRAPPING} < 1000033
_libopenbsd= lib/libopenbsd
_m4= usr.bin/m4
@@ -1603,10 +1617,6 @@ _crunchide= usr.sbin/crunch/crunchide
_crunchgen= usr.sbin/crunch/crunchgen
.endif
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
_awk= usr.bin/awk
.endif
# r296926 -P keymap search path, MFC to stable/10 in r298297
.if ${BOOTSTRAPPING} < 1003501 || \
(${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103)
@@ -1674,7 +1684,6 @@ bootstrap-tools: .PHONY
${_gperf} \
${_groff} \
${_dtc} \
${_awk} \
${_cat} \
${_dd} \
${_kbdcontrol} \
@@ -1682,7 +1691,6 @@ bootstrap-tools: .PHONY
${_libopenbsd} \
${_makewhatis} \
usr.bin/rpcgen \
${_sed} \
${_yacc} \
${_m4} \
${_lex} \
@@ -1800,7 +1808,6 @@ _elftctools= lib/libelftc \
usr.bin/elfcopy
.endif
.if ${MK_CROSS_COMPILER} != "no"
.if ${MK_CLANG_BOOTSTRAP} != "no"
_clang= usr.bin/clang
_clang_libs= lib/clang
@@ -1808,7 +1815,6 @@ _clang_libs= lib/clang
.if ${MK_GCC_BOOTSTRAP} != "no"
_cc= gnu/usr.bin/cc
.endif
.endif
.if ${MK_USB} != "no"
_usb_tools= sys/boot/usb/tools
.endif
@@ -2356,11 +2362,11 @@ check-old-dirs: .PHONY
done
delete-old: delete-old-files delete-old-dirs .PHONY
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
@echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'."
check-old: check-old-files check-old-libs check-old-dirs .PHONY
@echo "To remove old files and directories run '${MAKE} delete-old'."
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
@echo "To remove old files and directories run '${MAKE_CMD} delete-old'."
@echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'."
.endif
+2 -2
View File
@@ -81,8 +81,8 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat}
LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include
# Force using libc++ for external GCC.
# XXX: This should be checking MK_GNUCXX == no
.if ${X_COMPILER_VERSION} >= 40800 && (${MK_CROSS_COMPILER} == "no" || \
(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"))
.if ${X_COMPILER_VERSION} >= 40800 && \
(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
-nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++
.endif
+3 -9
View File
@@ -203,7 +203,7 @@ OLD_FILES+=usr/share/man/man9/rman_await_resource.9.gz
# 20160517: ReiserFS removed
OLD_FILES+=usr/share/man/man5/reiserfs.5.gz
# 20160430: kvm_getfiles(3) removed from kvm(3)
OLD_LIBS+=usr/lib/libkvm.so.6
OLD_LIBS+=lib/libkvm.so.6
OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz
# 20160423: remove mroute6d
OLD_FILES+=etc/rc.d/mroute6d
@@ -229,6 +229,7 @@ OLD_LIBS+=usr/lib/libdevinfo.so.5
OLD_LIBS+=usr/lib32/libdevinfo.so.5
# 20160305: new clang import which bumps version from 3.7.1 to 3.8.0.
OLD_FILES+=usr/bin/macho-dump
OLD_FILES+=usr/bin/tblgen
OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/allocator_interface.h
OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/asan_interface.h
OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/common_interface_defs.h
@@ -460,13 +461,6 @@ OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_MONETARY
OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_NUMERIC
OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_TIME
OLD_DIRS+=usr/share/locale/kk_KZ.PT154/
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_COLLATE
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_CTYPE
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MESSAGES
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MONETARY
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_NUMERIC
OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_TIME
OLD_DIRS+=usr/share/locale/kk_KZ.UTF-8
OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_COLLATE
OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_CTYPE
OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_TIME
@@ -8014,7 +8008,7 @@ OLD_FILES+=usr/share/man/man5/usbd.conf.5.gz
.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
OLD_FILES+=usr/share/man/man8/boot_i386.8.gz
.endif
.if ${TARGET_ARCH} != "aarch64" && ${TARGET_CPUARCH} != "arm" && \
.if ${TARGET_ARCH} != "aarch64" && ${TARGET} != "arm" && \
${TARGET_ARCH} != "powerpc" && ${TARGET_ARCH} != "powerpc64" && \
${TARGET_ARCH} != "sparc64"
OLD_FILES+=usr/share/man/man8/ofwdump.8.gz
+103 -19
View File
@@ -16,28 +16,112 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to
the tip of head, and then rebuild without this option. The bootstrap process
from older version of current across the gcc/clang cutover is a bit fragile.
NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
FreeBSD 11.x has many debugging features turned on, in both the kernel
and userland. These features attempt to detect incorrect use of
system primitives, and encourage loud failure through extra sanity
checking and fail stop semantics. They also substantially impact
system performance. If you want to do performance measurement,
benchmarking, and optimization, you'll want to turn them off. This
includes various WITNESS- related kernel options, INVARIANTS, malloc
debugging flags in userland, and various verbose features in the
kernel. Many developers choose to disable these features on build
machines to maximize performance. (To completely disable malloc
debugging, define MALLOC_PRODUCTION in /etc/make.conf, or to merely
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20171129 p16 FreeBSD-SA-17:11.openssl
Fix multiple vulnerabilities of OpenSSL.
20171115 p15 FreeBSD-SA-17:08.ptrace
FreeBSD-SA-17:10.kldstat
Fix ptrace(2) vulnerability. [SA-17:08.ptrace]
Fix kldstat(2) vulnerability. [SA-17:10.kldstat]
20171102 p14 FreeBSD-EN-17:09.tzdata
Update timezone database information. [EN-17:09]
20171017 p13 FreeBSD-SA-17:07.wpa
Fix WPA2 protocol vulnerability. [SA-17:07]
20170810 p12 FreeBSD-SA-17:06.openssh
FreeBSD-EN-17:07.vnet
Fix OpenSSH Denial of Service vulnerability. [SA-17:06]
Fix VNET kernel panic with asynchronous I/O. [EN-17:07]
20170712 p11 FreeBSD-SA-17:05.heimdal
Fix heimdal KDC-REP service name validation vulnerability.
20170427 p10 FreeBSD-SA-17:04.ipfilter
Fix ipfilter(4) fragment handling panic. [SA-17:04]
20170412 p9 FreeBSD-SA-17:03.ntp
FreeBSD-EN-17:05.xen
Fix multiple vulnerabilities of ntp. [SA-17:03]
Xen migration enhancements. [EN-17:05]
20170223 p8 FreeBSD-SA-17:02.openssl
FreeBSD-EN-17:01.pcie
FreeBSD-EN-17:02.yp
FreeBSD-EN-17:03.hyperv
FreeBSD-EN-17:04.mandoc
Fix multiple vulnerabilities of OpenSSL. [SA-17:02]
Fix system hang when booting when PCI-express HotPlug is enabled.
[EN-17:01]
Fix NIS master updates are not pushed to NIS slave. [EN-17:02]
Fix compatibility with Hyper-V/storage after KB3172614 or
KB3179574. [EN-17:03]
Make makewhatis output reproducible. [EN-17:04]
20170111 p7 FreeBSD-SA-17:01.openssh
Fix multiple vulnerabilities of OpenSSH.
20161222 p6 FreeBSD-SA-16:39.ntp
Fix multiple vulnerabilities of ntp.
20161208 p5 FreeBSD-SA-16:37.libc [revised]
Fix regressions introduced by SA-16:37.libc.
20161206 p4 FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-SA-16:38.bhyve
FreeBSD-EN-16:19.tzcode
FreeBSD-EN-16:20.tzdata
FreeBSD-EN-16:21.localedef
Fix possible login(1) argument injection in telnetd(8). [SA-16:36]
Fix link_ntoa(3) buffer overflow in libc. [SA-16:37]
Fix possible escape from bhyve(8) virtual machine. [SA-16:38]
Fix warnings about valid time zone abbreviations. [EN-16:19]
Update timezone database information. [EN-16:20]
Fix incorrectly defined unicode character(s). [EN-16:21]
20161102 p3 FreeBSD-SA-16:33.openssh
Fix Fix OpenSSH remote Denial of Service vulnerability.
20161025 p2 FreeBSD-SA-16:15.sysarch [revised]
FreeBSD-SA-16:32.bhyve
Fix incorrect argument validation in sysarch(2). [SA-16:15]
Fix access to host memory from guest in bhyve(8). [SA-16:32]
20160928:
11.0-RELEASE.
20160622:
The libc stub for the pipe(2) system call has been replaced with
a wrapper which calls the pipe2(2) system call and the pipe(2) is now
only implemented by the kernels which include "options
COMPAT_FREEBSD10" in their config file (this is the default).
Users should ensure that this option is enabled in their kernel
or upgrade userspace to r302092 before upgrading their kernel.
a wrapper that calls the pipe2(2) system call and the pipe(2)
system call is now only implemented by the kernels that include
"options COMPAT_FREEBSD10" in their config file (this is the
default). Users should ensure that this option is enabled in
their kernel or upgrade userspace to r302092 before upgrading their
kernel.
20160527:
CAM will now strip leading spaces from SCSI disks' serial numbers.
+1
View File
@@ -612,6 +612,7 @@ main(int argc, char *argv[])
if (nkept == 0) {
printheader();
xo_finish();
exit(1);
}
+11 -7
View File
@@ -465,6 +465,15 @@ place in the configuration, and is removed from the spare list of all active
pools.
.Pp
Spares cannot replace log devices.
.Pp
This feature requires a userland helper.
FreeBSD provides
.Xr zfsd 8
for this purpose.
It must be manually enabled by adding
.Va zfsd_enable="YES"
to
.Pa /etc/rc.conf .
.Ss Intent Log
The
.Tn ZFS
@@ -2023,7 +2032,8 @@ Discarded approximately 29 seconds of transactions.
.El
.Sh SEE ALSO
.Xr zpool-features 7 ,
.Xr zfs 8
.Xr zfs 8 ,
.Xr zfsd 8
.Sh AUTHORS
This manual page is a
.Xr mdoc 7
@@ -2040,9 +2050,3 @@ The
.Xr mdoc 7
implementation of this manual page was initially written by
.An Martin Matuska Aq [email protected] .
.Sh CAVEATS
The
.Cm spare
feature requires a utility to detect zpool degradation and initiate
disk replacement within the zpool.
FreeBSD does not provide such a utility at this time.
+1 -1
View File
@@ -1 +1 @@
v0.10
v0.11
+1 -1
View File
@@ -142,7 +142,7 @@ main(int argc, char **argv)
logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user);
}
f = open(fn, O_RDONLY|O_CREAT, 0600);
f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600);
if (f < 0)
logfail(EX_NOINPUT, "cannt open mbox `%s'", fn);
+2 -2
View File
@@ -321,7 +321,7 @@ deliver(struct qitem *it)
snprintf(errmsg, sizeof(errmsg), "unknown bounce reason");
retry:
syslog(LOG_INFO, "trying delivery");
syslog(LOG_INFO, "<%s> trying delivery", it->addr);
if (it->remote)
error = deliver_remote(it);
@@ -331,7 +331,7 @@ retry:
switch (error) {
case 0:
delqueue(it);
syslog(LOG_INFO, "delivery successful");
syslog(LOG_INFO, "<%s> delivery successful", it->addr);
exit(EX_OK);
case 1:
+1 -1
View File
@@ -49,7 +49,7 @@
#define VERSION "DragonFly Mail Agent " DMA_VERSION
#define BUF_SIZE 2048
#define ERRMSG_SIZE 200
#define ERRMSG_SIZE 1024
#define USERNAME_SIZE 50
#define MIN_RETRY 300 /* 5 minutes */
#define MAX_RETRY (3*60*60) /* retry at least every 3 hours */
+1
View File
@@ -34,6 +34,7 @@
*/
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+1 -1
View File
@@ -196,7 +196,7 @@ retry:
goto out;
}
error = snprintf(line, sizeof(line), "%sFrom %s\t%s", newline, sender, ctime(&now));
error = snprintf(line, sizeof(line), "%sFrom %s %s", newline, sender, ctime(&now));
if (error < 0 || (size_t)error >= sizeof(line)) {
syslog(LOG_NOTICE, "local delivery deferred: can not write header: %m");
goto out;
+6 -3
View File
@@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
host->host, host->addr, c, neterr); \
snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \
host->host, host->addr, c, neterr); \
return (-1); \
error = -1; \
goto out; \
} else if (res != exp) { \
syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \
host->host, host->addr, c, neterr); \
return (1); \
error = 1; \
goto out; \
}
/* Check first reply from remote host */
@@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
syslog(LOG_ERR, "remote delivery failed:"
" SMTP login failed: %m");
snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host);
return (-1);
error = -1;
goto out;
}
/* SMTP login is not available, so try without */
else if (error > 0) {
@@ -2551,7 +2551,7 @@ again:
case 'w':
/* wchar_t */
if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;
File renamed without changes.
@@ -4,6 +4,9 @@
#undef JEMALLOC_OVERRIDE_VALLOC
#ifndef MALLOC_PRODUCTION
#define MALLOC_PRODUCTION
#endif
#ifndef MALLOC_PRODUCTION
#define JEMALLOC_DEBUG
#endif
-163
View File
@@ -1,163 +0,0 @@
README for libarchive bundle.
Questions? Issues?
* http://www.libarchive.org is the home for ongoing
libarchive development, including documentation, and
links to the libarchive mailing lists.
* To report an issue, use the issue tracker at
https://github.com/libarchive/libarchive/issues
* To submit an enhancement to libarchive, please submit
a pull request via GitHub.
https://github.com/libarchive/libarchive/pulls
This distribution bundle includes the following components:
* libarchive: a library for reading and writing streaming archives
* tar: the 'bsdtar' program is a full-featured 'tar'
implementation built on libarchive
* cpio: the 'bsdcpio' program is a different interface to
essentially the same functionality
* cat: the 'bsdcat' program is a simple replacement tool for
zcat, bzcat, xzcat, and such
* examples: Some small example programs that you may find useful.
* examples/minitar: a compact sample demonstrating use of libarchive.
* contrib: Various items sent to me by third parties;
please contact the authors with any questions.
The top-level directory contains the following information files:
* NEWS - highlights of recent changes
* COPYING - what you can do with this
* INSTALL - installation instructions
* README - this file
* configure - configuration script, see INSTALL for details.
* CMakeLists.txt - input for "cmake" build tool, see INSTALL
The following files in the top-level directory are used by the
'configure' script:
* Makefile.am, aclocal.m4, configure.ac
- used to build this distribution, only needed by maintainers
* Makefile.in, config.h.in
- templates used by configure script
Guide to Documentation installed by this system:
* bsdtar.1 explains the use of the bsdtar program
* bsdcpio.1 explains the use of the bsdcpio program
* bsdcat.1 explains the use of the bsdcat program
* libarchive.3 gives an overview of the library as a whole
* archive_read.3, archive_write.3, archive_write_disk.3, and
archive_read_disk.3 provide detailed calling sequences for the read
and write APIs
* archive_entry.3 details the "struct archive_entry" utility class
* archive_internals.3 provides some insight into libarchive's
internal structure and operation.
* libarchive-formats.5 documents the file formats supported by the library
* cpio.5, mtree.5, and tar.5 provide detailed information about these
popular archive formats, including hard-to-find details about
modern cpio and tar variants.
The manual pages above are provided in the 'doc' directory in
a number of different formats.
You should also read the copious comments in "archive.h" and the
source code for the sample programs for more details. Please let us
know about any errors or omissions you find.
Currently, the library automatically detects and reads the following fomats:
* GNU tar format (including GNU long filenames, long link names, and sparse files)
* Solaris 9 extended tar format (including ACLs)
* Old V7 tar archives
* POSIX ustar
* POSIX pax interchange format
* POSIX octet-oriented cpio
* SVR4 ASCII cpio
* POSIX octet-oriented cpio
* Binary cpio (big-endian or little-endian)
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* 7-Zip archives
* Microsoft CAB format
* LHA and LZH archives
* RAR archives
* XAR archives
The library also detects and handles any of the following before evaluating the archive:
* uuencoded files
* files with RPM wrapper
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma, lzip, and xz compression
* lz4 compression
* lzop compression
The library can create archives in any of the following formats:
* POSIX ustar
* POSIX pax interchange format
* "restricted" pax format, which will create ustar archives except for
entries that require pax extensions (for long filenames, ACLs, etc).
* Old GNU tar format
* Old V7 tar format
* POSIX octet-oriented cpio
* SVR4 "newc" cpio
* shar archives
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* ISO9660 format
* 7-Zip archives
* XAR archives
When creating archives, the result can be filtered with any of the following:
* uuencode
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma, lzip, and xz compression
* lz4 compression
* lzop compression
Notes about the library architecture:
* This is a heavily stream-oriented system. There is no direct
support for in-place modification or random access.
* The library is designed to be extended with new compression and
archive formats. The only requirement is that the format be
readable or writable as a stream and that each archive entry be
independent. There are articles on the libarchive Wiki explaining
how to extend libarchive.
* On read, compression and format are always detected automatically.
* I've attempted to minimize static link pollution. If you don't
explicitly invoke a particular feature (such as support for a
particular compression or format), it won't get pulled in to
statically-linked programs. In particular, if you don't explicitly
enable a particular compression or decompression support, you won't
need to link against the corresponding compression or decompression
libraries. This also reduces the size of statically-linked
binaries in environments where that matters.
* On read, the library accepts whatever blocks you hand it.
Your read callback is free to pass the library a byte at a time
or mmap the entire archive and give it to the library at once.
On write, the library always produces correctly-blocked output.
* The object-style approach allows you to have multiple archive streams
open at once. bsdtar uses this in its "@archive" extension.
* The archive itself is read/written using callback functions.
You can read an archive directly from an in-memory buffer or
write it to a socket, if you wish. There are some utility
functions to provide easy-to-use "open file," etc, capabilities.
* The read/write APIs are designed to allow individual entries
to be read or written to any data source: You can create
a block of data in memory and add it to a tar archive without
first writing a temporary file. You can also read an entry from
an archive and write the data directly to a socket. If you want
to read/write entries to disk, there are convenience functions to
make this especially easy.
* Note: "pax interchange format" is really an extended tar format,
despite what the name says.
+222
View File
@@ -0,0 +1,222 @@
# Welcome to libarchive!
The libarchive project develops a portable, efficient C library that
can read and write streaming archives in a variety of formats. It
also includes implementations of the common `tar`, `cpio`, and `zcat`
command-line tools that use the libarchive library.
## Questions? Issues?
* http://www.libarchive.org is the home for ongoing
libarchive development, including documentation,
and links to the libarchive mailing lists.
* To report an issue, use the issue tracker at
https://github.com/libarchive/libarchive/issues
* To submit an enhancement to libarchive, please
submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls
## Contents of the Distribution
This distribution bundle includes the following major components:
* **libarchive**: a library for reading and writing streaming archives
* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive
* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality
* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such
* **examples**: Some small example programs that you may find useful.
* **examples/minitar**: a compact sample demonstrating use of libarchive.
* **contrib**: Various items sent to me by third parties; please contact the authors with any questions.
The top-level directory contains the following information files:
* **NEWS** - highlights of recent changes
* **COPYING** - what you can do with this
* **INSTALL** - installation instructions
* **README** - this file
* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`).
The following files in the top-level directory are used by the 'configure' script:
* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers
* `Makefile.in`, `config.h.in` - templates used by configure script
## Documentation
In addition to the informational articles and documentation
in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
the distribution also includes a number of manual pages:
* bsdtar.1 explains the use of the bsdtar program
* bsdcpio.1 explains the use of the bsdcpio program
* bsdcat.1 explains the use of the bsdcat program
* libarchive.3 gives an overview of the library as a whole
* archive_read.3, archive_write.3, archive_write_disk.3, and
archive_read_disk.3 provide detailed calling sequences for the read
and write APIs
* archive_entry.3 details the "struct archive_entry" utility class
* archive_internals.3 provides some insight into libarchive's
internal structure and operation.
* libarchive-formats.5 documents the file formats supported by the library
* cpio.5, mtree.5, and tar.5 provide detailed information about these
popular archive formats, including hard-to-find details about
modern cpio and tar variants.
The manual pages above are provided in the 'doc' directory in
a number of different formats.
You should also read the copious comments in `archive.h` and the
source code for the sample programs for more details. Please let us
know about any errors or omissions you find.
## Supported Formats
Currently, the library automatically detects and reads the following fomats:
* Old V7 tar archives
* POSIX ustar
* GNU tar format (including GNU long filenames, long link names, and sparse files)
* Solaris 9 extended tar format (including ACLs)
* POSIX pax interchange format
* POSIX octet-oriented cpio
* SVR4 ASCII cpio
* POSIX octet-oriented cpio
* Binary cpio (big-endian or little-endian)
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
* GNU and BSD 'ar' archives
* 'mtree' format
* 7-Zip archives
* Microsoft CAB format
* LHA and LZH archives
* RAR archives (with some limitations due to RAR's proprietary status)
* XAR archives
The library also detects and handles any of the following before evaluating the archive:
* uuencoded files
* files with RPM wrapper
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma, lzip, and xz compression
* lz4 compression
* lzop compression
The library can create archives in any of the following formats:
* POSIX ustar
* POSIX pax interchange format
* "restricted" pax format, which will create ustar archives except for
entries that require pax extensions (for long filenames, ACLs, etc).
* Old GNU tar format
* Old V7 tar format
* POSIX octet-oriented cpio
* SVR4 "newc" cpio
* shar archives
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* ISO9660 format
* 7-Zip archives
* XAR archives
When creating archives, the result can be filtered with any of the following:
* uuencode
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma, lzip, and xz compression
* lz4 compression
* lzop compression
## Notes about the Library Design
The following notes address many of the most common
questions we are asked about libarchive:
* This is a heavily stream-oriented system. That means that
it is optimized to read or write the archive in a single
pass from beginning to end. For example, this allows
libarchive to process archives too large to store on disk
by processing them on-the-fly as they are read from or
written to a network or tape drive. This also makes
libarchive useful for tools that need to produce
archives on-the-fly (such as webservers that provide
archived contents of a users account).
* In-place modification and random access to the contents
of an archive are not directly supported. For some formats,
this is not an issue: For example, tar.gz archives are not
designed for random access. In some other cases, libarchive
can re-open an archive and scan it from the beginning quickly
enough to provide the needed abilities even without true
random access. Of course, some applications do require true
random access; those applications should consider alternatives
to libarchive.
* The library is designed to be extended with new compression and
archive formats. The only requirement is that the format be
readable or writable as a stream and that each archive entry be
independent. There are articles on the libarchive Wiki explaining
how to extend libarchive.
* On read, compression and format are always detected automatically.
* The same API is used for all formats; in particular, it's very
easy for software using libarchive to transparently handle
any of libarchive's archiving formats.
* Libarchive's automatic support for decompression can be used
without archiving by explicitly selecting the "raw" and "empty"
formats.
* I've attempted to minimize static link pollution. If you don't
explicitly invoke a particular feature (such as support for a
particular compression or format), it won't get pulled in to
statically-linked programs. In particular, if you don't explicitly
enable a particular compression or decompression support, you won't
need to link against the corresponding compression or decompression
libraries. This also reduces the size of statically-linked
binaries in environments where that matters.
* The library is generally _thread safe_ depending on the platform:
it does not define any global variables of its own. However, some
platforms do not provide fully thread-safe versions of key C library
functions. On those platforms, libarchive will use the non-thread-safe
functions. Patches to improve this are of great interest to us.
* In particular, libarchive's modules to read or write a directory
tree do use `chdir()` to optimize the directory traversals. This
can cause problems for programs that expect to do disk access from
multiple threads. Of course, those modules are completely
optional and you can use the rest of libarchive without them.
* The library is _not_ thread aware, however. It does no locking
or thread management of any kind. If you create a libarchive
object and need to access it from multiple threads, you will
need to provide your own locking.
* On read, the library accepts whatever blocks you hand it.
Your read callback is free to pass the library a byte at a time
or mmap the entire archive and give it to the library at once.
On write, the library always produces correctly-blocked output.
* The object-style approach allows you to have multiple archive streams
open at once. bsdtar uses this in its "@archive" extension.
* The archive itself is read/written using callback functions.
You can read an archive directly from an in-memory buffer or
write it to a socket, if you wish. There are some utility
functions to provide easy-to-use "open file," etc, capabilities.
* The read/write APIs are designed to allow individual entries
to be read or written to any data source: You can create
a block of data in memory and add it to a tar archive without
first writing a temporary file. You can also read an entry from
an archive and write the data directly to a socket. If you want
to read/write entries to disk, there are convenience functions to
make this especially easy.
* Note: The "pax interchange format" is a POSIX standard extended tar
format that should be used when the older _ustar_ format is not
appropriate. It has many advantages over other tar formats
(including the legacy GNU tar format) and is widely supported by
current tar implementations.
+1 -1
View File
@@ -83,7 +83,7 @@ DEFINE_TEST(test_version)
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
/* Skip arbitrary third-party version numbers. */
while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) {
while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) {
++q;
--s;
}
+1
View File
@@ -63,6 +63,7 @@ static const struct option {
} cpio_longopts[] = {
{ "b64encode", 0, OPTION_B64ENCODE },
{ "create", 0, 'o' },
{ "dereference", 0, 'L' },
{ "dot", 0, 'V' },
{ "extract", 0, 'i' },
{ "file", 1, 'F' },
@@ -75,7 +75,7 @@ verify(const char *p, size_t s)
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
/* Skip arbitrary third-party version numbers. */
while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) {
while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) {
++q;
--s;
}
+3 -2
View File
@@ -707,10 +707,11 @@ archive_acl_text_l(struct archive_acl *acl, int flags,
if (r != 0)
return (-1);
*p++ = separator;
if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) {
id = ap->id;
else
} else {
id = -1;
}
append_entry(&p, NULL, ap->tag, name,
ap->permset, id);
count++;
@@ -655,7 +655,7 @@ add_pattern_from_file(struct archive_match *a, struct match_list *mlist,
}
}
/* If something error happend, report it immediately. */
/* If an error occurred, report it immediately. */
if (r < ARCHIVE_OK) {
archive_copy_error(&(a->archive), ar);
archive_read_free(ar);
@@ -159,6 +159,15 @@
#define CAN_RESTORE_METADATA_FD
#endif
/*
* glibc 2.24 deprecates readdir_r
*/
#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
#define USE_READDIR_R 1
#else
#undef USE_READDIR_R
#endif
/* Set up defaults for internal error codes. */
#ifndef ARCHIVE_ERRNO_FILE_FORMAT
#if HAVE_EFTYPE
@@ -19,7 +19,7 @@ If you need the compatibility with original PPMd var.H, you can use external Ran
#define PPMD7_MAX_ORDER 64
#define PPMD7_MIN_MEM_SIZE (1 << 11)
#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3)
#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3)
struct CPpmd7_Context_;
@@ -125,7 +125,7 @@ void
__archive_read_reset_passphrase(struct archive_read *a)
{
a->passphrases.candiate = -1;
a->passphrases.candidate = -1;
}
/*
@@ -137,31 +137,31 @@ __archive_read_next_passphrase(struct archive_read *a)
struct archive_read_passphrase *p;
const char *passphrase;
if (a->passphrases.candiate < 0) {
if (a->passphrases.candidate < 0) {
/* Count out how many passphrases we have. */
int cnt = 0;
for (p = a->passphrases.first; p != NULL; p = p->next)
cnt++;
a->passphrases.candiate = cnt;
a->passphrases.candidate = cnt;
p = a->passphrases.first;
} else if (a->passphrases.candiate > 1) {
} else if (a->passphrases.candidate > 1) {
/* Rotate a passphrase list. */
a->passphrases.candiate--;
a->passphrases.candidate--;
p = remove_passphrases_from_head(a);
add_passphrase_to_tail(a, p);
/* Pick a new passphrase candiate up. */
/* Pick a new passphrase candidate up. */
p = a->passphrases.first;
} else if (a->passphrases.candiate == 1) {
/* This case is that all cadiates failed to decryption. */
a->passphrases.candiate = 0;
} else if (a->passphrases.candidate == 1) {
/* This case is that all candidates failed to decrypt. */
a->passphrases.candidate = 0;
if (a->passphrases.first->next != NULL) {
/* Rotate a passphrase list. */
p = remove_passphrases_from_head(a);
add_passphrase_to_tail(a, p);
}
p = NULL;
} else /* There is no passphrase candaite. */
} else /* There is no passphrase candidate. */
p = NULL;
if (p != NULL)
@@ -177,7 +177,7 @@ __archive_read_next_passphrase(struct archive_read *a)
if (p == NULL)
return (NULL);
insert_passphrase_to_head(a, p);
a->passphrases.candiate = 1;
a->passphrases.candidate = 1;
}
} else
passphrase = NULL;
@@ -411,20 +411,38 @@ setup_acls(struct archive_read_disk *a,
{
const char *accpath;
acl_t acl;
#if HAVE_ACL_IS_TRIVIAL_NP
int r;
#endif
accpath = archive_entry_sourcepath(entry);
if (accpath == NULL)
accpath = archive_entry_pathname(entry);
if (*fd < 0 && a->tree != NULL) {
if (a->follow_symlinks ||
archive_entry_filetype(entry) != AE_IFLNK)
*fd = a->open_on_current_dir(a->tree,
accpath, O_RDONLY | O_NONBLOCK);
if (*fd < 0) {
if (a->tree_enter_working_dir(a->tree) != 0) {
archive_set_error(&a->archive, errno,
"Couldn't access %s", accpath);
return (ARCHIVE_FAILED);
}
}
}
archive_entry_acl_clear(entry);
acl = NULL;
#ifdef ACL_TYPE_NFS4
/* Try NFS4 ACL first. */
if (*fd >= 0)
#if HAVE_ACL_GET_FD_NP
acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4);
#else
acl = acl_get_fd(*fd);
#endif
#if HAVE_ACL_GET_LINK_NP
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_NFS4);
@@ -437,20 +455,31 @@ setup_acls(struct archive_read_disk *a,
#endif
else
acl = acl_get_file(accpath, ACL_TYPE_NFS4);
#if HAVE_ACL_IS_TRIVIAL_NP
/* Ignore "trivial" ACLs that just mirror the file mode. */
acl_is_trivial_np(acl, &r);
if (r) {
acl_free(acl);
acl = NULL;
if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) {
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (r) {
acl_free(acl);
acl = NULL;
/*
* Simultaneous NFSv4 and POSIX.1e ACLs for the same
* entry are not allowed, so we should return here
*/
return (ARCHIVE_OK);
}
}
#endif
if (acl != NULL) {
translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
acl_free(acl);
return (ARCHIVE_OK);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate NFSv4 ACLs: %s", accpath);
}
return (r);
}
#endif
#endif /* ACL_TYPE_NFS4 */
/* Retrieve access ACL from file. */
if (*fd >= 0)
@@ -467,19 +496,42 @@ setup_acls(struct archive_read_disk *a,
#endif
else
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
#if HAVE_ACL_IS_TRIVIAL_NP
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) {
if (r) {
acl_free(acl);
acl = NULL;
}
}
#endif
if (acl != NULL) {
translate_acl(a, entry, acl,
r = translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate access ACLs: %s", accpath);
return (r);
}
}
/* Only directories can have default ACLs. */
if (S_ISDIR(archive_entry_mode(entry))) {
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
if (acl != NULL) {
translate_acl(a, entry, acl,
r = translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
acl_free(acl);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate default ACLs: %s",
accpath);
return (r);
}
}
}
return (ARCHIVE_OK);
@@ -535,19 +587,23 @@ translate_acl(struct archive_read_disk *a,
#ifdef ACL_TYPE_NFS4
acl_entry_type_t acl_type;
acl_flagset_t acl_flagset;
int brand, r;
int brand;
#endif
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type;
int s, ae_id, ae_tag, ae_perm;
int r, s, ae_id, ae_tag, ae_perm;
const char *ae_name;
#ifdef ACL_TYPE_NFS4
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
// Make sure the "brand" on this ACL is consistent
// with the default_entry_acl_type bits provided.
acl_get_brand_np(acl, &brand);
if (acl_get_brand_np(acl, &brand) != 0) {
archive_set_error(&a->archive, errno,
"Failed to read ACL brand");
return (ARCHIVE_WARN);
}
switch (brand) {
case ACL_BRAND_POSIX:
switch (default_entry_acl_type) {
@@ -555,31 +611,43 @@ translate_acl(struct archive_read_disk *a,
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
break;
default:
// XXX set warning message?
return ARCHIVE_FAILED;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL entry type for POSIX.1e ACL");
return (ARCHIVE_WARN);
}
break;
case ACL_BRAND_NFS4:
if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
// XXX set warning message?
return ARCHIVE_FAILED;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL entry type for NFSv4 ACL");
return (ARCHIVE_WARN);
}
break;
default:
// XXX set warning message?
return ARCHIVE_FAILED;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Unknown ACL brand");
return (ARCHIVE_WARN);
break;
}
#endif
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get first ACL entry");
return (ARCHIVE_WARN);
}
while (s == 1) {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
acl_get_tag_type(acl_entry, &acl_tag);
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL tag type");
return (ARCHIVE_WARN);
}
switch (acl_tag) {
case ACL_USER:
ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry);
@@ -614,13 +682,18 @@ translate_acl(struct archive_read_disk *a,
continue;
}
// XXX acl type maps to allow/deny/audit/YYYY bits
// XXX acl_get_entry_type_np on FreeBSD returns EINVAL for
// non-NFSv4 ACLs
// XXX acl_type maps to allow/deny/audit/YYYY bits
entry_acl_type = default_entry_acl_type;
#ifdef ACL_TYPE_NFS4
r = acl_get_entry_type_np(acl_entry, &acl_type);
if (r == 0) {
if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
/*
* acl_get_entry_type_np() falis with non-NFSv4 ACLs
*/
if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) {
archive_set_error(&a->archive, errno, "Failed "
"to get ACL type from a NFSv4 ACL entry");
return (ARCHIVE_WARN);
}
switch (acl_type) {
case ACL_ENTRY_TYPE_ALLOW:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
@@ -634,29 +707,53 @@ translate_acl(struct archive_read_disk *a,
case ACL_ENTRY_TYPE_ALARM:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
break;
default:
archive_set_error(&a->archive, errno,
"Invalid NFSv4 ACL entry type");
return (ARCHIVE_WARN);
}
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get flagset from a NFSv4 ACL entry");
return (ARCHIVE_WARN);
}
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
r = acl_get_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check flag in a NFSv4 "
"ACL flagset");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_inherit_map[i].archive_inherit;
}
}
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*/
acl_get_flagset_np(acl_entry, &acl_flagset);
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
if (acl_get_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit))
ae_perm |= acl_inherit_map[i].archive_inherit;
}
#endif
acl_get_permset(acl_entry, &acl_permset);
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL permission set");
return (ARCHIVE_WARN);
}
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
/*
* acl_get_perm() is spelled differently on different
* platforms; see above.
*/
if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm))
r = ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check permission in an ACL permission set");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_perm_map[i].archive_perm;
}
@@ -665,6 +762,11 @@ translate_acl(struct archive_read_disk *a,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get next ACL entry");
return (ARCHIVE_WARN);
}
}
return (ARCHIVE_OK);
}
@@ -165,7 +165,7 @@ struct filesystem {
int synthetic;
int remote;
int noatime;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
size_t name_max;
#endif
long incr_xfer_size;
@@ -200,7 +200,7 @@ struct tree {
DIR *d;
#define INVALID_DIR_HANDLE NULL
struct dirent *de;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
struct dirent *dirent;
size_t dirent_allocated;
#endif
@@ -938,7 +938,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
r = archive_match_path_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
"Failed : %s", archive_error_string(a->matching));
return (r);
}
if (r) {
@@ -1041,7 +1041,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
r = archive_match_time_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
"Failed : %s", archive_error_string(a->matching));
return (r);
}
if (r) {
@@ -1067,7 +1067,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
r = archive_match_owner_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
"Failed : %s", archive_error_string(a->matching));
return (r);
}
if (r) {
@@ -1504,10 +1504,19 @@ setup_current_filesystem(struct archive_read_disk *a)
struct tree *t = a->tree;
struct statfs sfs;
#if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC)
# if defined(HAVE_STRUCT_VFSCONF)
struct vfsconf vfc;
# else
/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make
* this accurate; some platforms have both and we need the one that's
* used by getvfsbyname()
*
* Then the following would become:
* #if defined(GETVFSBYNAME_ARG_TYPE)
* GETVFSBYNAME_ARG_TYPE vfc;
* #endif
*/
# if defined(HAVE_STRUCT_XVFSCONF)
struct xvfsconf vfc;
# else
struct vfsconf vfc;
# endif
#endif
int r, xr = 0;
@@ -1583,7 +1592,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#endif
t->current_filesystem->noatime = 0;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
#if defined(HAVE_STRUCT_STATFS_F_NAMEMAX)
t->current_filesystem->name_max = sfs.f_namemax;
@@ -1606,7 +1615,7 @@ setup_current_filesystem(struct archive_read_disk *a)
else
t->current_filesystem->name_max = nm;
#endif
#endif /* HAVE_READDIR_R */
#endif /* USE_READDIR_R */
return (ARCHIVE_OK);
}
@@ -1808,7 +1817,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#endif
t->current_filesystem->noatime = 0;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
t->current_filesystem->name_max = sfs.f_namelen;
#endif
@@ -1892,7 +1901,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#endif
t->current_filesystem->noatime = 0;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
t->current_filesystem->name_max = sfs.f_namemax;
#endif
@@ -1909,7 +1918,7 @@ static int
setup_current_filesystem(struct archive_read_disk *a)
{
struct tree *t = a->tree;
#if defined(_PC_NAME_MAX) && defined(HAVE_READDIR_R)
#if defined(_PC_NAME_MAX) && defined(USE_READDIR_R)
long nm;
#endif
t->current_filesystem->synthetic = -1;/* Not supported */
@@ -1921,7 +1930,7 @@ setup_current_filesystem(struct archive_read_disk *a)
t->current_filesystem->min_xfer_size = -1;
t->current_filesystem->incr_xfer_size = -1;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
# if defined(_PC_NAME_MAX)
if (tree_current_is_symblic_link_target(t)) {
@@ -1949,7 +1958,7 @@ setup_current_filesystem(struct archive_read_disk *a)
else
t->current_filesystem->name_max = nm;
# endif /* _PC_NAME_MAX */
#endif /* HAVE_READDIR_R */
#endif /* USE_READDIR_R */
return (ARCHIVE_OK);
}
@@ -2357,7 +2366,7 @@ tree_dir_next_posix(struct tree *t)
size_t namelen;
if (t->d == NULL) {
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
size_t dirent_size;
#endif
@@ -2378,7 +2387,7 @@ tree_dir_next_posix(struct tree *t)
t->visit_type = r != 0 ? r : TREE_ERROR_DIR;
return (t->visit_type);
}
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
dirent_size = offsetof(struct dirent, d_name) +
t->filesystem_table[t->current->filesystem_id].name_max + 1;
if (t->dirent == NULL || t->dirent_allocated < dirent_size) {
@@ -2395,11 +2404,11 @@ tree_dir_next_posix(struct tree *t)
}
t->dirent_allocated = dirent_size;
}
#endif /* HAVE_READDIR_R */
#endif /* USE_READDIR_R */
}
for (;;) {
errno = 0;
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
r = readdir_r(t->d, t->dirent, &t->de);
#ifdef _AIX
/* Note: According to the man page, return value 9 indicates
@@ -2651,7 +2660,7 @@ tree_free(struct tree *t)
if (t == NULL)
return;
archive_string_free(&t->path);
#if defined(HAVE_READDIR_R)
#if defined(USE_READDIR_R)
free(t->dirent);
#endif
free(t->sparse_list);
@@ -221,7 +221,7 @@ struct archive_read {
struct {
struct archive_read_passphrase *first;
struct archive_read_passphrase **last;
int candiate;
int candidate;
archive_passphrase_callback *callback;
void *client_data;
} passphrases;
@@ -595,7 +595,7 @@ lz4_filter_read_data_block(struct archive_read_filter *self, const void **p)
#endif
}
/* Check if an error happend in decompression process. */
/* Check if an error occurred in the decompression process. */
if (uncompressed_size < 0) {
archive_set_error(&(self->archive->archive),
ARCHIVE_ERRNO_MISC, "lz4 decompression failed");
@@ -1715,8 +1715,11 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
#undef bswap16
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
# define bswap16(x) _byteswap_ushort(x)
#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \
|| defined(__clang__)
#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4)
/* GCC 4.8 and later has __builtin_bswap16() */
# define bswap16(x) __builtin_bswap16(x)
#elif defined(__clang__)
/* All clang versions have __builtin_bswap16() */
# define bswap16(x) __builtin_bswap16(x)
#else
# define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8))
@@ -136,6 +136,7 @@ struct tar {
int64_t entry_padding;
int64_t entry_bytes_unconsumed;
int64_t realsize;
int sparse_allowed;
struct sparse_block *sparse_list;
struct sparse_block *sparse_last;
int64_t sparse_offset;
@@ -1128,8 +1129,15 @@ header_common(struct archive_read *a, struct tar *tar,
if (tar->entry_bytes_remaining < 0) {
tar->entry_bytes_remaining = 0;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Tar entry has negative size?");
err = ARCHIVE_WARN;
"Tar entry has negative size");
return (ARCHIVE_FATAL);
}
if (tar->entry_bytes_remaining == INT64_MAX) {
/* Note: tar_atol returns INT64_MAX on overflow */
tar->entry_bytes_remaining = 0;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Tar entry size overflow");
return (ARCHIVE_FATAL);
}
tar->realsize = tar->entry_bytes_remaining;
archive_entry_set_size(entry, tar->entry_bytes_remaining);
@@ -1264,6 +1272,14 @@ header_common(struct archive_read *a, struct tar *tar,
* sparse information in the extended area.
*/
/* FALLTHROUGH */
case '0':
/*
* Enable sparse file "read" support only for regular
* files and explicit GNU sparse files. However, we
* don't allow non-standard file types to be sparse.
*/
tar->sparse_allowed = 1;
/* FALLTHROUGH */
default: /* Regular file and non-standard types */
/*
* Per POSIX: non-recognized types should always be
@@ -1723,6 +1739,14 @@ pax_attribute(struct archive_read *a, struct tar *tar,
#endif
switch (key[0]) {
case 'G':
/* Reject GNU.sparse.* headers on non-regular files. */
if (strncmp(key, "GNU.sparse", 10) == 0 &&
!tar->sparse_allowed) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Non-regular file cannot be sparse");
return (ARCHIVE_FATAL);
}
/* GNU "0.0" sparse pax format. */
if (strcmp(key, "GNU.sparse.numblocks") == 0) {
tar->sparse_offset = -1;
@@ -318,7 +318,7 @@ start_over:
}
memcpy(w->pool.str, fnam.str, fnam.len);
w->pool.str[fnam.len] = '\0';
/* let noone else know about the pool, it's a secret, shhh */
/* let no one else know about the pool, it's a secret, shhh */
fnam.str = w->pool.str;
/* snarf mtime or deduce from rtime
@@ -418,18 +418,30 @@ zip_time(const char *p)
* id1+size1+data1 + id2+size2+data2 ...
* triplets. id and size are 2 bytes each.
*/
static void
process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry)
static int
process_extra(struct archive_read *a, const char *p, size_t extra_length, struct zip_entry* zip_entry)
{
unsigned offset = 0;
while (offset < extra_length - 4) {
if (extra_length == 0) {
return ARCHIVE_OK;
}
if (extra_length < 4) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Too-small extra data: Need at least 4 bytes, but only found %d bytes", (int)extra_length);
return ARCHIVE_FAILED;
}
while (offset <= extra_length - 4) {
unsigned short headerid = archive_le16dec(p + offset);
unsigned short datasize = archive_le16dec(p + offset + 2);
offset += 4;
if (offset + datasize > extra_length) {
break;
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Extra data overflow: Need %d bytes but only found %d bytes",
(int)datasize, (int)(extra_length - offset));
return ARCHIVE_FAILED;
}
#ifdef DEBUG
fprintf(stderr, "Header id 0x%04x, length %d\n",
@@ -715,13 +727,13 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry)
}
offset += datasize;
}
#ifdef DEBUG
if (offset != extra_length)
{
fprintf(stderr,
"Extra data field contents do not match reported size!\n");
if (offset != extra_length) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Malformed extra data: Consumed %d bytes of %d bytes",
(int)offset, (int)extra_length);
return ARCHIVE_FAILED;
}
#endif
return ARCHIVE_OK;
}
/*
@@ -840,7 +852,9 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
return (ARCHIVE_FATAL);
}
process_extra(h, extra_length, zip_entry);
if (ARCHIVE_OK != process_extra(a, h, extra_length, zip_entry)) {
return ARCHIVE_FATAL;
}
__archive_read_consume(a, extra_length);
/* Work around a bug in Info-Zip: When reading from a pipe, it
@@ -1293,7 +1307,7 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
&& bytes_avail > zip->entry_bytes_remaining) {
bytes_avail = (ssize_t)zip->entry_bytes_remaining;
}
if (bytes_avail <= 0) {
if (bytes_avail < 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP file body");
return (ARCHIVE_FATAL);
@@ -2691,7 +2705,9 @@ slurp_central_directory(struct archive_read *a, struct zip *zip)
"Truncated ZIP file header");
return ARCHIVE_FATAL;
}
process_extra(p + filename_length, extra_length, zip_entry);
if (ARCHIVE_OK != process_extra(a, p + filename_length, extra_length, zip_entry)) {
return ARCHIVE_FATAL;
}
/*
* Mac resource fork files are stored under the
+1 -1
View File
@@ -580,7 +580,7 @@ void
__archive_ensure_cloexec_flag(int fd)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
(void)fd; /* UNSED */
(void)fd; /* UNUSED */
#else
int flags;
@@ -138,6 +138,7 @@ set_acl(struct archive *a, int fd, const char *name,
acl_permset_t acl_permset;
#ifdef ACL_TYPE_NFS4
acl_flagset_t acl_flagset;
int r;
#endif
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
@@ -152,9 +153,19 @@ set_acl(struct archive *a, int fd, const char *name,
if (entries == 0)
return (ARCHIVE_OK);
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
acl_create_entry(&acl, &acl_entry);
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
@@ -185,50 +196,97 @@ set_acl(struct archive *a, int fd, const char *name,
break;
#endif
default:
/* XXX */
break;
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#ifdef ACL_TYPE_NFS4
r = 0;
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
break;
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
// These don't translate directly into the system ACL.
break;
default:
// XXX error handling here.
break;
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (r != 0) {
archive_set_error(a, errno,
"Failed to set ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#endif
acl_get_permset(acl_entry, &acl_permset);
acl_clear_perms(acl_permset);
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_perms(acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to clear ACL permissions");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
if (ae_permset & acl_perm_map[i].archive_perm)
acl_add_perm(acl_permset,
acl_perm_map[i].platform_perm);
if (acl_add_perm(acl_permset,
acl_perm_map[i].platform_perm) != 0) {
archive_set_error(a, errno,
"Failed to add ACL permission");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
#ifdef ACL_TYPE_NFS4
acl_get_flagset_np(acl_entry, &acl_flagset);
acl_clear_flags_np(acl_flagset);
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
if (ae_permset & acl_inherit_map[i].archive_inherit)
acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit);
if (acl_type == ACL_TYPE_NFS4) {
/*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to get flagset from an NFSv4 ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_flags_np(acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to clear flags from an NFSv4 ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
if (ae_permset & acl_inherit_map[i].archive_inherit) {
if (acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit) != 0) {
archive_set_error(a, errno,
"Failed to add flag to NFSv4 ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
}
#endif
}
@@ -257,6 +315,7 @@ set_acl(struct archive *a, int fd, const char *name,
ret = ARCHIVE_WARN;
}
#endif
exit_free:
acl_free(acl);
return (ret);
}
@@ -140,7 +140,17 @@ __FBSDID("$FreeBSD$");
#define O_BINARY 0
#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#define O_CLOEXEC 0
#endif
/* Ignore non-int O_NOFOLLOW constant. */
/* gnulib's fcntl.h does this on AIX, but it seems practical everywhere */
#if defined O_NOFOLLOW && !(INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
#undef O_NOFOLLOW
#endif
#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif
struct fixup_entry {
@@ -326,12 +336,14 @@ struct archive_write_disk {
#define HFS_BLOCKS(s) ((s) >> 12)
static int check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
static int check_symlinks(struct archive_write_disk *);
static int create_filesystem_object(struct archive_write_disk *);
static struct fixup_entry *current_fixup(struct archive_write_disk *, const char *pathname);
#if defined(HAVE_FCHDIR) && defined(PATH_MAX)
static void edit_deep_directories(struct archive_write_disk *ad);
#endif
static int cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
static int cleanup_pathname(struct archive_write_disk *);
static int create_dir(struct archive_write_disk *, char *);
static int create_parent_dir(struct archive_write_disk *, char *);
@@ -1796,7 +1808,7 @@ edit_deep_directories(struct archive_write_disk *a)
char *tail = a->name;
/* If path is short, avoid the open() below. */
if (strlen(tail) <= PATH_MAX)
if (strlen(tail) < PATH_MAX)
return;
/* Try to record our starting dir. */
@@ -1806,7 +1818,7 @@ edit_deep_directories(struct archive_write_disk *a)
return;
/* As long as the path is too long... */
while (strlen(tail) > PATH_MAX) {
while (strlen(tail) >= PATH_MAX) {
/* Locate a dir prefix shorter than PATH_MAX. */
tail += PATH_MAX - 8;
while (tail > a->name && *tail != '/')
@@ -2014,6 +2026,10 @@ create_filesystem_object(struct archive_write_disk *a)
const char *linkname;
mode_t final_mode, mode;
int r;
/* these for check_symlinks_fsobj */
char *linkname_copy; /* non-const copy of linkname */
struct archive_string error_string;
int error_number;
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
@@ -2022,6 +2038,27 @@ create_filesystem_object(struct archive_write_disk *a)
#if !HAVE_LINK
return (EPERM);
#else
archive_string_init(&error_string);
linkname_copy = strdup(linkname);
if (linkname_copy == NULL) {
return (EPERM);
}
/* TODO: consider using the cleaned-up path as the link target? */
r = cleanup_pathname_fsobj(linkname_copy, &error_number, &error_string, a->flags);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, error_number, "%s", error_string.s);
free(linkname_copy);
/* EPERM is more appropriate than error_number for our callers */
return (EPERM);
}
r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, error_number, "%s", error_string.s);
free(linkname_copy);
/* EPERM is more appropriate than error_number for our callers */
return (EPERM);
}
free(linkname_copy);
r = link(linkname, a->name) ? errno : 0;
/*
* New cpio and pax formats allow hardlink entries
@@ -2040,7 +2077,7 @@ create_filesystem_object(struct archive_write_disk *a)
a->deferred = 0;
} else if (r == 0 && a->filesize > 0) {
a->fd = open(a->name,
O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC);
O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC | O_NOFOLLOW);
__archive_ensure_cloexec_flag(a->fd);
if (a->fd < 0)
r = errno;
@@ -2351,116 +2388,233 @@ current_fixup(struct archive_write_disk *a, const char *pathname)
return (a->current_fixup);
}
/* TODO: Make this work. */
/*
* TODO: The deep-directory support bypasses this; disable deep directory
* support if we're doing symlink checks.
*/
/*
* TODO: Someday, integrate this with the deep dir support; they both
* scan the path and both can be optimized by comparing against other
* recent paths.
*/
/* TODO: Extend this to support symlinks on Windows Vista and later. */
/*
* Checks the given path to see if any elements along it are symlinks. Returns
* ARCHIVE_OK if there are none, otherwise puts an error in errmsg.
*/
static int
check_symlinks(struct archive_write_disk *a)
check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
{
#if !defined(HAVE_LSTAT)
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)a; /* UNUSED */
(void)path; /* UNUSED */
(void)error_number; /* UNUSED */
(void)error_string; /* UNUSED */
(void)flags; /* UNUSED */
return (ARCHIVE_OK);
#else
char *pn;
int res = ARCHIVE_OK;
char *tail;
char *head;
int last;
char c;
int r;
struct stat st;
int restore_pwd;
/* Nothing to do here if name is empty */
if(path[0] == '\0')
return (ARCHIVE_OK);
/*
* Guard against symlink tricks. Reject any archive entry whose
* destination would be altered by a symlink.
*
* Walk the filename in chunks separated by '/'. For each segment:
* - if it doesn't exist, continue
* - if it's symlink, abort or remove it
* - if it's a directory and it's not the last chunk, cd into it
* As we go:
* head points to the current (relative) path
* tail points to the temporary \0 terminating the segment we're currently examining
* c holds what used to be in *tail
* last is 1 if this is the last tail
*/
/* Whatever we checked last time doesn't need to be re-checked. */
pn = a->name;
if (archive_strlen(&(a->path_safe)) > 0) {
char *p = a->path_safe.s;
while ((*pn != '\0') && (*p == *pn))
++p, ++pn;
}
restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
__archive_ensure_cloexec_flag(restore_pwd);
if (restore_pwd < 0)
return (ARCHIVE_FATAL);
head = path;
tail = path;
last = 0;
/* TODO: reintroduce a safe cache here? */
/* Skip the root directory if the path is absolute. */
if(pn == a->name && pn[0] == '/')
++pn;
c = pn[0];
/* Keep going until we've checked the entire name. */
while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) {
if(tail == path && tail[0] == '/')
++tail;
/* Keep going until we've checked the entire name.
* head, tail, path all alias the same string, which is
* temporarily zeroed at tail, so be careful restoring the
* stashed (c=tail[0]) for error messages.
* Exiting the loop with break is okay; continue is not.
*/
while (!last) {
/* Skip the separator we just consumed, plus any adjacent ones */
while (*tail == '/')
++tail;
/* Skip the next path element. */
while (*pn != '\0' && *pn != '/')
++pn;
c = pn[0];
pn[0] = '\0';
while (*tail != '\0' && *tail != '/')
++tail;
/* is this the last path component? */
last = (tail[0] == '\0') || (tail[0] == '/' && tail[1] == '\0');
/* temporarily truncate the string here */
c = tail[0];
tail[0] = '\0';
/* Check that we haven't hit a symlink. */
r = lstat(a->name, &st);
r = lstat(head, &st);
if (r != 0) {
tail[0] = c;
/* We've hit a dir that doesn't exist; stop now. */
if (errno == ENOENT)
if (errno == ENOENT) {
break;
} else {
/* Treat any other error as fatal - best to be paranoid here
* Note: This effectively disables deep directory
* support when security checks are enabled.
* Otherwise, very long pathnames that trigger
* an error here could evade the sandbox.
* TODO: We could do better, but it would probably
* require merging the symlink checks with the
* deep-directory editing. */
if (error_number) *error_number = errno;
if (error_string)
archive_string_sprintf(error_string,
"Could not stat %s",
path);
res = ARCHIVE_FAILED;
break;
}
} else if (S_ISDIR(st.st_mode)) {
if (!last) {
if (chdir(head) != 0) {
tail[0] = c;
if (error_number) *error_number = errno;
if (error_string)
archive_string_sprintf(error_string,
"Could not chdir %s",
path);
res = (ARCHIVE_FATAL);
break;
}
/* Our view is now from inside this dir: */
head = tail + 1;
}
} else if (S_ISLNK(st.st_mode)) {
if (c == '\0') {
if (last) {
/*
* Last element is symlink; remove it
* so we can overwrite it with the
* item being extracted.
*/
if (unlink(a->name)) {
archive_set_error(&a->archive, errno,
"Could not remove symlink %s",
a->name);
pn[0] = c;
return (ARCHIVE_FAILED);
if (unlink(head)) {
tail[0] = c;
if (error_number) *error_number = errno;
if (error_string)
archive_string_sprintf(error_string,
"Could not remove symlink %s",
path);
res = ARCHIVE_FAILED;
break;
}
a->pst = NULL;
/*
* Even if we did remove it, a warning
* is in order. The warning is silly,
* though, if we're just replacing one
* symlink with another symlink.
*/
if (!S_ISLNK(a->mode)) {
archive_set_error(&a->archive, 0,
"Removing symlink %s",
a->name);
tail[0] = c;
/* FIXME: not sure how important this is to restore
if (!S_ISLNK(path)) {
if (error_number) *error_number = 0;
if (error_string)
archive_string_sprintf(error_string,
"Removing symlink %s",
path);
}
*/
/* Symlink gone. No more problem! */
pn[0] = c;
return (0);
} else if (a->flags & ARCHIVE_EXTRACT_UNLINK) {
res = ARCHIVE_OK;
break;
} else if (flags & ARCHIVE_EXTRACT_UNLINK) {
/* User asked us to remove problems. */
if (unlink(a->name) != 0) {
archive_set_error(&a->archive, 0,
"Cannot remove intervening symlink %s",
a->name);
pn[0] = c;
return (ARCHIVE_FAILED);
if (unlink(head) != 0) {
tail[0] = c;
if (error_number) *error_number = 0;
if (error_string)
archive_string_sprintf(error_string,
"Cannot remove intervening symlink %s",
path);
res = ARCHIVE_FAILED;
break;
}
a->pst = NULL;
tail[0] = c;
} else {
archive_set_error(&a->archive, 0,
"Cannot extract through symlink %s",
a->name);
pn[0] = c;
return (ARCHIVE_FAILED);
tail[0] = c;
if (error_number) *error_number = 0;
if (error_string)
archive_string_sprintf(error_string,
"Cannot extract through symlink %s",
path);
res = ARCHIVE_FAILED;
break;
}
}
pn[0] = c;
if (pn[0] != '\0')
pn++; /* Advance to the next segment. */
/* be sure to always maintain this */
tail[0] = c;
if (tail[0] != '\0')
tail++; /* Advance to the next segment. */
}
pn[0] = c;
/* We've checked and/or cleaned the whole path, so remember it. */
archive_strcpy(&a->path_safe, a->name);
return (ARCHIVE_OK);
/* Catches loop exits via break */
tail[0] = c;
#ifdef HAVE_FCHDIR
/* If we changed directory above, restore it here. */
if (restore_pwd >= 0) {
r = fchdir(restore_pwd);
if (r != 0) {
if(error_number) *error_number = errno;
if(error_string)
archive_string_sprintf(error_string,
"chdir() failure");
}
close(restore_pwd);
restore_pwd = -1;
if (r != 0) {
res = (ARCHIVE_FATAL);
}
}
#endif
/* TODO: reintroduce a safe cache here? */
return res;
#endif
}
/*
* Check a->name for symlinks, returning ARCHIVE_OK if its clean, otherwise
* calls archive_set_error and returns ARCHIVE_{FATAL,FAILED}
*/
static int
check_symlinks(struct archive_write_disk *a)
{
struct archive_string error_string;
int error_number;
int rc;
archive_string_init(&error_string);
rc = check_symlinks_fsobj(a->name, &error_number, &error_string, a->flags);
if (rc != ARCHIVE_OK) {
archive_set_error(&a->archive, error_number, "%s", error_string.s);
}
archive_string_free(&error_string);
a->pst = NULL; /* to be safe */
return rc;
}
#if defined(__CYGWIN__)
/*
* 1. Convert a path separator from '\' to '/' .
@@ -2534,15 +2688,17 @@ cleanup_pathname_win(struct archive_write_disk *a)
* is set) if the path is absolute.
*/
static int
cleanup_pathname(struct archive_write_disk *a)
cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
{
char *dest, *src;
char separator = '\0';
dest = src = a->name;
dest = src = path;
if (*src == '\0') {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid empty pathname");
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
if (error_string)
archive_string_sprintf(error_string,
"Invalid empty pathname");
return (ARCHIVE_FAILED);
}
@@ -2551,9 +2707,11 @@ cleanup_pathname(struct archive_write_disk *a)
#endif
/* Skip leading '/'. */
if (*src == '/') {
if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Path is absolute");
if (flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
if (error_string)
archive_string_sprintf(error_string,
"Path is absolute");
return (ARCHIVE_FAILED);
}
@@ -2580,10 +2738,11 @@ cleanup_pathname(struct archive_write_disk *a)
} else if (src[1] == '.') {
if (src[2] == '/' || src[2] == '\0') {
/* Conditionally warn about '..' */
if (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Path contains '..'");
if (flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
if (error_string)
archive_string_sprintf(error_string,
"Path contains '..'");
return (ARCHIVE_FAILED);
}
}
@@ -2614,7 +2773,7 @@ cleanup_pathname(struct archive_write_disk *a)
* We've just copied zero or more path elements, not including the
* final '/'.
*/
if (dest == a->name) {
if (dest == path) {
/*
* Nothing got copied. The path must have been something
* like '.' or '/' or './' or '/././././/./'.
@@ -2629,6 +2788,21 @@ cleanup_pathname(struct archive_write_disk *a)
return (ARCHIVE_OK);
}
static int
cleanup_pathname(struct archive_write_disk *a)
{
struct archive_string error_string;
int error_number;
int rc;
archive_string_init(&error_string);
rc = cleanup_pathname_fsobj(a->name, &error_number, &error_string, a->flags);
if (rc != ARCHIVE_OK) {
archive_set_error(&a->archive, error_number, "%s", error_string.s);
}
archive_string_free(&error_string);
return rc;
}
/*
* Create the parent directory of the specified path, assuming path
* is already in mutable storage.
@@ -436,7 +436,7 @@ struct iso_option {
* Type : string
* Default: Auto detect
* : We check a size of boot image;
* : If ths size is just 1.22M/1.44M/2.88M,
* : If the size is just 1.22M/1.44M/2.88M,
* : we assume boot_type is 'fd';
* : otherwise boot_type is 'no-emulation'.
* COMPAT :
@@ -307,7 +307,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
* case getting WCS failed. On POSIX, this is a
* normal operation.
*/
if (p != NULL && p[strlen(p) - 1] != '/') {
if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') {
struct archive_string as;
archive_string_init(&as);
+25
View File
@@ -1440,6 +1440,31 @@ assertion_file_size(const char *file, int line, const char *pathname, long size)
return (0);
}
/* Verify mode of 'pathname'. */
int
assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode)
{
int mode;
int r;
assertion_count(file, line);
#if defined(_WIN32) && !defined(__CYGWIN__)
failure_start(file, line, "assertFileMode not yet implemented for Windows");
#else
{
struct stat st;
r = lstat(pathname, &st);
mode = (int)(st.st_mode & 0777);
}
if (r == 0 && mode == expected_mode)
return (1);
failure_start(file, line, "File %s has mode %o, expected %o",
pathname, mode, expected_mode);
#endif
failure_finish(NULL);
return (0);
}
/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
int
assertion_is_dir(const char *file, int line, const char *pathname, int mode)
@@ -182,6 +182,8 @@
assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
#define assertFileSize(pathname, size) \
assertion_file_size(__FILE__, __LINE__, pathname, size)
#define assertFileMode(pathname, mode) \
assertion_file_mode(__FILE__, __LINE__, pathname, mode)
#define assertTextFileContents(text, pathname) \
assertion_text_file_contents(__FILE__, __LINE__, text, pathname)
#define assertFileContainsLinesAnyOrder(pathname, lines) \
@@ -246,6 +248,7 @@ int assertion_file_mtime_recent(const char *, int, const char *);
int assertion_file_nlinks(const char *, int, const char *, int);
int assertion_file_not_exists(const char *, int, const char *);
int assertion_file_size(const char *, int, const char *, long);
int assertion_file_mode(const char *, int, const char *, int);
int assertion_is_dir(const char *, int, const char *, int);
int assertion_is_hardlink(const char *, int, const char *, const char *);
int assertion_is_not_hardlink(const char *, int, const char *, const char *);
@@ -70,15 +70,9 @@ set_acls(struct archive_entry *ae, struct myacl_t *acls)
}
static int
acl_match(acl_entry_t aclent, struct myacl_t *myacl)
{
gid_t g, *gp;
uid_t u, *up;
acl_tag_t tag_type;
acl_permset_t opaque_ps;
acl_entry_get_perm(acl_entry_t aclent) {
int permset = 0;
acl_get_tag_type(aclent, &tag_type);
acl_permset_t opaque_ps;
/* translate the silly opaque permset to a bitmap */
acl_get_permset(aclent, &opaque_ps);
@@ -88,10 +82,61 @@ acl_match(acl_entry_t aclent, struct myacl_t *myacl)
permset |= ARCHIVE_ENTRY_ACL_WRITE;
if (acl_get_perm_np(opaque_ps, ACL_READ))
permset |= ARCHIVE_ENTRY_ACL_READ;
return permset;
}
if (permset != myacl->permset)
#if 0
static int
acl_get_specific_entry(acl_t acl, acl_tag_t requested_tag_type, int requested_tag) {
int entry_id = ACL_FIRST_ENTRY;
acl_entry_t acl_entry;
acl_tag_t acl_tag_type;
while (1 == acl_get_entry(acl, entry_id, &acl_entry)) {
/* After the first time... */
entry_id = ACL_NEXT_ENTRY;
/* If this matches, return perm mask */
acl_get_tag_type(acl_entry, &acl_tag_type);
if (acl_tag_type == requested_tag_type) {
switch (acl_tag_type) {
case ACL_USER_OBJ:
if ((uid_t)requested_tag == *(uid_t *)(acl_get_qualifier(acl_entry))) {
return acl_entry_get_perm(acl_entry);
}
break;
case ACL_GROUP_OBJ:
if ((gid_t)requested_tag == *(gid_t *)(acl_get_qualifier(acl_entry))) {
return acl_entry_get_perm(acl_entry);
}
break;
case ACL_USER:
case ACL_GROUP:
case ACL_OTHER:
return acl_entry_get_perm(acl_entry);
default:
failure("Unexpected ACL tag type");
assert(0);
}
}
}
return -1;
}
#endif
static int
acl_match(acl_entry_t aclent, struct myacl_t *myacl)
{
gid_t g, *gp;
uid_t u, *up;
acl_tag_t tag_type;
if (myacl->permset != acl_entry_get_perm(aclent))
return (0);
acl_get_tag_type(aclent, &tag_type);
switch (tag_type) {
case ACL_USER_OBJ:
if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0);
@@ -190,7 +235,7 @@ compare_acls(acl_t acl, struct myacl_t *myacls)
* Verify ACL restore-to-disk. This test is FreeBSD-specific.
*/
DEFINE_TEST(test_acl_freebsd_posix1e)
DEFINE_TEST(test_acl_freebsd_posix1e_restore)
{
#if !defined(__FreeBSD__)
skipping("FreeBSD-specific ACL restore test");
@@ -263,3 +308,111 @@ DEFINE_TEST(test_acl_freebsd_posix1e)
acl_free(acl);
#endif
}
/*
* Verify ACL reaed-from-disk. This test is FreeBSD-specific.
*/
DEFINE_TEST(test_acl_freebsd_posix1e_read)
{
#if !defined(__FreeBSD__)
skipping("FreeBSD-specific ACL read test");
#elif __FreeBSD__ < 5
skipping("ACL read supported only on FreeBSD 5.0 and later");
#else
struct archive *a;
struct archive_entry *ae;
int n, fd;
const char *acl1_text, *acl2_text;
acl_t acl1, acl2;
/*
* Manually construct a directory and two files with
* different ACLs. This also serves to verify that ACLs
* are supported on the local filesystem.
*/
/* Create a test file f1 with acl1 */
acl1_text = "user::rwx,group::rwx,other::rwx,user:1:rw-,group:15:r-x,mask::rwx";
acl1 = acl_from_text(acl1_text);
assert((void *)acl1 != NULL);
fd = open("f1", O_WRONLY | O_CREAT | O_EXCL, 0777);
failure("Could not create test file?!");
if (!assert(fd >= 0)) {
acl_free(acl1);
return;
}
n = acl_set_fd(fd, acl1);
acl_free(acl1);
if (n != 0 && errno == EOPNOTSUPP) {
close(fd);
skipping("ACL tests require that ACL support be enabled on the filesystem");
return;
}
if (n != 0 && errno == EINVAL) {
close(fd);
skipping("This filesystem does not support POSIX.1e ACLs");
return;
}
failure("acl_set_fd(): errno = %d (%s)",
errno, strerror(errno));
assertEqualInt(0, n);
close(fd);
assertMakeDir("d", 0700);
/*
* Create file d/f1 with acl2
*
* This differs from acl1 in the u:1: and g:15: permissions.
*
* This file deliberately has the same name but a different ACL.
* Github Issue #777 explains how libarchive's directory traversal
* did not always correctly enter directories before attempting
* to read ACLs, resulting in reading the ACL from a like-named
* file in the wrong directory.
*/
acl2_text = "user::rwx,group::rwx,other::---,user:1:r--,group:15:r--,mask::rwx";
acl2 = acl_from_text(acl2_text);
assert((void *)acl2 != NULL);
fd = open("d/f1", O_WRONLY | O_CREAT | O_EXCL, 0777);
failure("Could not create test file?!");
if (!assert(fd >= 0)) {
acl_free(acl2);
return;
}
n = acl_set_fd(fd, acl2);
acl_free(acl2);
if (n != 0 && errno == EOPNOTSUPP) {
close(fd);
skipping("ACL tests require that ACL support be enabled on the filesystem");
return;
}
if (n != 0 && errno == EINVAL) {
close(fd);
skipping("This filesystem does not support POSIX.1e ACLs");
return;
}
failure("acl_set_fd(): errno = %d (%s)",
errno, strerror(errno));
assertEqualInt(0, n);
close(fd);
/* Create a read-from-disk object. */
assert(NULL != (a = archive_read_disk_new()));
assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, "."));
assert(NULL != (ae = archive_entry_new()));
/* Walk the dir until we see both of the files */
while (ARCHIVE_OK == archive_read_next_header2(a, ae)) {
archive_read_disk_descend(a);
if (strcmp(archive_entry_pathname(ae), "./f1") == 0) {
assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl1_text);
} else if (strcmp(archive_entry_pathname(ae), "./d/f1") == 0) {
assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl2_text);
}
}
archive_free(a);
#endif
}
@@ -800,8 +800,8 @@ DEFINE_TEST(test_archive_string_conversion)
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assert((fp = fopen(testdata, "w")) != NULL);
while ((size = archive_read_data(a, buff, 512)) > 0)
fwrite(buff, 1, size, fp);
fclose(fp);
assertEqualInt(size, fwrite(buff, 1, size, fp));
assertEqualInt(0, fclose(fp));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
test_archive_string_normalization_nfc(testdata);
@@ -110,13 +110,17 @@ test_fuzz(const struct files *filesets)
for (i = 0; filesets[n].names[i] != NULL; ++i)
{
tmp = slurpfile(&size, filesets[n].names[i]);
rawimage = (char *)realloc(rawimage, oldsize + size);
char *newraw = (char *)realloc(rawimage, oldsize + size);
if (!assert(newraw != NULL))
{
free(rawimage);
continue;
}
rawimage = newraw;
memcpy(rawimage + oldsize, tmp, size);
oldsize += size;
size = oldsize;
free(tmp);
if (!assert(rawimage != NULL))
continue;
}
}
if (size == 0)
@@ -3603,7 +3603,7 @@ DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files)
assertEqualIntA(a, 0, archive_read_data(a, buff, sizeof(buff)));
/*
* Eigth header.
* Eighth header.
*/
assertA(0 == archive_read_next_header(a, &ae));
assertEqualString("testdir/testsymlink6", archive_entry_pathname(ae));
@@ -0,0 +1,143 @@
/*-
* Copyright (c) 2016 Tim Kientzle
* 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 AUTHOR(S) ``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 AUTHOR(S) 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.
*/
#include "test.h"
__FBSDID("$FreeBSD");
#include <locale.h>
/*
* Github Issue 748 reported problems with end-of-entry handling
* with highly-compressible data. This resulted in the end of the
* data being truncated (extracted as zero bytes).
*/
/*
* Extract the specific test archive that was used to diagnose
* Issue 748:
*/
DEFINE_TEST(test_read_format_zip_high_compression)
{
const char *refname = "test_read_format_zip_high_compression.zip";
char *p;
size_t archive_size;
struct archive *a;
struct archive_entry *entry;
const void *pv;
size_t s;
int64_t o;
extract_reference_file(refname);
p = slurpfile(&archive_size, refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, archive_size, 16 * 1024));
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry));
assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(262144, s);
assertEqualInt(0, o);
assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(160, s);
assertEqualInt(262144, o);
assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(ARCHIVE_OK, archive_free(a));
free(p);
}
/*
* Synthesize a lot of varying inputs that are highly compressible.
*/
DEFINE_TEST(test_read_format_zip_high_compression2)
{
const size_t body_size = 1024 * 1024;
const size_t buff_size = 2 * 1024 * 1024;
char *body, *body_read, *buff;
int n;
assert((body = malloc(body_size)) != NULL);
assert((body_read = malloc(body_size)) != NULL);
assert((buff = malloc(buff_size)) != NULL);
/* Highly-compressible data: all bytes 255, except for a
* single 1 byte.
* The body is always 256k + 6 bytes long (the internal deflation
* buffer is exactly 256k).
*/
for(n = 1024; n < (int)body_size; n += 1024) {
struct archive *a;
struct archive_entry *entry;
size_t used = 0;
const void *pv;
size_t s;
int64_t o;
memset(body, 255, body_size);
body[n] = 1;
/* Write an archive with a single entry of n bytes. */
assert((a = archive_write_new()) != NULL);
assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, buff_size, &used));
entry = archive_entry_new2(a);
archive_entry_set_pathname(entry, "test");
archive_entry_set_filetype(entry, AE_IFREG);
archive_entry_set_size(entry, 262150);
assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
archive_entry_free(entry);
assertEqualInt(262150, archive_write_data(a, body, 262150));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
/* Read back the entry and verify the contents. */
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 17));
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry));
assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(262144, s);
assertEqualInt(0, o);
assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(6, s);
assertEqualInt(262144, o);
assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o));
assertEqualInt(ARCHIVE_OK, archive_free(a));
}
free(body);
free(body_read);
free(buff);
}
@@ -0,0 +1,18 @@
begin 644 test_read_format_zip_high_compression.zip
M4$L#!!0`"``(`*=Y]4@``````````*``!``(`"``8VAA<BYB:6Y55`T`!\L>
MD5>>))%7GB215W5X"P`!!/8!```$%````.W=06K#,!`%T&E)P8LL?*2XC@N%
M)#5QO>AM<K0<+2=0:!OBP>@9WDJ6!%\6$K/Q6T3LAX]N/GQ'Z9G&KA^*K1'S
M.`[GOIM*[TP_Q_>O0[G_:3X.Y\^^V/X2<<GT&IM=$]OK?[71_LJ],3;1+*(T
M_U)99\T+````````````````````````````````````````L`:E?]*S#FVT
MJY:='SPB>_]DR\X?`("_R:X_U"Y[_:F;;Q``ZN+L!P"H3W;]$_5G`&!9V?</
M````X/FRZP_9LO,'@`S9YR^0P_Z'NF7?/P``````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
MJ%L3VVM-LO,&8/UN4$L'"!<='%^U`0``H``$`%!+`0(4`Q0`"``(`*=Y]4@7
M'1Q?M0$``*``!``(`"````````````"D@0````!C:&%R+F)I;E54#0`'RQZ1
M5YXDD5>>))%7=7@+``$$]@$```04````4$L%!@`````!``$`5@````L"````
!````
`
end
@@ -0,0 +1,95 @@
/*-
* Copyright (c) 2003-2007,2016 Tim Kientzle
* 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 AUTHOR(S) ``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 AUTHOR(S) 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.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
#define UMASK 022
/*
* Github Issue #744 describes a bug in the sandboxing code that
* causes very long pathnames to not get checked for symlinks.
*/
DEFINE_TEST(test_write_disk_secure744)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
skipping("archive_write_disk security checks not supported on Windows");
#else
struct archive *a;
struct archive_entry *ae;
size_t buff_size = 8192;
char *buff = malloc(buff_size);
char *p = buff;
int n = 0;
int t;
assert(buff != NULL);
/* Start with a known umask. */
assertUmask(UMASK);
/* Create an archive_write_disk object. */
assert((a = archive_write_disk_new()) != NULL);
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
while (p + 500 < buff + buff_size) {
memset(p, 'x', 100);
p += 100;
p[0] = '\0';
buff[0] = ((n / 1000) % 10) + '0';
buff[1] = ((n / 100) % 10)+ '0';
buff[2] = ((n / 10) % 10)+ '0';
buff[3] = ((n / 1) % 10)+ '0';
buff[4] = '_';
++n;
/* Create a symlink pointing to the testworkdir */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, buff);
archive_entry_set_mode(ae, S_IFREG | 0777);
archive_entry_copy_symlink(ae, testworkdir);
assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
archive_entry_free(ae);
*p++ = '/';
sprintf(p, "target%d", n);
/* Try to create a file through the symlink, should fail. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, buff);
archive_entry_set_mode(ae, S_IFDIR | 0777);
t = archive_write_header(a, ae);
archive_entry_free(ae);
failure("Attempt to create target%d via %d-character symlink should have failed", n, (int)strlen(buff));
if(!assertEqualInt(ARCHIVE_FAILED, t)) {
break;
}
}
archive_free(a);
free(buff);
#endif
}
@@ -0,0 +1,79 @@
/*-
* Copyright (c) 2003-2007,2016 Tim Kientzle
* 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 AUTHOR(S) ``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 AUTHOR(S) 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.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
#define UMASK 022
/*
* Github Issue #745 describes a bug in the sandboxing code that
* allows one to use a symlink to edit the permissions on a file or
* directory outside of the sandbox.
*/
DEFINE_TEST(test_write_disk_secure745)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
skipping("archive_write_disk security checks not supported on Windows");
#else
struct archive *a;
struct archive_entry *ae;
/* Start with a known umask. */
assertUmask(UMASK);
/* Create an archive_write_disk object. */
assert((a = archive_write_disk_new()) != NULL);
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
/* The target dir: The one we're going to try to change permission on */
assertMakeDir("target", 0700);
/* The sandbox dir we're going to run inside of. */
assertMakeDir("sandbox", 0700);
assertChdir("sandbox");
/* Create a symlink pointing to the target directory */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "sym");
archive_entry_set_mode(ae, AE_IFLNK | 0777);
archive_entry_copy_symlink(ae, "../target");
assert(0 == archive_write_header(a, ae));
archive_entry_free(ae);
/* Try to alter the target dir through the symlink; this should fail. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "sym");
archive_entry_set_mode(ae, S_IFDIR | 0777);
assert(0 == archive_write_header(a, ae));
archive_entry_free(ae);
/* Permission of target dir should not have changed. */
assertFileMode("../target", 0700);
assert(0 == archive_write_close(a));
archive_write_free(a);
#endif
}
@@ -0,0 +1,129 @@
/*-
* Copyright (c) 2003-2007,2016 Tim Kientzle
* 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 AUTHOR(S) ``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 AUTHOR(S) 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.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
#define UMASK 022
/*
* Github Issue #746 describes a problem in which hardlink targets are
* not adequately checked and can be used to modify entries outside of
* the sandbox.
*/
/*
* Verify that ARCHIVE_EXTRACT_SECURE_NODOTDOT disallows '..' in hardlink
* targets.
*/
DEFINE_TEST(test_write_disk_secure746a)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
skipping("archive_write_disk security checks not supported on Windows");
#else
struct archive *a;
struct archive_entry *ae;
/* Start with a known umask. */
assertUmask(UMASK);
/* The target directory we're going to try to affect. */
assertMakeDir("target", 0700);
assertMakeFile("target/foo", 0700, "unmodified");
/* The sandbox dir we're going to work within. */
assertMakeDir("sandbox", 0700);
assertChdir("sandbox");
/* Create an archive_write_disk object. */
assert((a = archive_write_disk_new()) != NULL);
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NODOTDOT);
/* Attempt to hardlink to the target directory. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "bar");
archive_entry_set_mode(ae, AE_IFREG | 0777);
archive_entry_set_size(ae, 8);
archive_entry_copy_hardlink(ae, "../target/foo");
assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae));
assertEqualInt(ARCHIVE_FATAL, archive_write_data(a, "modified", 8));
archive_entry_free(ae);
/* Verify that target file contents are unchanged. */
assertTextFileContents("unmodified", "../target/foo");
#endif
}
/*
* Verify that ARCHIVE_EXTRACT_SECURE_NOSYMLINK disallows symlinks in hardlink
* targets.
*/
DEFINE_TEST(test_write_disk_secure746b)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
skipping("archive_write_disk security checks not supported on Windows");
#else
struct archive *a;
struct archive_entry *ae;
/* Start with a known umask. */
assertUmask(UMASK);
/* The target directory we're going to try to affect. */
assertMakeDir("target", 0700);
assertMakeFile("target/foo", 0700, "unmodified");
/* The sandbox dir we're going to work within. */
assertMakeDir("sandbox", 0700);
assertChdir("sandbox");
/* Create an archive_write_disk object. */
assert((a = archive_write_disk_new()) != NULL);
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
/* Create a symlink to the target directory. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "symlink");
archive_entry_set_mode(ae, AE_IFLNK | 0777);
archive_entry_copy_symlink(ae, "../target");
assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
archive_entry_free(ae);
/* Attempt to hardlink to the target directory via the symlink. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "bar");
archive_entry_set_mode(ae, AE_IFREG | 0777);
archive_entry_set_size(ae, 8);
archive_entry_copy_hardlink(ae, "symlink/foo");
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
assertEqualIntA(a, ARCHIVE_FATAL, archive_write_data(a, "modified", 8));
archive_entry_free(ae);
/* Verify that target file contents are unchanged. */
assertTextFileContents("unmodified", "../target/foo");
assertEqualIntA(a, ARCHIVE_FATAL, archive_write_close(a));
archive_write_free(a);
#endif
}
@@ -100,6 +100,10 @@ DEFINE_TEST(test_write_format_gnutar_linknames)
size_t used;
int i;
#ifdef S_IFLNK
assertEqualInt(S_IFLNK, AE_IFLNK);
#endif
buff = malloc(buffsize); /* million bytes of work area */
assert(buff != NULL);
@@ -109,7 +113,7 @@ DEFINE_TEST(test_write_format_gnutar_linknames)
archive_entry_set_birthtime(template, 3, 30);
archive_entry_set_ctime(template, 4, 40);
archive_entry_set_mtime(template, 5, 50);
archive_entry_set_mode(template, S_IFLNK | 0755);
archive_entry_set_mode(template, AE_IFLNK | 0755);
archive_entry_copy_pathname(template, "link");
for (i = 0; i < 2000; ++i) {
+1
View File
@@ -68,6 +68,7 @@ static const struct bsdtar_option {
{ "auto-compress", 0, 'a' },
{ "b64encode", 0, OPTION_B64ENCODE },
{ "block-size", 1, 'b' },
{ "blocking-factor", 1, 'b' },
{ "bunzip2", 0, 'j' },
{ "bzip", 0, 'j' },
{ "bzip2", 0, 'j' },
+1 -1
View File
@@ -88,7 +88,7 @@ DEFINE_TEST(test_version)
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
/* Skip arbitrary third-party version numbers. */
while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) {
while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) {
++q;
--s;
}
+1 -1
View File
@@ -182,7 +182,7 @@ safe_fprintf(FILE *f, const char *fmt, ...)
}
/* If our output buffer is full, dump it and keep going. */
if (i > (sizeof(outbuff) - 20)) {
if (i > (sizeof(outbuff) - 128)) {
outbuff[i] = '\0';
fprintf(f, "%s", outbuff);
i = 0;
+24 -6
View File
@@ -572,6 +572,19 @@ static void free_exception(char *e)
}
}
#ifdef __LP64__
/**
* There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte
* alignment but it was broken by the addition of the referenceCount.
* The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep
* compatibility with consumers of the broken __cxa_exception, explicitly add
* padding on allocation (and account for it on free).
*/
static const int exception_alignment_padding = 8;
#else
static const int exception_alignment_padding = 0;
#endif
/**
* Allocates an exception structure. Returns a pointer to the space that can
* be used to store an object of thrown_size bytes. This function will use an
@@ -580,16 +593,19 @@ static void free_exception(char *e)
*/
extern "C" void *__cxa_allocate_exception(size_t thrown_size)
{
size_t size = thrown_size + sizeof(__cxa_exception);
size_t size = exception_alignment_padding + sizeof(__cxa_exception) +
thrown_size;
char *buffer = alloc_or_die(size);
return buffer+sizeof(__cxa_exception);
return buffer + exception_alignment_padding + sizeof(__cxa_exception);
}
extern "C" void *__cxa_allocate_dependent_exception(void)
{
size_t size = sizeof(__cxa_dependent_exception);
size_t size = exception_alignment_padding +
sizeof(__cxa_dependent_exception);
char *buffer = alloc_or_die(size);
return buffer+sizeof(__cxa_dependent_exception);
return buffer + exception_alignment_padding +
sizeof(__cxa_dependent_exception);
}
/**
@@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception)
}
}
free_exception(reinterpret_cast<char*>(ex));
free_exception(reinterpret_cast<char*>(ex) -
exception_alignment_padding);
}
static void releaseException(__cxa_exception *exception)
@@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception)
{
releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
}
free_exception(reinterpret_cast<char*>(ex));
free_exception(reinterpret_cast<char*>(ex) -
exception_alignment_padding);
}
/**
+1 -1
View File
@@ -2842,7 +2842,7 @@ again:
case 'w':
/* wchar_t */
if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;
@@ -90,6 +90,7 @@ const MCFixupKindInfo &ARMAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
{"fixup_arm_movw_lo16", 0, 20, 0},
{"fixup_t2_movt_hi16", 0, 20, 0},
{"fixup_t2_movw_lo16", 0, 20, 0},
{"fixup_arm_mod_imm", 0, 12, 0},
};
const static MCFixupKindInfo InfosBE[ARM::NumTargetFixupKinds] = {
// This table *must* be in the order that the fixup_* kinds are defined in
@@ -133,6 +134,7 @@ const MCFixupKindInfo &ARMAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
{"fixup_arm_movw_lo16", 12, 20, 0},
{"fixup_t2_movt_hi16", 12, 20, 0},
{"fixup_t2_movw_lo16", 12, 20, 0},
{"fixup_arm_mod_imm", 20, 12, 0},
};
if (Kind < FirstTargetFixupKind)
@@ -624,6 +626,13 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
return Value;
}
case ARM::fixup_arm_mod_imm:
Value = ARM_AM::getSOImmVal(Value);
if (Ctx && Value >> 12) {
Ctx->reportError(Fixup.getLoc(), "out of range immediate fixup value");
return 0;
}
return Value;
}
}
@@ -690,6 +699,7 @@ static unsigned getFixupKindNumBytes(unsigned Kind) {
case FK_Data_2:
case ARM::fixup_arm_thumb_br:
case ARM::fixup_arm_thumb_cb:
case ARM::fixup_arm_mod_imm:
return 2;
case ARM::fixup_arm_pcrel_10_unscaled:
@@ -766,6 +776,7 @@ static unsigned getFixupKindContainerSizeBytes(unsigned Kind) {
case ARM::fixup_arm_movw_lo16:
case ARM::fixup_t2_movt_hi16:
case ARM::fixup_t2_movw_lo16:
case ARM::fixup_arm_mod_imm:
// Instruction size is 4 bytes.
return 4;
}
@@ -100,6 +100,9 @@ enum Fixups {
fixup_t2_movt_hi16, // :upper16:
fixup_t2_movw_lo16, // :lower16:
// fixup_arm_mod_imm - Fixup for mod_imm
fixup_arm_mod_imm,
// Marker
LastTargetFixupKind,
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
@@ -312,12 +312,8 @@ public:
// Support for fixups (MCFixup)
if (MO.isExpr()) {
const MCExpr *Expr = MO.getExpr();
// In instruction code this value always encoded as lowest 12 bits,
// so we don't have to perform any specific adjustments.
// Due to requirements of relocatable records we have to use FK_Data_4.
// See ARMELFObjectWriter::ExplicitRelSym and
// ARMELFObjectWriter::GetRelocTypeInner for more details.
MCFixupKind Kind = MCFixupKind(FK_Data_4);
// Fixups resolve to plain values that need to be encoded.
MCFixupKind Kind = MCFixupKind(ARM::fixup_arm_mod_imm);
Fixups.push_back(MCFixup::create(0, Expr, Kind, MI.getLoc()));
return 0;
}
-1
View File
@@ -576,7 +576,6 @@ def : Proc<"btver1", [
FeaturePRFCHW,
FeatureLZCNT,
FeaturePOPCNT,
FeatureXSAVE,
FeatureSlowSHLD,
FeatureLAHFSAHF
]>;
@@ -17,4 +17,55 @@
#define _LIBUNWIND_ARM_EHABI 0
#endif
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
# if defined(__i386__)
# define _LIBUNWIND_TARGET_I386 1
# define _LIBUNWIND_CONTEXT_SIZE 8
# define _LIBUNWIND_CURSOR_SIZE 19
# define _LIBUNWIND_MAX_REGISTER 9
# elif defined(__x86_64__)
# define _LIBUNWIND_TARGET_X86_64 1
# define _LIBUNWIND_CONTEXT_SIZE 21
# define _LIBUNWIND_CURSOR_SIZE 33
# define _LIBUNWIND_MAX_REGISTER 17
# elif defined(__ppc__)
# define _LIBUNWIND_TARGET_PPC 1
# define _LIBUNWIND_CONTEXT_SIZE 117
# define _LIBUNWIND_CURSOR_SIZE 128
# define _LIBUNWIND_MAX_REGISTER 113
# elif defined(__aarch64__)
# define _LIBUNWIND_TARGET_AARCH64 1
# define _LIBUNWIND_CONTEXT_SIZE 66
# define _LIBUNWIND_CURSOR_SIZE 78
# define _LIBUNWIND_MAX_REGISTER 96
# elif defined(__arm__)
# define _LIBUNWIND_TARGET_ARM 1
# define _LIBUNWIND_CONTEXT_SIZE 60
# define _LIBUNWIND_CURSOR_SIZE 67
# define _LIBUNWIND_MAX_REGISTER 96
# elif defined(__or1k__)
# define _LIBUNWIND_TARGET_OR1K 1
# define _LIBUNWIND_CONTEXT_SIZE 16
# define _LIBUNWIND_CURSOR_SIZE 28
# define _LIBUNWIND_MAX_REGISTER 32
# elif defined(__riscv__)
# define _LIBUNWIND_TARGET_RISCV 1
# define _LIBUNWIND_CONTEXT_SIZE 128 /* XXX */
# define _LIBUNWIND_CURSOR_SIZE 140 /* XXX */
# define _LIBUNWIND_MAX_REGISTER 96
# else
# error "Unsupported architecture."
# endif
#else // !_LIBUNWIND_IS_NATIVE_ONLY
# define _LIBUNWIND_TARGET_I386 1
# define _LIBUNWIND_TARGET_X86_64 1
# define _LIBUNWIND_TARGET_PPC 1
# define _LIBUNWIND_TARGET_AARCH64 1
# define _LIBUNWIND_TARGET_ARM 1
# define _LIBUNWIND_TARGET_OR1K 1
# define _LIBUNWIND_CONTEXT_SIZE 128
# define _LIBUNWIND_CURSOR_SIZE 140
# define _LIBUNWIND_MAX_REGISTER 120
#endif // _LIBUNWIND_IS_NATIVE_ONLY
#endif // ____LIBUNWIND_CONFIG_H__
@@ -46,12 +46,12 @@ enum {
};
struct unw_context_t {
uint64_t data[128];
uint64_t data[_LIBUNWIND_CONTEXT_SIZE];
};
typedef struct unw_context_t unw_context_t;
struct unw_cursor_t {
uint64_t data[140];
uint64_t data[_LIBUNWIND_CURSOR_SIZE];
};
typedef struct unw_cursor_t unw_cursor_t;
@@ -151,8 +151,8 @@ enum {
UNW_X86_ECX = 1,
UNW_X86_EDX = 2,
UNW_X86_EBX = 3,
UNW_X86_EBP = 4,
UNW_X86_ESP = 5,
UNW_X86_ESP = 4,
UNW_X86_EBP = 5,
UNW_X86_ESI = 6,
UNW_X86_EDI = 7
};
@@ -295,77 +295,6 @@ enum {
UNW_PPC_SPEFSCR = 112
};
// 64-bit RISC-V registers
enum {
UNW_RISCV_X0 = 0,
UNW_RISCV_X1 = 1,
UNW_RISCV_RA = 1,
UNW_RISCV_X2 = 2,
UNW_RISCV_SP = 2,
UNW_RISCV_X3 = 3,
UNW_RISCV_X4 = 4,
UNW_RISCV_X5 = 5,
UNW_RISCV_X6 = 6,
UNW_RISCV_X7 = 7,
UNW_RISCV_X8 = 8,
UNW_RISCV_X9 = 9,
UNW_RISCV_X10 = 10,
UNW_RISCV_X11 = 11,
UNW_RISCV_X12 = 12,
UNW_RISCV_X13 = 13,
UNW_RISCV_X14 = 14,
UNW_RISCV_X15 = 15,
UNW_RISCV_X16 = 16,
UNW_RISCV_X17 = 17,
UNW_RISCV_X18 = 18,
UNW_RISCV_X19 = 19,
UNW_RISCV_X20 = 20,
UNW_RISCV_X21 = 21,
UNW_RISCV_X22 = 22,
UNW_RISCV_X23 = 23,
UNW_RISCV_X24 = 24,
UNW_RISCV_X25 = 25,
UNW_RISCV_X26 = 26,
UNW_RISCV_X27 = 27,
UNW_RISCV_X28 = 28,
UNW_RISCV_X29 = 29,
UNW_RISCV_X30 = 30,
UNW_RISCV_X31 = 31,
// reserved block
UNW_RISCV_D0 = 64,
UNW_RISCV_D1 = 65,
UNW_RISCV_D2 = 66,
UNW_RISCV_D3 = 67,
UNW_RISCV_D4 = 68,
UNW_RISCV_D5 = 69,
UNW_RISCV_D6 = 70,
UNW_RISCV_D7 = 71,
UNW_RISCV_D8 = 72,
UNW_RISCV_D9 = 73,
UNW_RISCV_D10 = 74,
UNW_RISCV_D11 = 75,
UNW_RISCV_D12 = 76,
UNW_RISCV_D13 = 77,
UNW_RISCV_D14 = 78,
UNW_RISCV_D15 = 79,
UNW_RISCV_D16 = 80,
UNW_RISCV_D17 = 81,
UNW_RISCV_D18 = 82,
UNW_RISCV_D19 = 83,
UNW_RISCV_D20 = 84,
UNW_RISCV_D21 = 85,
UNW_RISCV_D22 = 86,
UNW_RISCV_D23 = 87,
UNW_RISCV_D24 = 88,
UNW_RISCV_D25 = 89,
UNW_RISCV_D26 = 90,
UNW_RISCV_D27 = 91,
UNW_RISCV_D28 = 92,
UNW_RISCV_D29 = 93,
UNW_RISCV_D30 = 94,
UNW_RISCV_D31 = 95,
};
// 64-bit ARM64 registers
enum {
UNW_ARM64_X0 = 0,
@@ -604,4 +533,75 @@ enum {
UNW_OR1K_R31 = 31,
};
// 64-bit RISC-V registers
enum {
UNW_RISCV_X0 = 0,
UNW_RISCV_X1 = 1,
UNW_RISCV_RA = 1,
UNW_RISCV_X2 = 2,
UNW_RISCV_SP = 2,
UNW_RISCV_X3 = 3,
UNW_RISCV_X4 = 4,
UNW_RISCV_X5 = 5,
UNW_RISCV_X6 = 6,
UNW_RISCV_X7 = 7,
UNW_RISCV_X8 = 8,
UNW_RISCV_X9 = 9,
UNW_RISCV_X10 = 10,
UNW_RISCV_X11 = 11,
UNW_RISCV_X12 = 12,
UNW_RISCV_X13 = 13,
UNW_RISCV_X14 = 14,
UNW_RISCV_X15 = 15,
UNW_RISCV_X16 = 16,
UNW_RISCV_X17 = 17,
UNW_RISCV_X18 = 18,
UNW_RISCV_X19 = 19,
UNW_RISCV_X20 = 20,
UNW_RISCV_X21 = 21,
UNW_RISCV_X22 = 22,
UNW_RISCV_X23 = 23,
UNW_RISCV_X24 = 24,
UNW_RISCV_X25 = 25,
UNW_RISCV_X26 = 26,
UNW_RISCV_X27 = 27,
UNW_RISCV_X28 = 28,
UNW_RISCV_X29 = 29,
UNW_RISCV_X30 = 30,
UNW_RISCV_X31 = 31,
// reserved block
UNW_RISCV_D0 = 64,
UNW_RISCV_D1 = 65,
UNW_RISCV_D2 = 66,
UNW_RISCV_D3 = 67,
UNW_RISCV_D4 = 68,
UNW_RISCV_D5 = 69,
UNW_RISCV_D6 = 70,
UNW_RISCV_D7 = 71,
UNW_RISCV_D8 = 72,
UNW_RISCV_D9 = 73,
UNW_RISCV_D10 = 74,
UNW_RISCV_D11 = 75,
UNW_RISCV_D12 = 76,
UNW_RISCV_D13 = 77,
UNW_RISCV_D14 = 78,
UNW_RISCV_D15 = 79,
UNW_RISCV_D16 = 80,
UNW_RISCV_D17 = 81,
UNW_RISCV_D18 = 82,
UNW_RISCV_D19 = 83,
UNW_RISCV_D20 = 84,
UNW_RISCV_D21 = 85,
UNW_RISCV_D22 = 86,
UNW_RISCV_D23 = 87,
UNW_RISCV_D24 = 88,
UNW_RISCV_D25 = 89,
UNW_RISCV_D26 = 90,
UNW_RISCV_D27 = 91,
UNW_RISCV_D28 = 92,
UNW_RISCV_D29 = 93,
UNW_RISCV_D30 = 94,
UNW_RISCV_D31 = 95,
};
#endif
@@ -128,7 +128,7 @@ struct _Unwind_Exception {
// added for binary compatibility.
uint32_t reserved[3];
#endif
};
} __attribute__((__aligned__));
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
(int version,
@@ -35,7 +35,7 @@ namespace libunwind {
#include "Registers.hpp"
#if _LIBUNWIND_ARM_EHABI
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/link_elf.h>
typedef void *_Unwind_Ptr;
@@ -62,7 +62,8 @@ extern EHTEntry __exidx_end;
#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
#endif // _LIBUNWIND_ARM_EHABI
#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__)
#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__) || \
defined(__NetBSD__)
#if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX
#include <link.h>
// Macro for machine-independent access to the ELF program headers. This
@@ -27,6 +27,7 @@
namespace libunwind {
#if defined(_LIBUNWIND_TARGET_I386)
/// CompactUnwinder_x86 uses a compact unwind info to virtually "step" (aka
/// unwind) by modifying a Registers_x86 register set
template <typename A>
@@ -255,8 +256,10 @@ void CompactUnwinder_x86<A>::framelessUnwind(
// old esp is before return address
registers.setSP((uint32_t)returnAddressLocation + 4);
}
#endif // _LIBUNWIND_TARGET_I386
#if defined(_LIBUNWIND_TARGET_X86_64)
/// CompactUnwinder_x86_64 uses a compact unwind info to virtually "step" (aka
/// unwind) by modifying a Registers_x86_64 register set
template <typename A>
@@ -484,9 +487,11 @@ void CompactUnwinder_x86_64<A>::framelessUnwind(A &addressSpace,
// old esp is before return address
registers.setSP(returnAddressLocation + 8);
}
#endif // _LIBUNWIND_TARGET_X86_64
#if defined(_LIBUNWIND_TARGET_AARCH64)
/// CompactUnwinder_arm64 uses a compact unwind info to virtually "step" (aka
/// unwind) by modifying a Registers_arm64 register set
template <typename A>
@@ -686,6 +691,7 @@ int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrame(
return UNW_STEP_SUCCESS;
}
#endif // _LIBUNWIND_TARGET_AARCH64
} // namespace libunwind
@@ -62,7 +62,7 @@ public:
};
enum {
kMaxRegisterNumber = 120
kMaxRegisterNumber = _LIBUNWIND_MAX_REGISTER
};
enum RegisterSavedWhere {
kRegisterUnused,
+287 -270
View File
@@ -25,6 +25,7 @@ namespace libunwind {
struct v128 { uint32_t vec[4]; };
#if defined(_LIBUNWIND_TARGET_I386)
/// Registers_x86 holds the register state of a thread in a 32-bit intel
/// process.
class _LIBUNWIND_HIDDEN Registers_x86 {
@@ -86,8 +87,8 @@ private:
};
inline Registers_x86::Registers_x86(const void *registers) {
static_assert(sizeof(Registers_x86) < sizeof(unw_context_t),
"x86 registers do not fit into unw_context_t");
static_assert((check_fit<Registers_x86, unw_context_t>::does_fit),
"x86 registers do not fit into unw_context_t");
memcpy(&_registers, registers, sizeof(_registers));
}
@@ -211,8 +212,10 @@ inline v128 Registers_x86::getVectorRegister(int) const {
inline void Registers_x86::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("no x86 vector registers");
}
#endif // _LIBUNWIND_TARGET_I386
#if defined(_LIBUNWIND_TARGET_X86_64)
/// Registers_x86_64 holds the register state of a thread in a 64-bit intel
/// process.
class _LIBUNWIND_HIDDEN Registers_x86_64 {
@@ -278,8 +281,8 @@ private:
};
inline Registers_x86_64::Registers_x86_64(const void *registers) {
static_assert(sizeof(Registers_x86_64) < sizeof(unw_context_t),
"x86_64 registers do not fit into unw_context_t");
static_assert((check_fit<Registers_x86_64, unw_context_t>::does_fit),
"x86_64 registers do not fit into unw_context_t");
memcpy(&_registers, registers, sizeof(_registers));
}
@@ -459,8 +462,10 @@ inline v128 Registers_x86_64::getVectorRegister(int) const {
inline void Registers_x86_64::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("no x86_64 vector registers");
}
#endif // _LIBUNWIND_TARGET_X86_64
#if defined(_LIBUNWIND_TARGET_PPC)
/// Registers_ppc holds the register state of a thread in a 32-bit PowerPC
/// process.
class _LIBUNWIND_HIDDEN Registers_ppc {
@@ -543,8 +548,8 @@ private:
};
inline Registers_ppc::Registers_ppc(const void *registers) {
static_assert(sizeof(Registers_ppc) < sizeof(unw_context_t),
"ppc registers do not fit into unw_context_t");
static_assert((check_fit<Registers_ppc, unw_context_t>::does_fit),
"ppc registers do not fit into unw_context_t");
memcpy(&_registers, static_cast<const uint8_t *>(registers),
sizeof(_registers));
static_assert(sizeof(ppc_thread_state_t) == 160,
@@ -1023,266 +1028,10 @@ inline const char *Registers_ppc::getRegisterName(int regNum) {
}
}
/// Registers_riscv holds the register state of a thread in a 64-bit RISC-V
/// process.
class _LIBUNWIND_HIDDEN Registers_riscv {
public:
Registers_riscv();
Registers_riscv(const void *registers);
bool validRegister(int num) const;
uint64_t getRegister(int num) const;
void setRegister(int num, uint64_t value);
bool validFloatRegister(int num) const;
double getFloatRegister(int num) const;
void setFloatRegister(int num, double value);
bool validVectorRegister(int num) const;
v128 getVectorRegister(int num) const;
void setVectorRegister(int num, v128 value);
const char *getRegisterName(int num);
void jumpto();
static int lastDwarfRegNum() { return 95; }
uint64_t getSP() const { return _registers.__x[2]; }
void setSP(uint64_t value) { _registers.__x[2] = value; }
uint64_t getIP() const { return _registers.__x[1]; }
void setIP(uint64_t value) { _registers.__x[1] = value; }
private:
struct GPRs {
uint64_t __x[32]; // x0-x31
};
GPRs _registers;
double _vectorHalfRegisters[32];
// Currently only the lower double in 128-bit vectore registers
// is perserved during unwinding. We could define new register
// numbers (> 96) which mean whole vector registers, then this
// struct would need to change to contain whole vector registers.
};
inline Registers_riscv::Registers_riscv(const void *registers) {
static_assert(sizeof(Registers_riscv) < sizeof(unw_context_t),
"riscv registers do not fit into unw_context_t");
memcpy(&_registers, registers, sizeof(_registers));
static_assert(sizeof(GPRs) == 0x100,
"expected VFP registers to be at offset 256");
memcpy(_vectorHalfRegisters,
static_cast<const uint8_t *>(registers) + sizeof(GPRs),
sizeof(_vectorHalfRegisters));
}
inline Registers_riscv::Registers_riscv() {
memset(&_registers, 0, sizeof(_registers));
memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters));
}
inline bool Registers_riscv::validRegister(int regNum) const {
if (regNum == UNW_REG_IP)
return true;
if (regNum == UNW_REG_SP)
return true;
if (regNum < 0)
return false;
if (regNum > 95)
return false;
if ((regNum > 31) && (regNum < 64))
return false;
return true;
}
inline uint64_t Registers_riscv::getRegister(int regNum) const {
if (regNum == UNW_REG_IP)
return _registers.__x[1];
if (regNum == UNW_REG_SP)
return _registers.__x[2];
if ((regNum >= 0) && (regNum < 32))
return _registers.__x[regNum];
_LIBUNWIND_ABORT("unsupported riscv register");
}
inline void Registers_riscv::setRegister(int regNum, uint64_t value) {
if (regNum == UNW_REG_IP)
_registers.__x[1] = value;
else if (regNum == UNW_REG_SP)
_registers.__x[2] = value;
else if ((regNum >= 0) && (regNum < 32))
_registers.__x[regNum] = value;
else
_LIBUNWIND_ABORT("unsupported riscv register");
}
inline const char *Registers_riscv::getRegisterName(int regNum) {
switch (regNum) {
case UNW_REG_IP:
return "ra";
case UNW_REG_SP:
return "sp";
case UNW_RISCV_X0:
return "x0";
case UNW_RISCV_X1:
return "ra";
case UNW_RISCV_X2:
return "sp";
case UNW_RISCV_X3:
return "x3";
case UNW_RISCV_X4:
return "x4";
case UNW_RISCV_X5:
return "x5";
case UNW_RISCV_X6:
return "x6";
case UNW_RISCV_X7:
return "x7";
case UNW_RISCV_X8:
return "x8";
case UNW_RISCV_X9:
return "x9";
case UNW_RISCV_X10:
return "x10";
case UNW_RISCV_X11:
return "x11";
case UNW_RISCV_X12:
return "x12";
case UNW_RISCV_X13:
return "x13";
case UNW_RISCV_X14:
return "x14";
case UNW_RISCV_X15:
return "x15";
case UNW_RISCV_X16:
return "x16";
case UNW_RISCV_X17:
return "x17";
case UNW_RISCV_X18:
return "x18";
case UNW_RISCV_X19:
return "x19";
case UNW_RISCV_X20:
return "x20";
case UNW_RISCV_X21:
return "x21";
case UNW_RISCV_X22:
return "x22";
case UNW_RISCV_X23:
return "x23";
case UNW_RISCV_X24:
return "x24";
case UNW_RISCV_X25:
return "x25";
case UNW_RISCV_X26:
return "x26";
case UNW_RISCV_X27:
return "x27";
case UNW_RISCV_X28:
return "x28";
case UNW_RISCV_X29:
return "x29";
case UNW_RISCV_X30:
return "x30";
case UNW_RISCV_X31:
return "x31";
case UNW_RISCV_D0:
return "d0";
case UNW_RISCV_D1:
return "d1";
case UNW_RISCV_D2:
return "d2";
case UNW_RISCV_D3:
return "d3";
case UNW_RISCV_D4:
return "d4";
case UNW_RISCV_D5:
return "d5";
case UNW_RISCV_D6:
return "d6";
case UNW_RISCV_D7:
return "d7";
case UNW_RISCV_D8:
return "d8";
case UNW_RISCV_D9:
return "d9";
case UNW_RISCV_D10:
return "d10";
case UNW_RISCV_D11:
return "d11";
case UNW_RISCV_D12:
return "d12";
case UNW_RISCV_D13:
return "d13";
case UNW_RISCV_D14:
return "d14";
case UNW_RISCV_D15:
return "d15";
case UNW_RISCV_D16:
return "d16";
case UNW_RISCV_D17:
return "d17";
case UNW_RISCV_D18:
return "d18";
case UNW_RISCV_D19:
return "d19";
case UNW_RISCV_D20:
return "d20";
case UNW_RISCV_D21:
return "d21";
case UNW_RISCV_D22:
return "d22";
case UNW_RISCV_D23:
return "d23";
case UNW_RISCV_D24:
return "d24";
case UNW_RISCV_D25:
return "d25";
case UNW_RISCV_D26:
return "d26";
case UNW_RISCV_D27:
return "d27";
case UNW_RISCV_D28:
return "d28";
case UNW_RISCV_D29:
return "d29";
case UNW_RISCV_D30:
return "d30";
case UNW_RISCV_D31:
return "d31";
default:
return "unknown register";
}
}
inline bool Registers_riscv::validFloatRegister(int regNum) const {
if (regNum < UNW_RISCV_D0)
return false;
if (regNum > UNW_RISCV_D31)
return false;
return true;
}
inline double Registers_riscv::getFloatRegister(int regNum) const {
assert(validFloatRegister(regNum));
return _vectorHalfRegisters[regNum - UNW_RISCV_D0];
}
inline void Registers_riscv::setFloatRegister(int regNum, double value) {
assert(validFloatRegister(regNum));
_vectorHalfRegisters[regNum - UNW_RISCV_D0] = value;
}
inline bool Registers_riscv::validVectorRegister(int) const {
return false;
}
inline v128 Registers_riscv::getVectorRegister(int) const {
_LIBUNWIND_ABORT("no riscv vector register support yet");
}
inline void Registers_riscv::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("no riscv vector register support yet");
}
#endif // _LIBUNWIND_TARGET_PPC
#if defined(_LIBUNWIND_TARGET_AARCH64)
/// Registers_arm64 holds the register state of a thread in a 64-bit arm
/// process.
class _LIBUNWIND_HIDDEN Registers_arm64 {
@@ -1329,8 +1078,8 @@ private:
};
inline Registers_arm64::Registers_arm64(const void *registers) {
static_assert(sizeof(Registers_arm64) < sizeof(unw_context_t),
"arm64 registers do not fit into unw_context_t");
static_assert((check_fit<Registers_arm64, unw_context_t>::does_fit),
"arm64 registers do not fit into unw_context_t");
memcpy(&_registers, registers, sizeof(_registers));
static_assert(sizeof(GPRs) == 0x110,
"expected VFP registers to be at offset 272");
@@ -1547,7 +1296,9 @@ inline v128 Registers_arm64::getVectorRegister(int) const {
inline void Registers_arm64::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("no arm64 vector register support yet");
}
#endif // _LIBUNWIND_TARGET_AARCH64
#if defined(_LIBUNWIND_TARGET_ARM)
/// Registers_arm holds the register state of a thread in a 32-bit arm
/// process.
///
@@ -1653,8 +1404,8 @@ inline Registers_arm::Registers_arm(const void *registers)
_saved_vfp_d16_d31(false),
_saved_iwmmx(false),
_saved_iwmmx_control(false) {
static_assert(sizeof(Registers_arm) < sizeof(unw_context_t),
"arm registers do not fit into unw_context_t");
static_assert((check_fit<Registers_arm, unw_context_t>::does_fit),
"arm registers do not fit into unw_context_t");
// See unw_getcontext() note about data.
memcpy(&_registers, registers, sizeof(_registers));
memset(&_vfp_d0_d15_pad, 0, sizeof(_vfp_d0_d15_pad));
@@ -1969,6 +1720,10 @@ inline v128 Registers_arm::getVectorRegister(int) const {
inline void Registers_arm::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("ARM vector support not implemented");
}
#endif // _LIBUNWIND_TARGET_ARM
#if defined(_LIBUNWIND_TARGET_OR1K)
/// Registers_or1k holds the register state of a thread in an OpenRISC1000
/// process.
class _LIBUNWIND_HIDDEN Registers_or1k {
@@ -2003,8 +1758,8 @@ private:
};
inline Registers_or1k::Registers_or1k(const void *registers) {
static_assert(sizeof(Registers_or1k) < sizeof(unw_context_t),
"or1k registers do not fit into unw_context_t");
static_assert((check_fit<Registers_or1k, unw_context_t>::does_fit),
"or1k registers do not fit into unw_context_t");
memcpy(&_registers, static_cast<const uint8_t *>(registers),
sizeof(_registers));
}
@@ -2151,6 +1906,268 @@ inline const char *Registers_or1k::getRegisterName(int regNum) {
}
}
#endif // _LIBUNWIND_TARGET_OR1K
#if defined(_LIBUNWIND_TARGET_RISCV)
/// Registers_riscv holds the register state of a thread in a 64-bit RISC-V
/// process.
class _LIBUNWIND_HIDDEN Registers_riscv {
public:
Registers_riscv();
Registers_riscv(const void *registers);
bool validRegister(int num) const;
uint64_t getRegister(int num) const;
void setRegister(int num, uint64_t value);
bool validFloatRegister(int num) const;
double getFloatRegister(int num) const;
void setFloatRegister(int num, double value);
bool validVectorRegister(int num) const;
v128 getVectorRegister(int num) const;
void setVectorRegister(int num, v128 value);
const char *getRegisterName(int num);
void jumpto();
static int lastDwarfRegNum() { return 95; }
uint64_t getSP() const { return _registers.__x[2]; }
void setSP(uint64_t value) { _registers.__x[2] = value; }
uint64_t getIP() const { return _registers.__x[1]; }
void setIP(uint64_t value) { _registers.__x[1] = value; }
private:
struct GPRs {
uint64_t __x[32]; // x0-x31
};
GPRs _registers;
double _vectorHalfRegisters[32];
// Currently only the lower double in 128-bit vectore registers
// is perserved during unwinding. We could define new register
// numbers (> 96) which mean whole vector registers, then this
// struct would need to change to contain whole vector registers.
};
inline Registers_riscv::Registers_riscv(const void *registers) {
static_assert((check_fit<Registers_riscv, unw_context_t>::does_fit),
"riscv registers do not fit into unw_context_t");
memcpy(&_registers, registers, sizeof(_registers));
static_assert(sizeof(GPRs) == 0x100,
"expected VFP registers to be at offset 256");
memcpy(_vectorHalfRegisters,
static_cast<const uint8_t *>(registers) + sizeof(GPRs),
sizeof(_vectorHalfRegisters));
}
inline Registers_riscv::Registers_riscv() {
memset(&_registers, 0, sizeof(_registers));
memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters));
}
inline bool Registers_riscv::validRegister(int regNum) const {
if (regNum == UNW_REG_IP)
return true;
if (regNum == UNW_REG_SP)
return true;
if (regNum < 0)
return false;
if (regNum > 95)
return false;
if ((regNum > 31) && (regNum < 64))
return false;
return true;
}
inline uint64_t Registers_riscv::getRegister(int regNum) const {
if (regNum == UNW_REG_IP)
return _registers.__x[1];
if (regNum == UNW_REG_SP)
return _registers.__x[2];
if ((regNum >= 0) && (regNum < 32))
return _registers.__x[regNum];
_LIBUNWIND_ABORT("unsupported riscv register");
}
inline void Registers_riscv::setRegister(int regNum, uint64_t value) {
if (regNum == UNW_REG_IP)
_registers.__x[1] = value;
else if (regNum == UNW_REG_SP)
_registers.__x[2] = value;
else if ((regNum >= 0) && (regNum < 32))
_registers.__x[regNum] = value;
else
_LIBUNWIND_ABORT("unsupported riscv register");
}
inline const char *Registers_riscv::getRegisterName(int regNum) {
switch (regNum) {
case UNW_REG_IP:
return "ra";
case UNW_REG_SP:
return "sp";
case UNW_RISCV_X0:
return "x0";
case UNW_RISCV_X1:
return "ra";
case UNW_RISCV_X2:
return "sp";
case UNW_RISCV_X3:
return "x3";
case UNW_RISCV_X4:
return "x4";
case UNW_RISCV_X5:
return "x5";
case UNW_RISCV_X6:
return "x6";
case UNW_RISCV_X7:
return "x7";
case UNW_RISCV_X8:
return "x8";
case UNW_RISCV_X9:
return "x9";
case UNW_RISCV_X10:
return "x10";
case UNW_RISCV_X11:
return "x11";
case UNW_RISCV_X12:
return "x12";
case UNW_RISCV_X13:
return "x13";
case UNW_RISCV_X14:
return "x14";
case UNW_RISCV_X15:
return "x15";
case UNW_RISCV_X16:
return "x16";
case UNW_RISCV_X17:
return "x17";
case UNW_RISCV_X18:
return "x18";
case UNW_RISCV_X19:
return "x19";
case UNW_RISCV_X20:
return "x20";
case UNW_RISCV_X21:
return "x21";
case UNW_RISCV_X22:
return "x22";
case UNW_RISCV_X23:
return "x23";
case UNW_RISCV_X24:
return "x24";
case UNW_RISCV_X25:
return "x25";
case UNW_RISCV_X26:
return "x26";
case UNW_RISCV_X27:
return "x27";
case UNW_RISCV_X28:
return "x28";
case UNW_RISCV_X29:
return "x29";
case UNW_RISCV_X30:
return "x30";
case UNW_RISCV_X31:
return "x31";
case UNW_RISCV_D0:
return "d0";
case UNW_RISCV_D1:
return "d1";
case UNW_RISCV_D2:
return "d2";
case UNW_RISCV_D3:
return "d3";
case UNW_RISCV_D4:
return "d4";
case UNW_RISCV_D5:
return "d5";
case UNW_RISCV_D6:
return "d6";
case UNW_RISCV_D7:
return "d7";
case UNW_RISCV_D8:
return "d8";
case UNW_RISCV_D9:
return "d9";
case UNW_RISCV_D10:
return "d10";
case UNW_RISCV_D11:
return "d11";
case UNW_RISCV_D12:
return "d12";
case UNW_RISCV_D13:
return "d13";
case UNW_RISCV_D14:
return "d14";
case UNW_RISCV_D15:
return "d15";
case UNW_RISCV_D16:
return "d16";
case UNW_RISCV_D17:
return "d17";
case UNW_RISCV_D18:
return "d18";
case UNW_RISCV_D19:
return "d19";
case UNW_RISCV_D20:
return "d20";
case UNW_RISCV_D21:
return "d21";
case UNW_RISCV_D22:
return "d22";
case UNW_RISCV_D23:
return "d23";
case UNW_RISCV_D24:
return "d24";
case UNW_RISCV_D25:
return "d25";
case UNW_RISCV_D26:
return "d26";
case UNW_RISCV_D27:
return "d27";
case UNW_RISCV_D28:
return "d28";
case UNW_RISCV_D29:
return "d29";
case UNW_RISCV_D30:
return "d30";
case UNW_RISCV_D31:
return "d31";
default:
return "unknown register";
}
}
inline bool Registers_riscv::validFloatRegister(int regNum) const {
if (regNum < UNW_RISCV_D0)
return false;
if (regNum > UNW_RISCV_D31)
return false;
return true;
}
inline double Registers_riscv::getFloatRegister(int regNum) const {
assert(validFloatRegister(regNum));
return _vectorHalfRegisters[regNum - UNW_RISCV_D0];
}
inline void Registers_riscv::setFloatRegister(int regNum, double value) {
assert(validFloatRegister(regNum));
_vectorHalfRegisters[regNum - UNW_RISCV_D0] = value;
}
inline bool Registers_riscv::validVectorRegister(int) const {
return false;
}
inline v128 Registers_riscv::getVectorRegister(int) const {
_LIBUNWIND_ABORT("no riscv vector register support yet");
}
inline void Registers_riscv::setVectorRegister(int, v128) {
_LIBUNWIND_ABORT("no riscv vector register support yet");
}
#endif // _LIBUNWIND_TARGET_RISCV
} // namespace libunwind
#endif // __REGISTERS_HPP__
@@ -438,39 +438,21 @@ extern "C" _Unwind_Reason_Code __aeabi_unwind_cpp_pr2(
}
static _Unwind_Reason_Code
unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
// EHABI #7.3 discusses preserving the VRS in a "temporary VRS" during
// phase 1 and then restoring it to the "primary VRS" for phase 2. The
// effect is phase 2 doesn't see any of the VRS manipulations from phase 1.
// In this implementation, the phases don't share the VRS backing store.
// Instead, they are passed the original |uc| and they create a new VRS
// from scratch thus achieving the same effect.
unw_cursor_t cursor1;
unw_init_local(&cursor1, uc);
unw_init_local(cursor, uc);
// Walk each frame looking for a place to stop.
for (bool handlerNotFound = true; handlerNotFound;) {
#if !_LIBUNWIND_ARM_EHABI
// Ask libuwind to get next frame (skip over first which is
// _Unwind_RaiseException).
int stepResult = unw_step(&cursor1);
if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n",
static_cast<void *>(exception_object));
return _URC_END_OF_STACK;
} else if (stepResult < 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step failed => "
"_URC_FATAL_PHASE1_ERROR\n",
static_cast<void *>(exception_object));
return _URC_FATAL_PHASE1_ERROR;
}
#endif
// See if frame has code to run (has personality routine).
unw_proc_info_t frameInfo;
if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) {
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n",
static_cast<void *>(exception_object));
@@ -482,12 +464,12 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf),
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
&offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
unw_word_t pc;
unw_get_reg(&cursor1, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
"lsda=0x%llX, personality=0x%llX\n",
@@ -505,7 +487,7 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
"unwind_phase1(ex_ojb=%p): calling personality function %p\n",
static_cast<void *>(exception_object),
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p)));
struct _Unwind_Context *context = (struct _Unwind_Context *)(&cursor1);
struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
exception_object->pr_cache.fnstart = frameInfo.start_ip;
exception_object->pr_cache.ehtp =
(_Unwind_EHT_Header *)frameInfo.unwind_info;
@@ -553,12 +535,11 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
return _URC_NO_REASON;
}
static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
_Unwind_Exception *exception_object,
bool resume) {
// See comment at the start of unwind_phase1 regarding VRS integrity.
unw_cursor_t cursor2;
unw_init_local(&cursor2, uc);
unw_init_local(cursor, uc);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
static_cast<void *>(exception_object));
@@ -580,33 +561,18 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
// for. After this, continue unwinding as if normal.
//
// See #7.4.6 for details.
unw_set_reg(&cursor2, UNW_REG_IP,
unw_set_reg(cursor, UNW_REG_IP,
exception_object->unwinder_cache.reserved2);
resume = false;
}
#if !_LIBUNWIND_ARM_EHABI
int stepResult = unw_step(&cursor2);
if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n",
static_cast<void *>(exception_object));
return _URC_END_OF_STACK;
} else if (stepResult < 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step failed => "
"_URC_FATAL_PHASE1_ERROR\n",
static_cast<void *>(exception_object));
return _URC_FATAL_PHASE2_ERROR;
}
#endif
// Get info about this frame.
unw_word_t sp;
unw_proc_info_t frameInfo;
unw_get_reg(&cursor2, UNW_REG_SP, &sp);
if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
unw_get_reg(cursor, UNW_REG_SP, &sp);
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n",
"failed => _URC_FATAL_PHASE2_ERROR\n",
static_cast<void *>(exception_object));
return _URC_FATAL_PHASE2_ERROR;
}
@@ -616,7 +582,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf),
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
&offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
@@ -632,7 +598,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
if (frameInfo.handler != 0) {
__personality_routine p =
(__personality_routine)(long)(frameInfo.handler);
struct _Unwind_Context *context = (struct _Unwind_Context *)(&cursor2);
struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
// EHABI #7.2
exception_object->pr_cache.fnstart = frameInfo.start_ip;
exception_object->pr_cache.ehtp =
@@ -661,8 +627,8 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
// We may get control back if landing pad calls _Unwind_Resume().
if (_LIBUNWIND_TRACING_UNWINDING) {
unw_word_t pc;
unw_get_reg(&cursor2, UNW_REG_IP, &pc);
unw_get_reg(&cursor2, UNW_REG_SP, &sp);
unw_get_reg(cursor, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_SP, &sp);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
"user code with ip=0x%llX, sp=0x%llX\n",
static_cast<void *>(exception_object),
@@ -673,10 +639,10 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
// EHABI #7.4.1 says we need to preserve pc for when _Unwind_Resume
// is called back, to find this same frame.
unw_word_t pc;
unw_get_reg(&cursor2, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_IP, &pc);
exception_object->unwinder_cache.reserved2 = (uint32_t)pc;
}
unw_resume(&cursor2);
unw_resume(cursor);
// unw_resume() only returns if there was an error.
return _URC_FATAL_PHASE2_ERROR;
@@ -705,6 +671,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n",
static_cast<void *>(exception_object));
unw_context_t uc;
unw_cursor_t cursor;
unw_getcontext(&uc);
// This field for is for compatibility with GCC to say this isn't a forced
@@ -712,12 +679,12 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
exception_object->unwinder_cache.reserved1 = 0;
// phase 1: the search phase
_Unwind_Reason_Code phase1 = unwind_phase1(&uc, exception_object);
_Unwind_Reason_Code phase1 = unwind_phase1(&uc, &cursor, exception_object);
if (phase1 != _URC_NO_REASON)
return phase1;
// phase 2: the clean up phase
return unwind_phase2(&uc, exception_object, false);
return unwind_phase2(&uc, &cursor, exception_object, false);
}
_LIBUNWIND_EXPORT void _Unwind_Complete(_Unwind_Exception* exception_object) {
@@ -742,12 +709,13 @@ _Unwind_Resume(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n",
static_cast<void *>(exception_object));
unw_context_t uc;
unw_cursor_t cursor;
unw_getcontext(&uc);
// _Unwind_RaiseException on EHABI will always set the reserved1 field to 0,
// which is in the same position as private_1 below.
// TODO(ajwong): Who wronte the above? Why is it true?
unwind_phase2(&uc, exception_object, true);
unwind_phase2(&uc, &cursor, exception_object, true);
// Clients assume _Unwind_Resume() does not return, so all we can do is abort.
_LIBUNWIND_ABORT("_Unwind_Resume() can't return");
@@ -481,30 +481,39 @@ private:
return stepWithCompactEncoding(dummy);
}
#if defined(_LIBUNWIND_TARGET_X86_64)
int stepWithCompactEncoding(Registers_x86_64 &) {
return CompactUnwinder_x86_64<A>::stepWithCompactEncoding(
_info.format, _info.start_ip, _addressSpace, _registers);
}
#endif
#if defined(_LIBUNWIND_TARGET_I386)
int stepWithCompactEncoding(Registers_x86 &) {
return CompactUnwinder_x86<A>::stepWithCompactEncoding(
_info.format, (uint32_t)_info.start_ip, _addressSpace, _registers);
}
#endif
#if defined(_LIBUNWIND_TARGET_PPC)
int stepWithCompactEncoding(Registers_ppc &) {
return UNW_EINVAL;
}
#endif
#if defined(_LIBUNWIND_TARGET_AARCH64)
int stepWithCompactEncoding(Registers_arm64 &) {
return CompactUnwinder_arm64<A>::stepWithCompactEncoding(
_info.format, _info.start_ip, _addressSpace, _registers);
}
#endif
bool compactSaysUseDwarf(uint32_t *offset=NULL) const {
R dummy;
return compactSaysUseDwarf(dummy, offset);
}
#if defined(_LIBUNWIND_TARGET_X86_64)
bool compactSaysUseDwarf(Registers_x86_64 &, uint32_t *offset) const {
if ((_info.format & UNWIND_X86_64_MODE_MASK) == UNWIND_X86_64_MODE_DWARF) {
if (offset)
@@ -513,7 +522,9 @@ private:
}
return false;
}
#endif
#if defined(_LIBUNWIND_TARGET_I386)
bool compactSaysUseDwarf(Registers_x86 &, uint32_t *offset) const {
if ((_info.format & UNWIND_X86_MODE_MASK) == UNWIND_X86_MODE_DWARF) {
if (offset)
@@ -522,11 +533,15 @@ private:
}
return false;
}
#endif
#if defined(_LIBUNWIND_TARGET_PPC)
bool compactSaysUseDwarf(Registers_ppc &, uint32_t *) const {
return true;
}
#endif
#if defined(_LIBUNWIND_TARGET_AARCH64)
bool compactSaysUseDwarf(Registers_arm64 &, uint32_t *offset) const {
if ((_info.format & UNWIND_ARM64_MODE_MASK) == UNWIND_ARM64_MODE_DWARF) {
if (offset)
@@ -535,6 +550,7 @@ private:
}
return false;
}
#endif
#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND
#if _LIBUNWIND_SUPPORT_DWARF_UNWIND
@@ -543,29 +559,41 @@ private:
return dwarfEncoding(dummy);
}
#if defined(_LIBUNWIND_TARGET_X86_64)
compact_unwind_encoding_t dwarfEncoding(Registers_x86_64 &) const {
return UNWIND_X86_64_MODE_DWARF;
}
#endif
#if defined(_LIBUNWIND_TARGET_I386)
compact_unwind_encoding_t dwarfEncoding(Registers_x86 &) const {
return UNWIND_X86_MODE_DWARF;
}
#endif
#if defined(_LIBUNWIND_TARGET_PPC)
compact_unwind_encoding_t dwarfEncoding(Registers_ppc &) const {
return 0;
}
#endif
#if defined(_LIBUNWIND_TARGET_AARCH64)
compact_unwind_encoding_t dwarfEncoding(Registers_arm64 &) const {
return UNWIND_ARM64_MODE_DWARF;
}
#endif
#if defined (_LIBUNWIND_TARGET_OR1K)
compact_unwind_encoding_t dwarfEncoding(Registers_or1k &) const {
return 0;
}
#endif
#if defined (_LIBUNWIND_TARGET_RISCV)
compact_unwind_encoding_t dwarfEncoding(Registers_riscv &) const {
return 0;
}
#endif
#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND
@@ -581,7 +609,7 @@ template <typename A, typename R>
UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
: _addressSpace(as), _registers(context), _unwindInfoMissing(false),
_isSignalFrame(false) {
static_assert(sizeof(UnwindCursor<A, R>) < sizeof(unw_cursor_t),
static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit),
"UnwindCursor<> does not fit in unw_cursor_t");
memset(&_info, 0, sizeof(_info));
}
@@ -33,16 +33,15 @@
#if !_LIBUNWIND_ARM_EHABI
static _Unwind_Reason_Code
unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
unw_cursor_t cursor1;
unw_init_local(&cursor1, uc);
unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
unw_init_local(cursor, uc);
// Walk each frame looking for a place to stop.
bool handlerNotFound = true;
while (handlerNotFound) {
// Ask libuwind to get next frame (skip over first which is
// _Unwind_RaiseException).
int stepResult = unw_step(&cursor1);
int stepResult = unw_step(cursor);
if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n",
@@ -58,7 +57,7 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
// See if frame has code to run (has personality routine).
unw_proc_info_t frameInfo;
unw_word_t sp;
if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) {
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n",
(void *)exception_object);
@@ -70,12 +69,12 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf),
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
&offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
unw_word_t pc;
unw_get_reg(&cursor1, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",
@@ -93,13 +92,13 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
(void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult =
(*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
exception_object, (struct _Unwind_Context *)(&cursor1));
exception_object, (struct _Unwind_Context *)(cursor));
switch (personalityResult) {
case _URC_HANDLER_FOUND:
// found a catch clause or locals that need destructing in this frame
// stop search and remember stack pointer at the frame
handlerNotFound = false;
unw_get_reg(&cursor1, UNW_REG_SP, &sp);
unw_get_reg(cursor, UNW_REG_SP, &sp);
exception_object->private_2 = (uintptr_t)sp;
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
@@ -127,9 +126,8 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
static _Unwind_Reason_Code
unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
unw_cursor_t cursor2;
unw_init_local(&cursor2, uc);
unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
unw_init_local(cursor, uc);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
(void *)exception_object);
@@ -139,7 +137,7 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
// Ask libuwind to get next frame (skip over first which is
// _Unwind_RaiseException).
int stepResult = unw_step(&cursor2);
int stepResult = unw_step(cursor);
if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n",
@@ -155,8 +153,8 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
// Get info about this frame.
unw_word_t sp;
unw_proc_info_t frameInfo;
unw_get_reg(&cursor2, UNW_REG_SP, &sp);
if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
unw_get_reg(cursor, UNW_REG_SP, &sp);
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n",
(void *)exception_object);
@@ -168,7 +166,7 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf),
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
&offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
@@ -191,7 +189,7 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
}
_Unwind_Reason_Code personalityResult =
(*p)(1, action, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)(&cursor2));
(struct _Unwind_Context *)(cursor));
switch (personalityResult) {
case _URC_CONTINUE_UNWIND:
// Continue unwinding
@@ -212,14 +210,14 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
// We may get control back if landing pad calls _Unwind_Resume().
if (_LIBUNWIND_TRACING_UNWINDING) {
unw_word_t pc;
unw_get_reg(&cursor2, UNW_REG_IP, &pc);
unw_get_reg(&cursor2, UNW_REG_SP, &sp);
unw_get_reg(cursor, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_SP, &sp);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
"user code with ip=0x%" PRIx64
", sp=0x%" PRIx64 "\n",
(void *)exception_object, pc, sp);
}
unw_resume(&cursor2);
unw_resume(cursor);
// unw_resume() only returns if there was an error.
return _URC_FATAL_PHASE2_ERROR;
default:
@@ -237,18 +235,17 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
}
static _Unwind_Reason_Code
unwind_phase2_forced(unw_context_t *uc,
unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
_Unwind_Exception *exception_object,
_Unwind_Stop_Fn stop, void *stop_parameter) {
unw_cursor_t cursor2;
unw_init_local(&cursor2, uc);
unw_init_local(cursor, uc);
// Walk each frame until we reach where search phase said to stop
while (unw_step(&cursor2) > 0) {
while (unw_step(cursor) > 0) {
// Update info about this frame.
unw_proc_info_t frameInfo;
if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step "
"failed => _URC_END_OF_STACK\n",
(void *)exception_object);
@@ -260,7 +257,7 @@ unwind_phase2_forced(unw_context_t *uc,
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf),
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
&offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
@@ -276,7 +273,7 @@ unwind_phase2_forced(unw_context_t *uc,
(_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE);
_Unwind_Reason_Code stopResult =
(*stop)(1, action, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)(&cursor2), stop_parameter);
(struct _Unwind_Context *)(cursor), stop_parameter);
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): stop function returned %d\n",
(void *)exception_object, stopResult);
@@ -296,7 +293,7 @@ unwind_phase2_forced(unw_context_t *uc,
(void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult =
(*p)(1, action, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)(&cursor2));
(struct _Unwind_Context *)(cursor));
switch (personalityResult) {
case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
@@ -311,7 +308,7 @@ unwind_phase2_forced(unw_context_t *uc,
"_URC_INSTALL_CONTEXT\n",
(void *)exception_object);
// We may get control back if landing pad calls _Unwind_Resume().
unw_resume(&cursor2);
unw_resume(cursor);
break;
default:
// Personality routine returned an unknown result code.
@@ -332,7 +329,7 @@ unwind_phase2_forced(unw_context_t *uc,
_Unwind_Action lastAction =
(_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK);
(*stop)(1, lastAction, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)(&cursor2), stop_parameter);
(struct _Unwind_Context *)(cursor), stop_parameter);
// Clean up phase did not resume at the frame that the search phase said it
// would.
@@ -346,6 +343,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n",
(void *)exception_object);
unw_context_t uc;
unw_cursor_t cursor;
unw_getcontext(&uc);
// Mark that this is a non-forced unwind, so _Unwind_Resume()
@@ -354,12 +352,12 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
exception_object->private_2 = 0;
// phase 1: the search phase
_Unwind_Reason_Code phase1 = unwind_phase1(&uc, exception_object);
_Unwind_Reason_Code phase1 = unwind_phase1(&uc, &cursor, exception_object);
if (phase1 != _URC_NO_REASON)
return phase1;
// phase 2: the clean up phase
return unwind_phase2(&uc, exception_object);
return unwind_phase2(&uc, &cursor, exception_object);
}
@@ -379,14 +377,15 @@ _LIBUNWIND_EXPORT void
_Unwind_Resume(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n", (void *)exception_object);
unw_context_t uc;
unw_cursor_t cursor;
unw_getcontext(&uc);
if (exception_object->private_1 != 0)
unwind_phase2_forced(&uc, exception_object,
unwind_phase2_forced(&uc, &cursor, exception_object,
(_Unwind_Stop_Fn) exception_object->private_1,
(void *)exception_object->private_2);
else
unwind_phase2(&uc, exception_object);
unwind_phase2(&uc, &cursor, exception_object);
// Clients assume _Unwind_Resume() does not return, so all we can do is abort.
_LIBUNWIND_ABORT("_Unwind_Resume() can't return");
@@ -403,6 +402,7 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
_LIBUNWIND_TRACE_API("_Unwind_ForcedUnwind(ex_obj=%p, stop=%p)\n",
(void *)exception_object, (void *)(uintptr_t)stop);
unw_context_t uc;
unw_cursor_t cursor;
unw_getcontext(&uc);
// Mark that this is a forced unwind, so _Unwind_Resume() can do
@@ -411,7 +411,7 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
exception_object->private_2 = (uintptr_t) stop_parameter;
// do it
return unwind_phase2_forced(&uc, exception_object, stop, stop_parameter);
return unwind_phase2_forced(&uc, &cursor, exception_object, stop, stop_parameter);
}
@@ -282,8 +282,8 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
ldp x22,x23, [x0, #0x0B0]
ldp x24,x25, [x0, #0x0C0]
ldp x26,x27, [x0, #0x0D0]
ldp x28,fp, [x0, #0x0E0]
ldr lr, [x0, #0x100] // restore pc into lr
ldp x28,x29, [x0, #0x0E0]
ldr x30, [x0, #0x100] // restore pc into lr
ldr x1, [x0, #0x0F8]
mov sp,x1 // restore sp
@@ -306,7 +306,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
ldr d31, [x0, #0x208]
ldp x0, x1, [x0, #0x000] // restore x0,x1
ret lr // jump to pc
ret x30 // jump to pc
#elif defined(__arm__) && !defined(__APPLE__)
@@ -263,11 +263,11 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
stp x22,x23, [x0, #0x0B0]
stp x24,x25, [x0, #0x0C0]
stp x26,x27, [x0, #0x0D0]
stp x28,fp, [x0, #0x0E0]
str lr, [x0, #0x0F0]
stp x28,x29, [x0, #0x0E0]
str x30, [x0, #0x0F0]
mov x1,sp
str x1, [x0, #0x0F8]
str lr, [x0, #0x100] // store return address as pc
str x30, [x0, #0x100] // store return address as pc
// skip cpsr
stp d0, d1, [x0, #0x110]
stp d2, d3, [x0, #0x120]
+64 -49
View File
@@ -16,6 +16,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
// Define static_assert() unless already defined by compiler.
#ifndef __has_feature
@@ -29,28 +30,6 @@
// Platform specific configuration defines.
#ifdef __APPLE__
#include <Availability.h>
#ifdef __cplusplus
extern "C" {
#endif
void __assert_rtn(const char *, const char *, int, const char *)
__attribute__((noreturn));
#ifdef __cplusplus
}
#endif
#define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \
defined(__x86_64__) || \
defined(__arm64__) || \
defined(__mips__))
#define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__)
#define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \
defined(__x86_64__))
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
#define _LIBUNWIND_ABORT(msg) __assert_rtn(__func__, __FILE__, __LINE__, msg)
#if defined(FOR_DYLD)
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0
@@ -60,36 +39,52 @@
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#endif
#else
#include <stdlib.h>
static inline void assert_rtn(const char* func, const char* file, int line, const char* msg) __attribute__ ((noreturn));
static inline void assert_rtn(const char* func, const char* file, int line, const char* msg) {
fprintf(stderr, "libunwind: %s %s:%d - %s\n", func, file, line, msg);
assert(false);
abort();
}
#define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \
defined(__x86_64__) || \
defined(__arm__) || \
defined(__aarch64__) || \
defined(__riscv__))
#define _LIBUNWIND_BUILD_SJLJ_APIS 0
#define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \
defined(__x86_64__))
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
#define _LIBUNWIND_ABORT(msg) assert_rtn(__func__, __FILE__, __LINE__, msg)
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND !defined(__arm__) || \
defined(__ARM_DWARF_EH__)
#define _LIBUNWIND_SUPPORT_DWARF_INDEX _LIBUNWIND_SUPPORT_DWARF_UNWIND
#if defined(__ARM_DWARF_EH__) || !defined(__arm__)
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 1
#else
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#endif
#endif
// FIXME: these macros are not correct for COFF targets
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
#if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
#define _LIBUNWIND_BUILD_SJLJ_APIS 1
#else
#define _LIBUNWIND_BUILD_SJLJ_APIS 0
#endif
#if defined(__i386__) || defined(__x86_64__)
#define _LIBUNWIND_SUPPORT_FRAME_APIS 1
#else
#define _LIBUNWIND_SUPPORT_FRAME_APIS 0
#endif
#if defined(__i386__) || defined(__x86_64__) || \
(!defined(__APPLE__) && defined(__arm__)) || \
(defined(__arm64__) || defined(__aarch64__)) || \
(defined(__APPLE__) && defined(__mips__)) || \
defined(__riscv__)
#define _LIBUNWIND_BUILD_ZERO_COST_APIS 1
#else
#define _LIBUNWIND_BUILD_ZERO_COST_APIS 0
#endif
#define _LIBUNWIND_ABORT(msg) \
do { \
fprintf(stderr, "libunwind: %s %s:%d - %s\n", __func__, __FILE__, \
__LINE__, msg); \
fflush(stderr); \
abort(); \
} while (0)
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
// Macros that define away in non-Debug builds
#ifdef NDEBUG
@@ -125,5 +120,25 @@
#define _LIBUNWIND_TRACING_UNWINDING logUnwinding()
#endif
#ifdef __cplusplus
// Used to fit UnwindCursor and Registers_xxx types against unw_context_t /
// unw_cursor_t sized memory blocks.
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
# define COMP_OP ==
#else
# define COMP_OP <
#endif
template <typename _Type, typename _Mem>
struct check_fit {
template <typename T>
struct blk_count {
static const size_t count =
(sizeof(T) + sizeof(uint64_t) - 1) / sizeof(uint64_t);
};
static const bool does_fit =
(blk_count<_Type>::count COMP_OP blk_count<_Mem>::count);
};
#undef COMP_OP
#endif // __cplusplus
#endif // LIBUNWIND_CONFIG_H
@@ -45,33 +45,29 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
_LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)\n",
static_cast<void *>(cursor),
static_cast<void *>(context));
// Use "placement new" to allocate UnwindCursor in the cursor buffer.
#if defined(__i386__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86>(
context, LocalAddressSpace::sThisAddressSpace);
# define REGISTER_KIND Registers_x86
#elif defined(__x86_64__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86_64>(
context, LocalAddressSpace::sThisAddressSpace);
# define REGISTER_KIND Registers_x86_64
#elif defined(__ppc__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_ppc>(
context, LocalAddressSpace::sThisAddressSpace);
#elif defined(__arm64__) || defined(__aarch64__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm64>(
context, LocalAddressSpace::sThisAddressSpace);
# define REGISTER_KIND Registers_ppc
#elif defined(__aarch64__)
# define REGISTER_KIND Registers_arm64
#elif _LIBUNWIND_ARM_EHABI
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm>(
context, LocalAddressSpace::sThisAddressSpace);
# define REGISTER_KIND Registers_arm
#elif defined(__or1k__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_or1k>(
context, LocalAddressSpace::sThisAddressSpace);
#elif defined(__mips__)
#warning The MIPS architecture is not supported.
# define REGISTER_KIND Registers_or1k
#elif defined(__riscv__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_riscv>(
context, LocalAddressSpace::sThisAddressSpace);
# define REGISTER_KIND Registers_riscv
#elif defined(__mips__)
# warning The MIPS architecture is not supported.
#else
#error Architecture not supported
# error Architecture not supported
#endif
// Use "placement new" to allocate UnwindCursor in the cursor buffer.
new ((void *)cursor) UnwindCursor<LocalAddressSpace, REGISTER_KIND>(
context, LocalAddressSpace::sThisAddressSpace);
#undef REGISTER_KIND
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
co->setInfoBasedOnIPRegister();
@@ -2731,7 +2731,6 @@ bool X86TargetInfo::initFeatureMap(
setFeatureEnabledImpl(Features, "prfchw", true);
setFeatureEnabledImpl(Features, "cx16", true);
setFeatureEnabledImpl(Features, "fxsr", true);
setFeatureEnabledImpl(Features, "xsave", true);
break;
case CK_BDVER4:
setFeatureEnabledImpl(Features, "avx2", true);
@@ -7922,12 +7922,12 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (IsPIE)
CmdArgs.push_back("-pie");
CmdArgs.push_back("--eh-frame-hdr");
if (Args.hasArg(options::OPT_static)) {
CmdArgs.push_back("-Bstatic");
} else {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
CmdArgs.push_back("--eh-frame-hdr");
if (Args.hasArg(options::OPT_shared)) {
CmdArgs.push_back("-Bshareable");
} else {
+25 -13
View File
@@ -101,6 +101,7 @@ struct mpage {
char *arch; /* architecture from file content */
char *title; /* title from file content */
char *desc; /* description from file content */
struct mpage *next; /* singly linked list */
struct mlink *mlinks; /* singly linked list */
int form; /* format from file content */
int name_head_done;
@@ -144,6 +145,7 @@ static void dbadd_mlink_name(const struct mlink *mlink);
static int dbopen(int);
static void dbprune(void);
static void filescan(const char *);
static int fts_compare(const FTSENT *const *, const FTSENT *const *);
static void mlink_add(struct mlink *, const struct stat *);
static void mlink_check(struct mpage *, struct mlink *);
static void mlink_free(struct mlink *);
@@ -202,6 +204,7 @@ static struct ohash strings; /* table of all strings */
static sqlite3 *db = NULL; /* current database */
static sqlite3_stmt *stmts[STMT__MAX]; /* current statements */
static uint64_t name_mask;
static struct mpage *mpage_head;
static const struct mdoc_handler mdocs[MDOC_MAX] = {
{ NULL, 0 }, /* Ap */
@@ -562,6 +565,20 @@ usage:
return (int)MANDOCLEVEL_BADARG;
}
static int
fts_compare(const FTSENT *const *a, const FTSENT *const *b)
{
/*
* The mpage list is processed in the opposite order to which pages are
* added, so traverse the hierarchy in reverse alpha order, resulting
* in database inserts in alpha order. This is not required for correct
* operation, but is helpful when inspecting the database during
* development.
*/
return -strcmp((*a)->fts_name, (*b)->fts_name);
}
/*
* Scan a directory tree rooted at "basedir" for manpages.
* We use fts(), scanning directory parts along the way for clues to our
@@ -591,8 +608,8 @@ treescan(void)
argv[0] = ".";
argv[1] = (char *)NULL;
f = fts_open((char * const *)argv,
FTS_PHYSICAL | FTS_NOCHDIR, NULL);
f = fts_open((char * const *)argv, FTS_PHYSICAL | FTS_NOCHDIR,
fts_compare);
if (f == NULL) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&fts_open");
@@ -957,6 +974,8 @@ mlink_add(struct mlink *mlink, const struct stat *st)
mpage = mandoc_calloc(1, sizeof(struct mpage));
mpage->inodev.st_ino = inodev.st_ino;
mpage->inodev.st_dev = inodev.st_dev;
mpage->next = mpage_head;
mpage_head = mpage;
ohash_insert(&mpages, slot, mpage);
} else
mlink->next = mpage->mlinks;
@@ -980,20 +999,18 @@ mpages_free(void)
{
struct mpage *mpage;
struct mlink *mlink;
unsigned int slot;
mpage = ohash_first(&mpages, &slot);
while (NULL != mpage) {
while (NULL != (mpage = mpage_head)) {
while (NULL != (mlink = mpage->mlinks)) {
mpage->mlinks = mlink->next;
mlink_free(mlink);
}
mpage_head = mpage->next;
free(mpage->sec);
free(mpage->arch);
free(mpage->title);
free(mpage->desc);
free(mpage);
mpage = ohash_next(&mpages, &slot);
}
}
@@ -1114,18 +1131,14 @@ mpages_merge(struct mparse *mp)
char *sodest;
char *cp;
int fd;
unsigned int pslot;
if ( ! nodb)
SQL_EXEC("BEGIN TRANSACTION");
mpage = ohash_first(&mpages, &pslot);
while (mpage != NULL) {
for (mpage = mpage_head; mpage != NULL; mpage = mpage->next) {
mlinks_undupe(mpage);
if ((mlink = mpage->mlinks) == NULL) {
mpage = ohash_next(&mpages, &pslot);
if ((mlink = mpage->mlinks) == NULL)
continue;
}
name_mask = NAME_MASK;
mandoc_ohash_init(&names, 4, offsetof(struct str, key));
@@ -1247,7 +1260,6 @@ mpages_merge(struct mparse *mp)
nextpage:
ohash_delete(&strings);
ohash_delete(&names);
mpage = ohash_next(&mpages, &pslot);
}
if (0 == nodb)
@@ -88,7 +88,7 @@ static struct test {
0xFFFF, 0x5D, 0x5B, 0x10000, 0x10FFFF, 0x5D, 0x0A
},
#ifdef __FreeBSD__
{ 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1,
{ 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1,
#else
{ 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1,
#endif
+2 -2
View File
@@ -4,7 +4,7 @@ This file is automatically generated from html/copyright.html
jpg "Clone me," says Dolly sheepishly.
Last update: 17-Jan-2015 00:16 UTC
Last update: 2-Jan-2017 11:58 UTC
_________________________________________________________________
The following copyright notice applies to all files collectively
@@ -33,7 +33,7 @@ This file is automatically generated from html/copyright.html
Burnicki is:
***********************************************************************
* *
* Copyright (c) Network Time Foundation 2011-2015 *
* Copyright (c) Network Time Foundation 2011-2017 *
* *
* All Rights Reserved *
* *
+141 -1
View File
@@ -1,3 +1,143 @@
---
(4.2.8p10-win-beta1) 2017/03/21 Released by Harlan Stenn <[email protected]>
(4.2.8p10)
* [Sec 3389] NTP-01-016: Denial of Service via Malformed Config
(Pentest report 01.2017) <[email protected]>
* [Sec 3388] NTP-01-014: Buffer Overflow in DPTS Clock
(Pentest report 01.2017) <[email protected]>
* [Sec 3387] NTP-01-012: Authenticated DoS via Malicious Config Option
(Pentest report 01.2017) <[email protected]>
* [Sec 3386] NTP-01-011: ntpq_stripquotes() returns incorrect Value
(Pentest report 01.2017) <[email protected]>
* [Sec 3385] NTP-01-010: ereallocarray()/eallocarray() underused. HStenn
* [Sec 3384] NTP-01-009: Privileged execution of User Library code
(Pentest report 01.2017) <[email protected]>
* [Sec 3383] NTP-01-008: Stack Buffer Overflow from Command Line
(Pentest report 01.2017) <[email protected]>
* [Sec 3382] NTP-01-007: Data Structure terminated insufficiently
(Pentest report 01.2017) <[email protected]>
* [Sec 3380] NTP-01-005: Off-by-one in Oncore GPS Receiver
(Pentest report 01.2017) <[email protected]>
* [Sec 3379] NTP-01-004: Potential Overflows in ctl_put() functions
(Pentest report 01.2017) <[email protected]>
* [Sec 3378] NTP-01-003: Improper use of snprintf() in mx4200_send()
(Pentest report 01.2017) <[email protected]>
* [Sec 3377] NTP-01-002: Buffer Overflow in ntpq when fetching reslist
(Pentest report 01.2017) <[email protected]
* [Sec 3376] Support build "hardening" flags. [email protected]
* [Sec 3361] 0rigin (zero origin) DoS. HStenn.
* [Bug 3393] clang scan-build findings <[email protected]>
* [Bug 3363] Support for openssl-1.1.0 without compatibility modes
- rework of patch set from <[email protected]>. <[email protected]>
* [Bug 3356] Bugfix 3072 breaks multicastclient <[email protected]>
* [Bug 3216] libntp audio ioctl() args incorrectly cast to int
on 4.4BSD-Lite derived platforms <[email protected]>
- original patch by Majdi S. Abbas
* [Bug 3215] 'make distcheck' fails with new BK repo format <[email protected]>
* [Bug 3173] forking async worker: interrupted pipe I/O <[email protected]>
- initial patch by Christos Zoulas
* [Bug 3139] (...) time_pps_create: Exec format error <[email protected]>
- move loader API from 'inline' to proper source
- augment pathless dlls with absolute path to NTPD
- use 'msyslog()' instead of 'printf() 'for reporting trouble
* [Bug 3107] Incorrect Logic for Peer Event Limiting <[email protected]>
- applied patch by Matthew Van Gundy
* [Bug 3065] Quiet warnings on NetBSD <[email protected]>
- applied some of the patches provided by Havard. Not all of them
still match the current code base, and I did not touch libopt.
* [Bug 3062] Change the process name of forked DNS worker <[email protected]>
- applied patch by Reinhard Max. See bugzilla for limitations.
* [Bug 2923] Trap Configuration Fail <[email protected]>
- fixed dependency inversion from [Bug 2837]
* [Bug 2896] Nothing happens if minsane < maxclock < minclock
- produce ERROR log message about dysfunctional daemon. <[email protected]>
* [Bug 2851] allow -4/-6 on restrict line with mask <[email protected]>
- applied patch by Miroslav Lichvar for ntp4.2.6 compat
* [Bug 2645] out-of-bound pointers in ctl_putsys and decode_bitflags
- Fixed these and some more locations of this pattern.
Probably din't get them all, though. <[email protected]>
* Update copyright year.
* bk-7 trigger updates
---
(4.2.8p9-win) 2017/02/01 Released by Harlan Stenn <[email protected]>
* [Bug 3144] NTP does not build without openSSL. <[email protected]>
- added missed changeset for automatic openssl lib detection
- fixed some minor warning issues
* [Bug 3095] More compatibility with openssl 1.1. <[email protected]>
* configure.ac cleanup. [email protected]
* openssl configure cleanup. [email protected]
---
(4.2.8p9) 2016/11/21 Released by Harlan Stenn <[email protected]>
* [Sec 3119] Trap crash <[email protected]>
* [Sec 3118] Mode 6 information disclosure and DDoS vector <[email protected]>
- TRAP config via mode 6 packet requires AUTH now.
* [Sec 3114] Broadcast Mode Replay Prevention DoS
- applied patches by Matthew Van Gundy. <[email protected]>
- with bcpollbstep, tweaks and cleanup by [email protected]
* [Sec 3113] Broadcast Mode Poll Interval Enforcement DoS <[email protected]>
- applied fix as suggested by Matthew Van Gundy
* [Sec 3110] Windows: ntpd DoS by oversized UDP packet
- fixed error handling for truncated UDP packets. <[email protected]>
* [Sec 3102] Zero origin issues. HStenn.
* [Sec 3082] null pointer dereference in _IO_str_init_static_internal()
- more hardening to read_mru_list(). [email protected]
* [Sec 3072] Attack on interface selection <[email protected]>
- implemented Miroslav Lichvars <[email protected]> suggestion
to skip interface updates based on incoming packets
* [Bug 3142] bug in netmask prefix length detection <[email protected]>
* [Bug 3138] gpsdjson refclock should honor fudgetime1. [email protected]
* [Bug 3129] Unknown hosts can put resolver thread into a hard loop
- moved retry decision where it belongs. <[email protected]>
* [Bug 3125] NTPD doesn't fully start when ntp.conf entries are out of order
using the loopback-ppsapi-provider.dll <[email protected]>
* [Bug 3116] unit tests for NTP time stamp expansion. <[email protected]>
* [Bug 3100] ntpq can't retrieve daemon_version <[email protected]>
- fixed extended sysvar lookup (bug introduced with bug 3008 fix)
* [Bug 3095] Compatibility with openssl 1.1 <[email protected]>
- applied patches by Kurt Roeckx <[email protected]> to source
- added shim layer for SSL API calls with issues (both directions)
* [Bug 3089] Serial Parser does not work anymore for hopfser like device
- simplified / refactored hex-decoding in driver. <[email protected]>
* [Bug 3084] update-leap mis-parses the leapfile name. HStenn.
* [Bug 3068] Linker warnings when building on Solaris. [email protected]
- applied patch thanks to Andrew Stormont <[email protected]>
* [Bug 3067] Root distance calculation needs improvement. HStenn.
* [Bug 3066] NMEA clock ignores pps. [email protected]
- PPS-HACK works again.
* [Bug 3059] Potential buffer overrun from oversized hash <[email protected]>
- applied patch by Brian Utterback <[email protected]>
* [Bug 3053] ntp_loopfilter.c frequency calc precedence error. Sarah White.
* [Bug 3050] Fix for bug #2960 causes [...] spurious error message.
<[email protected]>
- patches by Reinhard Max <[email protected]> and Havard Eidnes <[email protected]>
* [Bug 3047] Fix refclock_jjy C-DEX JST2000. [email protected]
- Patch provided by Kuramatsu.
* [Bug 3021] unity_fixture.c needs pragma weak <[email protected]>
- removed unnecessary & harmful decls of 'setUp()' & 'tearDown()'
* [Bug 3019] Windows: ERROR_HOST_UNREACHABLE block packet processing.
DMayer and JPerlinger.
* [Bug 2998] sntp/tests/packetProcessing.c broken without openssl. JPerlinger
* [Bug 2961] sntp/tests/packetProcessing.c assumes AUTOKEY. HStenn.
* [Bug 2959] refclock_jupiter: gps week correction <[email protected]>
- fixed GPS week expansion to work based on build date. Special thanks
to Craig Leres for initial patch and testing.
* [Bug 2951] ntpd tests fail: multiple definition of `send_via_ntp_signd'
- fixed Makefile.am <[email protected]>
* [Bug 2689] ATOM driver processes last PPS pulse at startup,
even if it is very old <[email protected]>
- make sure PPS source is alive before processing samples
- improve stability close to the 500ms phase jump (phase gate)
* Fix typos in include/ntp.h.
* Shim X509_get_signature_nid() if needed.
* git author attribution cleanup
* bk ignore file cleanup
* remove locks in Windows IO, use rpc-like thread synchronisation instead
---
(4.2.8p8) 2016/06/02 Released by Harlan Stenn <[email protected]>
@@ -19,7 +159,7 @@
* Fix typo in ntp-wait and plot_summary. HStenn.
* Make sure we have an "author" file for git imports. HStenn.
* Update the sntp problem tests for MacOS. HStenn.
---
(4.2.8p7) 2016/04/26 Released by Harlan Stenn <[email protected]>
+2414 -340
View File
File diff suppressed because it is too large. Load diff
+8 -10
View File
@@ -107,6 +107,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
$(top_srcdir)/sntp/m4/ntp_googletest.m4 \
$(top_srcdir)/sntp/m4/ntp_harden.m4 \
$(top_srcdir)/sntp/m4/ntp_ipv6.m4 \
$(top_srcdir)/sntp/m4/ntp_lib_m.m4 \
$(top_srcdir)/sntp/m4/ntp_libevent.m4 \
@@ -202,16 +203,14 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/sntp/libevent/build-aux/install-sh \
$(top_srcdir)/sntp/libevent/build-aux/ltmain.sh \
$(top_srcdir)/sntp/libevent/build-aux/missing ChangeLog \
INSTALL NEWS README TODO compile config.guess config.sub \
depcomp install-sh ltmain.sh missing \
sntp/libevent/build-aux/ar-lib sntp/libevent/build-aux/compile \
INSTALL NEWS README TODO sntp/libevent/build-aux/ar-lib \
sntp/libevent/build-aux/compile \
sntp/libevent/build-aux/config.guess \
sntp/libevent/build-aux/config.sub \
sntp/libevent/build-aux/depcomp \
sntp/libevent/build-aux/install-sh \
sntp/libevent/build-aux/ltmain.sh \
sntp/libevent/build-aux/missing sntp/libevent/build-aux/ylwrap \
ylwrap
sntp/libevent/build-aux/missing sntp/libevent/build-aux/ylwrap
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -280,10 +279,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
@@ -336,6 +331,7 @@ LN_S = @LN_S@
LSCF = @LSCF@
LTHREAD_LIBS = @LTHREAD_LIBS@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
@@ -399,6 +395,9 @@ NTPTRACE_DL = @NTPTRACE_DL@
NTPTRACE_DS = @NTPTRACE_DS@
NTPTRACE_MS = @NTPTRACE_MS@
NTPTRACE_NI = @NTPTRACE_NI@
NTP_HARD_CFLAGS = @NTP_HARD_CFLAGS@
NTP_HARD_CPPFLAGS = @NTP_HARD_CPPFLAGS@
NTP_HARD_LDFLAGS = @NTP_HARD_LDFLAGS@
NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
@@ -472,7 +471,6 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
+762
View File
@@ -1,3 +1,765 @@
--
NTP 4.2.8p10 (Harlan Stenn <[email protected]>, 2017/03/21)
Focus: Security, Bug fixes, enhancements.
Severity: MEDIUM
This release fixes 5 medium-, 6 low-, and 4 informational-severity
vulnerabilities, and provides 15 other non-security fixes and improvements:
* NTP-01-016 NTP: Denial of Service via Malformed Config (Medium)
Date Resolved: 21 Mar 2017
References: Sec 3389 / CVE-2017-6464 / VU#325339
Affects: All versions of NTP-4, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: MED 4.6 (AV:N/AC:H/Au:M/C:N/I:N/A:C)
CVSS3: MED 4.2 CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
A vulnerability found in the NTP server makes it possible for an
authenticated remote user to crash ntpd via a malformed mode
configuration directive.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page or
the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-014 NTP: Buffer Overflow in DPTS Clock (Low)
Date Resolved: 21 Mar 2017
References: Sec 3388 / CVE-2017-6462 / VU#325339
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: Low 1.0 (AV:L/AC:H/Au:S/C:N/I:N/A:P)
CVSS3: Low 1.6 CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
Summary:
There is a potential for a buffer overflow in the legacy Datum
Programmable Time Server refclock driver. Here the packets are
processed from the /dev/datum device and handled in
datum_pts_receive(). Since an attacker would be required to
somehow control a malicious /dev/datum device, this does not
appear to be a practical attack and renders this issue "Low" in
terms of severity.
Mitigation:
If you have a Datum reference clock installed and think somebody
may maliciously change the device, upgrade to 4.2.8p10, or
later, from the NTP Project Download Page or the NTP Public
Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-012 NTP: Authenticated DoS via Malicious Config Option (Medium)
Date Resolved: 21 Mar 2017
References: Sec 3387 / CVE-2017-6463 / VU#325339
Affects: All versions of ntp, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: MED 4.6 (AV:N/AC:H/Au:M/C:N/I:N/A:C)
CVSS3: MED 4.2 CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
A vulnerability found in the NTP server allows an authenticated
remote attacker to crash the daemon by sending an invalid setting
via the :config directive. The unpeer option expects a number or
an address as an argument. In case the value is "0", a
segmentation fault occurs.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-011 NTP: ntpq_stripquotes() returns incorrect value (Informational)
Date Resolved: 21 Mar 2017
References: Sec 3386
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: None 0.0 (AV:N/AC:H/Au:N/C:N/I:N/A:N)
CVSS3: None 0.0 CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:N
Summary:
The NTP Mode 6 monitoring and control client, ntpq, uses the
function ntpq_stripquotes() to remove quotes and escape characters
from a given string. According to the documentation, the function
is supposed to return the number of copied bytes but due to
incorrect pointer usage this value is always zero. Although the
return value of this function is never used in the code, this
flaw could lead to a vulnerability in the future. Since relying
on wrong return values when performing memory operations is a
dangerous practice, it is recommended to return the correct value
in accordance with the documentation pertinent to the code.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-010 NTP: ereallocarray()/eallocarray() underused (Info)
Date Resolved: 21 Mar 2017
References: Sec 3385
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
Summary:
NTP makes use of several wrappers around the standard heap memory
allocation functions that are provided by libc. This is mainly
done to introduce additional safety checks concentrated on
several goals. First, they seek to ensure that memory is not
accidentally freed, secondly they verify that a correct amount
is always allocated and, thirdly, that allocation failures are
correctly handled. There is an additional implementation for
scenarios where memory for a specific amount of items of the
same size needs to be allocated. The handling can be found in
the oreallocarray() function for which a further number-of-elements
parameter needs to be provided. Although no considerable threat
was identified as tied to a lack of use of this function, it is
recommended to correctly apply oreallocarray() as a preferred
option across all of the locations where it is possible.
Mitigation:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Credit:
This weakness was discovered by Cure53.
* NTP-01-009 NTP: Privileged execution of User Library code (WINDOWS
PPSAPI ONLY) (Low)
Date Resolved: 21 Mar 2017
References: Sec 3384 / CVE-2017-6455 / VU#325339
Affects: All Windows versions of ntp-4 that use the PPSAPI, up to but
not including ntp-4.2.8p10, and ntp-4.3.0 up to, but not
including ntp-4.3.94.
CVSS2: MED 3.8 (AV:L/AC:H/Au:S/C:N/I:N/A:C)
CVSS3: MED 4.0 CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
The Windows NT port has the added capability to preload DLLs
defined in the inherited global local environment variable
PPSAPI_DLLS. The code contained within those libraries is then
called from the NTPD service, usually running with elevated
privileges. Depending on how securely the machine is setup and
configured, if ntpd is configured to use the PPSAPI under Windows
this can easily lead to a code injection.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Credit:
This weakness was discovered by Cure53.
* NTP-01-008 NTP: Stack Buffer Overflow from Command Line (WINDOWS
installer ONLY) (Low)
Date Resolved: 21 Mar 2017
References: Sec 3383 / CVE-2017-6452 / VU#325339
Affects: WINDOWS installer ONLY: All versions of the ntp-4 Windows
installer, up to but not including ntp-4.2.8p10, and ntp-4.3.0 up
to, but not including ntp-4.3.94.
CVSS2: Low 1.0 (AV:L/AC:H/Au:S/C:N/I:N/A:P)
CVSS3: Low 1.8 CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
Summary:
The Windows installer for NTP calls strcat(), blindly appending
the string passed to the stack buffer in the addSourceToRegistry()
function. The stack buffer is 70 bytes smaller than the buffer
in the calling main() function. Together with the initially
copied Registry path, the combination causes a stack buffer
overflow and effectively overwrites the stack frame. The
passed application path is actually limited to 256 bytes by the
operating system, but this is not sufficient to assure that the
affected stack buffer is consistently protected against
overflowing at all times.
Mitigation:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Credit:
This weakness was discovered by Cure53.
* NTP-01-007 NTP: Data Structure terminated insufficiently (WINDOWS
installer ONLY) (Low)
Date Resolved: 21 Mar 2017
References: Sec 3382 / CVE-2017-6459 / VU#325339
Affects: WINDOWS installer ONLY: All ntp-4 versions of the Windows
installer, up to but not including ntp-4.2.8p10, and ntp-4.3.0
up to, but not including ntp-4.3.94.
CVSS2: Low 1.0 (AV:L/AC:H/Au:S/C:N/I:N/A:P)
CVSS3: Low 1.8 CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
Summary:
The Windows installer for NTP calls strcpy() with an argument
that specifically contains multiple null bytes. strcpy() only
copies a single terminating null character into the target
buffer instead of copying the required double null bytes in the
addKeysToRegistry() function. As a consequence, a garbage
registry entry can be created. The additional arsize parameter
is erroneously set to contain two null bytes and the following
call to RegSetValueEx() claims to be passing in a multi-string
value, though this may not be true.
Mitigation:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Credit:
This weakness was discovered by Cure53.
* NTP-01-006 NTP: Copious amounts of Unused Code (Informational)
References: Sec 3381
Summary:
The report says: Statically included external projects
potentially introduce several problems and the issue of having
extensive amounts of code that is "dead" in the resulting binary
must clearly be pointed out. The unnecessary unused code may or
may not contain bugs and, quite possibly, might be leveraged for
code-gadget-based branch-flow redirection exploits. Analogically,
having source trees statically included as well means a failure
in taking advantage of the free feature for periodical updates.
This solution is offered by the system's Package Manager. The
three libraries identified are libisc, libevent, and libopts.
Resolution:
For libisc, we already only use a portion of the original library.
We've found and fixed bugs in the original implementation (and
offered the patches to ISC), and plan to see what has changed
since we last upgraded the code. libisc is generally not
installed, and when it it we usually only see the static libisc.a
file installed. Until we know for sure that the bugs we've found
and fixed are fixed upstream, we're better off with the copy we
are using.
Version 1 of libevent was the only production version available
until recently, and we've been requiring version 2 for a long time.
But if the build system has at least version 2 of libevent
installed, we'll use the version that is installed on the system.
Otherwise, we provide a copy of libevent that we know works.
libopts is provided by GNU AutoGen, and that library and package
undergoes frequent API version updates. The version of autogen
used to generate the tables for the code must match the API
version in libopts. AutoGen can be ... difficult to build and
install, and very few developers really need it. So we have it
on our build and development machines, and we provide the
specific version of the libopts code in the distribution to make
sure that the proper API version of libopts is available.
As for the point about there being code in these libraries that
NTP doesn't use, OK. But other packages used these libraries as
well, and it is reasonable to assume that other people are paying
attention to security and code quality issues for the overall
libraries. It takes significant resources to analyze and
customize these libraries to only include what we need, and to
date we believe the cost of this effort does not justify the benefit.
Credit:
This issue was discovered by Cure53.
* NTP-01-005 NTP: Off-by-one in Oncore GPS Receiver (Low)
Date Resolved: 21 Mar 2017
References: Sec 3380
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: None 0.0 (AV:L/AC:H/Au:N/C:N/I:N/A:N)
CVSS3: None 0.0 CVSS:3.0/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:N
Summary:
There is a fencepost error in a "recovery branch" of the code for
the Oncore GPS receiver if the communication link to the ONCORE
is weak / distorted and the decoding doesn't work.
Mitigation:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page or
the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-004 NTP: Potential Overflows in ctl_put() functions (Medium)
Date Resolved: 21 Mar 2017
References: Sec 3379 / CVE-2017-6458 / VU#325339
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: MED 4.6 (AV:N/AC:H/Au:M/C:N/I:N/A:C)
CVSS3: MED 4.2 CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
ntpd makes use of different wrappers around ctl_putdata() to
create name/value ntpq (mode 6) response strings. For example,
ctl_putstr() is usually used to send string data (variable names
or string data). The formatting code was missing a length check
for variable names. If somebody explicitly created any unusually
long variable names in ntpd (longer than 200-512 bytes, depending
on the type of variable), then if any of these variables are
added to the response list it would overflow a buffer.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
If you don't want to upgrade, then don't setvar variable names
longer than 200-512 bytes in your ntp.conf file.
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-003 NTP: Improper use of snprintf() in mx4200_send() (Low)
Date Resolved: 21 Mar 2017
References: Sec 3378 / CVE-2017-6451 / VU#325339
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: LOW 0.8 (AV:L/AC:H/Au:M/C:N/I:N/A:P)
CVSS3: LOW 1.8 CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:L/A:N
Summary:
The legacy MX4200 refclock is only built if is specifically
enabled, and furthermore additional code changes are required to
compile and use it. But it uses the libc functions snprintf()
and vsnprintf() incorrectly, which can lead to an out-of-bounds
memory write due to an improper handling of the return value of
snprintf()/vsnprintf(). Since the return value is used as an
iterator and it can be larger than the buffer's size, it is
possible for the iterator to point somewhere outside of the
allocated buffer space. This results in an out-of-bound memory
write. This behavior can be leveraged to overwrite a saved
instruction pointer on the stack and gain control over the
execution flow. During testing it was not possible to identify
any malicious usage for this vulnerability. Specifically, no
way for an attacker to exploit this vulnerability was ultimately
unveiled. However, it has the potential to be exploited, so the
code should be fixed.
Mitigation, if you have a Magnavox MX4200 refclock:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page.
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Cure53.
* NTP-01-002 NTP: Buffer Overflow in ntpq when fetching reslist from a
malicious ntpd (Medium)
Date Resolved: 21 Mar 2017
References: Sec 3377 / CVE-2017-6460 / VU#325339
Affects: All versions of ntpq, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: MED 4.9 (AV:N/AC:H/Au:S/C:N/I:N/A:C)
CVSS3: MED 4.2 CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
A stack buffer overflow in ntpq can be triggered by a malicious
ntpd server when ntpq requests the restriction list from the server.
This is due to a missing length check in the reslist() function.
It occurs whenever the function parses the server's response and
encounters a flagstr variable of an excessive length. The string
will be copied into a fixed-size buffer, leading to an overflow on
the function's stack-frame. Note well that this problem requires
a malicious server, and affects ntpq, not ntpd.
Mitigation:
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
If you can't upgrade your version of ntpq then if you want to know
the reslist of an instance of ntpd that you do not control,
know that if the target ntpd is malicious that it can send back
a response that intends to crash your ntpq process.
Credit:
This weakness was discovered by Cure53.
* NTP-01-001 NTP: Makefile does not enforce Security Flags (Informational)
Date Resolved: 21 Mar 2017
References: Sec 3376
Affects: All versions of NTP, up to but not including ntp-4.2.8p10, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: N/A
CVSS3: N/A
Summary:
The build process for NTP has not, by default, provided compile
or link flags to offer "hardened" security options. Package
maintainers have always been able to provide hardening security
flags for their builds. As of ntp-4.2.8p10, the NTP build
system has a way to provide OS-specific hardening flags. Please
note that this is still not a really great solution because it
is specific to NTP builds. It's inefficient to have every
package supply, track and maintain this information for every
target build. It would be much better if there was a common way
for OSes to provide this information in a way that arbitrary
packages could benefit from it.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was reported by Cure53.
* 0rigin DoS (Medium)
Date Resolved: 21 Mar 2017
References: Sec 3361 / CVE-2016-9042 / VU#325339
Affects: ntp-4.2.8p9 (21 Nov 2016), up to but not including ntp-4.2.8p10
CVSS2: MED 4.9 (AV:N/AC:H/Au:N/C:N/I:N/A:C) (worst case)
CVSS3: MED 4.4 CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H (worst case)
Summary:
An exploitable denial of service vulnerability exists in the
origin timestamp check functionality of ntpd 4.2.8p9. A specially
crafted unauthenticated network packet can be used to reset the
expected origin timestamp for target peers. Legitimate replies
from targeted peers will fail the origin timestamp check (TEST2)
causing the reply to be dropped and creating a denial of service
condition. This vulnerability can only be exploited if the
attacker can spoof all of the servers.
Mitigation:
Implement BCP-38.
Configure enough servers/peers that an attacker cannot target
all of your time sources.
Upgrade to 4.2.8p10, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart
ntpd (without -g) if it stops running.
Credit:
This weakness was discovered by Matthew Van Gundy of Cisco.
Other fixes:
* [Bug 3393] clang scan-build findings <[email protected]>
* [Bug 3363] Support for openssl-1.1.0 without compatibility modes
- rework of patch set from <[email protected]>. <[email protected]>
* [Bug 3356] Bugfix 3072 breaks multicastclient <[email protected]>
* [Bug 3216] libntp audio ioctl() args incorrectly cast to int
on 4.4BSD-Lite derived platforms <[email protected]>
- original patch by Majdi S. Abbas
* [Bug 3215] 'make distcheck' fails with new BK repo format <[email protected]>
* [Bug 3173] forking async worker: interrupted pipe I/O <[email protected]>
- initial patch by Christos Zoulas
* [Bug 3139] (...) time_pps_create: Exec format error <[email protected]>
- move loader API from 'inline' to proper source
- augment pathless dlls with absolute path to NTPD
- use 'msyslog()' instead of 'printf() 'for reporting trouble
* [Bug 3107] Incorrect Logic for Peer Event Limiting <[email protected]>
- applied patch by Matthew Van Gundy
* [Bug 3065] Quiet warnings on NetBSD <[email protected]>
- applied some of the patches provided by Havard. Not all of them
still match the current code base, and I did not touch libopt.
* [Bug 3062] Change the process name of forked DNS worker <[email protected]>
- applied patch by Reinhard Max. See bugzilla for limitations.
* [Bug 2923] Trap Configuration Fail <[email protected]>
- fixed dependency inversion from [Bug 2837]
* [Bug 2896] Nothing happens if minsane < maxclock < minclock
- produce ERROR log message about dysfunctional daemon. <[email protected]>
* [Bug 2851] allow -4/-6 on restrict line with mask <[email protected]>
- applied patch by Miroslav Lichvar for ntp4.2.6 compat
* [Bug 2645] out-of-bound pointers in ctl_putsys and decode_bitflags
- Fixed these and some more locations of this pattern.
Probably din't get them all, though. <[email protected]>
* Update copyright year.
--
(4.2.8p9-win) 2017/02/01 Released by Harlan Stenn <[email protected]>
* [Bug 3144] NTP does not build without openSSL. <[email protected]>
- added missed changeset for automatic openssl lib detection
- fixed some minor warning issues
* [Bug 3095] More compatibility with openssl 1.1. <[email protected]>
* configure.ac cleanup. [email protected]
* openssl configure cleanup. [email protected]
--
NTP 4.2.8p9 (Harlan Stenn <[email protected]>, 2016/11/21)
Focus: Security, Bug fixes, enhancements.
Severity: HIGH
In addition to bug fixes and enhancements, this release fixes the
following 1 high- (Windows only), 2 medium-, 2 medium-/low, and
5 low-severity vulnerabilities, and provides 28 other non-security
fixes and improvements:
* Trap crash
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3119 / CVE-2016-9311 / VU#633847
Affects: ntp-4.0.90 (21 July 1999), possibly earlier, up to but not
including 4.2.8p9, and ntp-4.3.0 up to but not including ntp-4.3.94.
CVSS2: MED 4.9 (AV:N/AC:H/Au:N/C:N/I:N/A:C)
CVSS3: MED 4.4 CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H
Summary:
ntpd does not enable trap service by default. If trap service
has been explicitly enabled, an attacker can send a specially
crafted packet to cause a null pointer dereference that will
crash ntpd, resulting in a denial of service.
Mitigation:
Implement BCP-38.
Use "restrict default noquery ..." in your ntp.conf file. Only
allow mode 6 queries from trusted networks and hosts.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Matthew Van Gundy of Cisco.
* Mode 6 information disclosure and DDoS vector
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3118 / CVE-2016-9310 / VU#633847
Affects: ntp-4.0.90 (21 July 1999), possibly earlier, up to but not
including 4.2.8p9, and ntp-4.3.0 up to but not including ntp-4.3.94.
CVSS2: MED 6.4 (AV:A/AC:L/Au:N/C:N/I:N/A:P)
CVSS3: MED 6.5 CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Summary:
An exploitable configuration modification vulnerability exists
in the control mode (mode 6) functionality of ntpd. If, against
long-standing BCP recommendations, "restrict default noquery ..."
is not specified, a specially crafted control mode packet can set
ntpd traps, providing information disclosure and DDoS
amplification, and unset ntpd traps, disabling legitimate
monitoring. A remote, unauthenticated, network attacker can
trigger this vulnerability.
Mitigation:
Implement BCP-38.
Use "restrict default noquery ..." in your ntp.conf file.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Matthew Van Gundy of Cisco.
* Broadcast Mode Replay Prevention DoS
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3114 / CVE-2016-7427 / VU#633847
Affects: ntp-4.2.8p6, up to but not including ntp-4.2.8p9, and
ntp-4.3.90 up to, but not including ntp-4.3.94.
CVSS2: LOW 3.3 (AV:A/AC:L/Au:N/C:N/I:N/A:P)
CVSS3: MED 4.3 CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Summary:
The broadcast mode of NTP is expected to only be used in a
trusted network. If the broadcast network is accessible to an
attacker, a potentially exploitable denial of service
vulnerability in ntpd's broadcast mode replay prevention
functionality can be abused. An attacker with access to the NTP
broadcast domain can periodically inject specially crafted
broadcast mode NTP packets into the broadcast domain which,
while being logged by ntpd, can cause ntpd to reject broadcast
mode packets from legitimate NTP broadcast servers.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Matthew Van Gundy of Cisco.
* Broadcast Mode Poll Interval Enforcement DoS
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3113 / CVE-2016-7428 / VU#633847
Affects: ntp-4.2.8p6, up to but not including ntp-4.2.8p9, and
ntp-4.3.90 up to, but not including ntp-4.3.94
CVSS2: LOW 3.3 (AV:A/AC:L/Au:N/C:N/I:N/A:P)
CVSS3: MED 4.3 CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Summary:
The broadcast mode of NTP is expected to only be used in a
trusted network. If the broadcast network is accessible to an
attacker, a potentially exploitable denial of service
vulnerability in ntpd's broadcast mode poll interval enforcement
functionality can be abused. To limit abuse, ntpd restricts the
rate at which each broadcast association will process incoming
packets. ntpd will reject broadcast mode packets that arrive
before the poll interval specified in the preceding broadcast
packet expires. An attacker with access to the NTP broadcast
domain can send specially crafted broadcast mode NTP packets to
the broadcast domain which, while being logged by ntpd, will
cause ntpd to reject broadcast mode packets from legitimate NTP
broadcast servers.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Matthew Van Gundy of Cisco.
* Windows: ntpd DoS by oversized UDP packet
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3110 / CVE-2016-9312 / VU#633847
Affects Windows only: ntp-4.?.?, up to but not including ntp-4.2.8p9,
and ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: HIGH 7.8 (AV:N/AC:L/Au:N/C:N/I:N/A:C)
CVSS3: HIGH 7.5 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Summary:
If a vulnerable instance of ntpd on Windows receives a crafted
malicious packet that is "too big", ntpd will stop working.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Robert Pajak of ABB.
* 0rigin (zero origin) issues
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3102 / CVE-2016-7431 / VU#633847
Affects: ntp-4.2.8p8, and ntp-4.3.93.
CVSS2: MED 5.0 (AV:N/AC:L/Au:N/C:N/I:P/A:N)
CVSS3: MED 5.3 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Summary:
Zero Origin timestamp problems were fixed by Bug 2945 in
ntp-4.2.8p6. However, subsequent timestamp validation checks
introduced a regression in the handling of some Zero origin
timestamp checks.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Sharon Goldberg and Aanchal
Malhotra of Boston University.
* read_mru_list() does inadequate incoming packet checks
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3082 / CVE-2016-7434 / VU#633847
Affects: ntp-4.2.7p22, up to but not including ntp-4.2.8p9, and
ntp-4.3.0 up to, but not including ntp-4.3.94.
CVSS2: LOW 3.8 (AV:L/AC:H/Au:S/C:N/I:N/A:C)
CVSS3: LOW 3.8 CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H
Summary:
If ntpd is configured to allow mrulist query requests from a
server that sends a crafted malicious packet, ntpd will crash
on receipt of that crafted malicious mrulist query packet.
Mitigation:
Only allow mrulist query packets from trusted hosts.
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Magnus Stubman.
* Attack on interface selection
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3072 / CVE-2016-7429 / VU#633847
Affects: ntp-4.2.7p385, up to but not including ntp-4.2.8p9, and
ntp-4.3.0 up to, but not including ntp-4.3.94
CVSS2: LOW 1.0 (AV:L/AC:H/Au:S/C:N/I:N/A:P)
CVSS3: LOW 1.6 CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
Summary:
When ntpd receives a server response on a socket that corresponds
to a different interface than was used for the request, the peer
structure is updated to use the interface for new requests. If
ntpd is running on a host with multiple interfaces in separate
networks and the operating system doesn't check source address in
received packets (e.g. rp_filter on Linux is set to 0), an
attacker that knows the address of the source can send a packet
with spoofed source address which will cause ntpd to select wrong
interface for the source and prevent it from sending new requests
until the list of interfaces is refreshed, which happens on
routing changes or every 5 minutes by default. If the attack is
repeated often enough (once per second), ntpd will not be able to
synchronize with the source.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
If you are going to configure your OS to disable source address
checks, also configure your firewall configuration to control
what interfaces can receive packets from what networks.
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Miroslav Lichvar of Red Hat.
* Client rate limiting and server responses
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3071 / CVE-2016-7426 / VU#633847
Affects: ntp-4.2.5p203, up to but not including ntp-4.2.8p9, and
ntp-4.3.0 up to, but not including ntp-4.3.94
CVSS2: LOW 1.0 (AV:L/AC:H/Au:S/C:N/I:N/A:P)
CVSS3: LOW 1.6 CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L
Summary:
When ntpd is configured with rate limiting for all associations
(restrict default limited in ntp.conf), the limits are applied
also to responses received from its configured sources. An
attacker who knows the sources (e.g., from an IPv4 refid in
server response) and knows the system is (mis)configured in this
way can periodically send packets with spoofed source address to
keep the rate limiting activated and prevent ntpd from accepting
valid responses from its sources.
While this blanket rate limiting can be useful to prevent
brute-force attacks on the origin timestamp, it allows this DoS
attack. Similarly, it allows the attacker to prevent mobilization
of ephemeral associations.
Mitigation:
Implement BCP-38.
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered by Miroslav Lichvar of Red Hat.
* Fix for bug 2085 broke initial sync calculations
Date Resolved: 21 November 2016; Dev (4.3.94) 21 November 2016
References: Sec 3067 / CVE-2016-7433 / VU#633847
Affects: ntp-4.2.7p385, up to but not including ntp-4.2.8p9, and
ntp-4.3.0 up to, but not including ntp-4.3.94. But the
root-distance calculation in general is incorrect in all versions
of ntp-4 until this release.
CVSS2: LOW 1.2 (AV:L/AC:H/Au:N/C:N/I:N/A:P)
CVSS3: LOW 1.6 CVSS:3.0/AV:P/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L
Summary:
Bug 2085 described a condition where the root delay was included
twice, causing the jitter value to be higher than expected. Due
to a misinterpretation of a small-print variable in The Book, the
fix for this problem was incorrect, resulting in a root distance
that did not include the peer dispersion. The calculations and
formulae have been reviewed and reconciled, and the code has been
updated accordingly.
Mitigation:
Upgrade to 4.2.8p9, or later, from the NTP Project Download Page
or the NTP Public Services Project Download Page
Properly monitor your ntpd instances, and auto-restart ntpd
(without -g) if it stops running.
Credit: This weakness was discovered independently by Brian Utterback of
Oracle, and Sharon Goldberg and Aanchal Malhotra of Boston University.
Other fixes:
* [Bug 3142] bug in netmask prefix length detection <[email protected]>
* [Bug 3138] gpsdjson refclock should honor fudgetime1. [email protected]
* [Bug 3129] Unknown hosts can put resolver thread into a hard loop
- moved retry decision where it belongs. <[email protected]>
* [Bug 3125] NTPD doesn't fully start when ntp.conf entries are out of order
using the loopback-ppsapi-provider.dll <[email protected]>
* [Bug 3116] unit tests for NTP time stamp expansion. <[email protected]>
* [Bug 3100] ntpq can't retrieve daemon_version <[email protected]>
- fixed extended sysvar lookup (bug introduced with bug 3008 fix)
* [Bug 3095] Compatibility with openssl 1.1 <[email protected]>
- applied patches by Kurt Roeckx <[email protected]> to source
- added shim layer for SSL API calls with issues (both directions)
* [Bug 3089] Serial Parser does not work anymore for hopfser like device
- simplified / refactored hex-decoding in driver. <[email protected]>
* [Bug 3084] update-leap mis-parses the leapfile name. HStenn.
* [Bug 3068] Linker warnings when building on Solaris. [email protected]
- applied patch thanks to Andrew Stormont <[email protected]>
* [Bug 3067] Root distance calculation needs improvement. HStenn
* [Bug 3066] NMEA clock ignores pps. [email protected]
- PPS-HACK works again.
* [Bug 3059] Potential buffer overrun from oversized hash <[email protected]>
- applied patch by Brian Utterback <[email protected]>
* [Bug 3053] ntp_loopfilter.c frequency calc precedence error. Sarah White.
* [Bug 3050] Fix for bug #2960 causes [...] spurious error message.
<[email protected]>
- patches by Reinhard Max <[email protected]> and Havard Eidnes <[email protected]>
* [Bug 3047] Fix refclock_jjy C-DEX JST2000. [email protected]
- Patch provided by Kuramatsu.
* [Bug 3021] unity_fixture.c needs pragma weak <[email protected]>
- removed unnecessary & harmful decls of 'setUp()' & 'tearDown()'
* [Bug 3019] Windows: ERROR_HOST_UNREACHABLE block packet processing. DMayer
* [Bug 2998] sntp/tests/packetProcessing.c broken without openssl. JPerlinger
* [Bug 2961] sntp/tests/packetProcessing.c assumes AUTOKEY. HStenn.
* [Bug 2959] refclock_jupiter: gps week correction <[email protected]>
- fixed GPS week expansion to work based on build date. Special thanks
to Craig Leres for initial patch and testing.
* [Bug 2951] ntpd tests fail: multiple definition of `send_via_ntp_signd'
- fixed Makefile.am <[email protected]>
* [Bug 2689] ATOM driver processes last PPS pulse at startup,
even if it is very old <[email protected]>
- make sure PPS source is alive before processing samples
- improve stability close to the 500ms phase jump (phase gate)
* Fix typos in include/ntp.h.
* Shim X509_get_signature_nid() if needed
* git author attribution cleanup
* bk ignore file cleanup
* remove locks in Windows IO, use rpc-like thread synchronisation instead
---
NTP 4.2.8p8 (Harlan Stenn <[email protected]>, 2016/06/02)
+1
View File
@@ -1347,6 +1347,7 @@ m4_include([sntp/m4/ntp_debug.m4])
m4_include([sntp/m4/ntp_dir_sep.m4])
m4_include([sntp/m4/ntp_facilitynames.m4])
m4_include([sntp/m4/ntp_googletest.m4])
m4_include([sntp/m4/ntp_harden.m4])
m4_include([sntp/m4/ntp_ipv6.m4])
m4_include([sntp/m4/ntp_lib_m.m4])
m4_include([sntp/m4/ntp_libevent.m4])
+4 -1
View File
@@ -8,12 +8,15 @@ BUILT_SOURCES =
CLEANFILES =
EXTRA_PROGRAMS = adjtimed
AM_CFLAGS = $(CFLAGS_NTP)
AM_CFLAGS = $(CFLAGS_NTP)
AM_CFLAGS += $(NTP_HARD_CFLAGS)
AM_CPPFLAGS = $(NTP_INCS)
AM_CPPFLAGS += $(CPPFLAGS_NTP)
AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
AM_LDFLAGS = $(NTP_HARD_LDFLAGS)
include $(top_srcdir)/bincheck.mf
include $(top_srcdir)/sntp/check-libntp.mf
+8 -7
View File
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
$(top_srcdir)/sntp/m4/ntp_googletest.m4 \
$(top_srcdir)/sntp/m4/ntp_harden.m4 \
$(top_srcdir)/sntp/m4/ntp_ipv6.m4 \
$(top_srcdir)/sntp/m4/ntp_lib_m.m4 \
$(top_srcdir)/sntp/m4/ntp_libevent.m4 \
@@ -247,10 +248,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
@@ -303,6 +300,7 @@ LN_S = @LN_S@
LSCF = @LSCF@
LTHREAD_LIBS = @LTHREAD_LIBS@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
@@ -366,6 +364,9 @@ NTPTRACE_DL = @NTPTRACE_DL@
NTPTRACE_DS = @NTPTRACE_DS@
NTPTRACE_MS = @NTPTRACE_MS@
NTPTRACE_NI = @NTPTRACE_NI@
NTP_HARD_CFLAGS = @NTP_HARD_CFLAGS@
NTP_HARD_CPPFLAGS = @NTP_HARD_CPPFLAGS@
NTP_HARD_LDFLAGS = @NTP_HARD_LDFLAGS@
NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
@@ -439,7 +440,6 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -489,9 +489,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
BUILT_SOURCES = check-libntp .deps-ver
CLEANFILES = check-libntp .deps-ver
AM_CFLAGS = $(CFLAGS_NTP)
AM_CPPFLAGS = $(NTP_INCS) $(CPPFLAGS_NTP)
AM_CFLAGS = $(CFLAGS_NTP) $(NTP_HARD_CFLAGS)
AM_CPPFLAGS = $(NTP_INCS) $(CPPFLAGS_NTP) $(NTP_HARD_CPPFLAGS)
LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
AM_LDFLAGS = $(NTP_HARD_LDFLAGS)
NTP_INCS = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
-I$(top_srcdir)/lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \
-I$(top_srcdir)/lib/isc/unix/include
+3
View File
@@ -2,11 +2,14 @@ noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@
EXTRA_PROGRAMS = propdelay chutest
AM_CFLAGS = $(CFLAGS_NTP)
AM_CFLAGS += $(NTP_HARD_CFLAGS)
AM_CPPFLAGS = $(NTP_INCS)
AM_CPPFLAGS += $(CPPFLAGS_NTP)
AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
AM_LDFLAGS = $(NTP_HARD_LDFLAGS)
propdelay_LDADD = $(LDADD)
BUILT_SOURCES =
+8 -7
View File
@@ -109,6 +109,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
$(top_srcdir)/sntp/m4/ntp_googletest.m4 \
$(top_srcdir)/sntp/m4/ntp_harden.m4 \
$(top_srcdir)/sntp/m4/ntp_ipv6.m4 \
$(top_srcdir)/sntp/m4/ntp_lib_m.m4 \
$(top_srcdir)/sntp/m4/ntp_libevent.m4 \
@@ -242,10 +243,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
@@ -298,6 +295,7 @@ LN_S = @LN_S@
LSCF = @LSCF@
LTHREAD_LIBS = @LTHREAD_LIBS@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
@@ -361,6 +359,9 @@ NTPTRACE_DL = @NTPTRACE_DL@
NTPTRACE_DS = @NTPTRACE_DS@
NTPTRACE_MS = @NTPTRACE_MS@
NTPTRACE_NI = @NTPTRACE_NI@
NTP_HARD_CFLAGS = @NTP_HARD_CFLAGS@
NTP_HARD_CPPFLAGS = @NTP_HARD_CPPFLAGS@
NTP_HARD_LDFLAGS = @NTP_HARD_LDFLAGS@
NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
@@ -434,7 +435,6 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -483,9 +483,10 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@
AM_CFLAGS = $(CFLAGS_NTP)
AM_CPPFLAGS = $(NTP_INCS) $(CPPFLAGS_NTP)
AM_CFLAGS = $(CFLAGS_NTP) $(NTP_HARD_CFLAGS)
AM_CPPFLAGS = $(NTP_INCS) $(CPPFLAGS_NTP) $(NTP_HARD_CPPFLAGS)
LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
AM_LDFLAGS = $(NTP_HARD_LDFLAGS)
propdelay_LDADD = $(LDADD)
BUILT_SOURCES = check-libntp .deps-ver
CLEANFILES = check-libntp .deps-ver
-142
View File
@@ -1,142 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <[email protected]>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <[email protected]> or send patches to
# <[email protected]>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <[email protected]>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
-1517
View File
File diff suppressed because it is too large. Load diff
+1 -5
View File
@@ -1342,8 +1342,7 @@
/* Should we align with the NIST lockclock scheme? */
#undef LOCKCLOCK
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Does the target support multicast IP? */
@@ -1395,9 +1394,6 @@
/* Should we NOT read /dev/kmem? */
#undef NOKMEM
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Should we avoid #warning on option name collisions? */
#undef NO_OPTION_NAME_WARNINGS
-1756
View File
File diff suppressed because it is too large. Load diff
+1635 -6067
View File
File diff suppressed because it is too large. Load diff
+8 -5
View File
@@ -65,13 +65,16 @@ ntp_ripe_ncc_ok=${ntp_parse_ok=no}
ntp_jupiter_ok=${ntp_jupiter_ok=no}
NTP_PROG_CC
AC_PROG_CPP
# Do we need CXX for anything besides google test?
AC_PROG_CXX
NTP_COMPILER
dnl # Do we need CXX for anything besides google test?
dnl AC_PROG_CXX
AC_PROG_YACC
AC_PROG_CC_C_O
dnl AC_PROG_CC_C_O # called by NTP_COMPILER
AX_C99_STRUCT_INIT
NTP_HARDEN([sntp])
NTP_VPATH_HACK dnl used only by ntpd/Makefile.am
NTP_LOCINFO([sntp]) dnl takes over from NTP_BINDIR, in NTP_LIBNTP
@@ -169,7 +172,6 @@ case "$ans" in
;;
esac
PROG_NET_SNMP_CONFIG=$ans
AC_MSG_CHECKING([for net-snmp-config path])
case "$PROG_NET_SNMP_CONFIG" in
no) ;;
/*)
@@ -180,6 +182,7 @@ case "$PROG_NET_SNMP_CONFIG" in
AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
;;
esac
AC_MSG_CHECKING([for net-snmp-config path])
AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
case "$PATH_NET_SNMP_CONFIG" in
-530
View File
@@ -1,530 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <[email protected]>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <[email protected]>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
+5 -5
View File
@@ -10,12 +10,12 @@
<h3>Copyright Notice</h3>
<img src="pic/sheepb.jpg" alt="jpg" align="left"> "Clone me," says Dolly sheepishly.
<p>Last update:
<!-- #BeginDate format:En2m -->17-Jan-2015 00:16<!-- #EndDate -->
<!-- #BeginDate format:En2m -->2-Jan-2017 11:58<!-- #EndDate -->
UTC</p>
<br clear="left">
</p>
<hr>
<p>The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this entire notice applies as if the text was explicitly included in the file.</p>
<p>The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this entire notice applies as if the text was explicitly included in the file.</p>
<pre>
***********************************************************************
* *
@@ -39,7 +39,7 @@
<pre>
***********************************************************************
* *
* Copyright (c) Network Time Foundation 2011-2015 *
* Copyright (c) Network Time Foundation 2011-2017 *
* *
* All Rights Reserved *
* *
@@ -67,7 +67,7 @@
* DAMAGE. *
***********************************************************************
</pre>
<p>The following individuals contributed in part to the Network Time Protocol Distribution Version 4 and are acknowledged as authors of this work.</p>
<p>The following individuals contributed in part to the Network Time Protocol Distribution Version 4 and are acknowledged as authors of this work.</p>
<ol>
<li><a href="mailto:%[email protected]">Takao Abe &lt;[email protected]&gt;</a> Clock driver for JJY receivers</li>
<li><a href="mailto:%[email protected]">Mark Andrews &lt;[email protected]&gt;</a> Leitch atomic clock controller</li>
@@ -96,7 +96,7 @@
<li><a href="mailto:%[email protected]">Jeff Johnson &lt;[email protected]&gt;</a> massive prototyping overhaul</li>
<li><a href="mailto:%[email protected]">Hans Lambermont &lt;[email protected]&gt;</a> or <a href="mailto:[email protected]">&lt;[email protected]&gt;</a> ntpsweep</li>
<li><a href="mailto:%[email protected]">Poul-Henning Kamp &lt;[email protected]&gt;</a> Oncore driver (Original author)</li>
<li><a href="http://www4.informatik.uni-erlangen.de/%7ekardel">Frank Kardel</a> <a href="mailto:%20kardel%20%28at%29%20ntp%20%28dot%29%20org">&lt;kardel (at) ntp (dot) org&gt;</a> PARSE &lt;GENERIC&gt; (driver 14 reference clocks), STREAMS modules for PARSE, support scripts, syslog cleanup, dynamic interface handling</li>
<li><a href="http://www4.informatik.uni-erlangen.de/%7ekardel">Frank Kardel</a> <a href="mailto:%20kardel%20%28at%29%20ntp%20%28dot%29%20org">&lt;kardel (at) ntp (dot) org&gt;</a> PARSE &lt;GENERIC&gt; (driver 14 reference clocks), STREAMS modules for PARSE, support scripts, syslog cleanup, dynamic interface handling</li>
<li><a href="mailto:[email protected]">Johannes Maximilian Kuehn &lt;[email protected]&gt;</a> Rewrote <tt>sntp</tt> to comply with NTPv4 specification, <tt>ntpq saveconfig</tt></li>
<li><a href="mailto:%[email protected]">William L. Jones &lt;[email protected]&gt;</a> RS/6000 AIX modifications, HPUX modifications</li>
<li><a href="mailto:%[email protected]">Dave Katz &lt;[email protected]&gt;</a> RS/6000 AIX port</li>
+2 -2
View File
@@ -16,7 +16,7 @@
<body>
<h3>JJY Receivers</h3>
<p>Last update:
<!-- #BeginDate format:En2m -->15-May-2015 00:00<!-- #EndDate -->
<!-- #BeginDate format:En2m -->08-May-2016 00:00<!-- #EndDate -->
UTC &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="driver40.html">ENGLISH</a> &nbsp; <a href="driver40-ja.html">JAPANESE</a></p>
<hr>
<h4>Synopsis</h4>
@@ -136,7 +136,7 @@
<tr>
<td><code>{ENQ}1J{ETX}</code></td>
<td>&nbsp;--&gt;&nbsp;</td>
<td><code>{STX}JYYMMDD HHMMSSS{ETX}</code></td>
<td><code>{STX}JYYMMDDWHHMMSSS{ETX}</code></td>
</tr>
</table>
<br>
+4 -2
View File
@@ -11,7 +11,7 @@
<img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
<p>We have three, now looking for more.</p>
<p>Last update:
<!-- #BeginDate format:En2m -->17-May-2016 06:26<!-- #EndDate -->
<!-- #BeginDate format:En2m -->9-Nov-2016 12:26<!-- #EndDate -->
UTC</p>
<br clear="left">
<h4>Related Links</h4>
@@ -145,10 +145,12 @@
<dd>Specifies the stepout threshold in seconds. The default without this command is 300 s. Since this option also affects the training and startup intervals, it should not be set less than the default. Further details are on the <a href="clock.html">Clock State Machine</a> page.</dd>
</dl>
</dd>
<dt id="tos"><tt>tos [beacon <i>beacon</i> | ceiling <i>ceiling</i> | cohort {0 | 1} | floor <i>floor</i> | maxclock <i>maxclock </i>| maxdist <i>maxdist</i> | minclock <i>minclock</i> | mindist <i>mindist </i>| minsane <i>minsane</i> | orphan <i>stratum</i> | orphanwait <em>delay</em>]</tt></dt>
<dt id="tos"><tt>tos [bcpollbstep <i>poll-gate</i> | beacon <i>beacon</i> | ceiling <i>ceiling</i> | cohort {0 | 1} | floor <i>floor</i> | maxclock <i>maxclock </i>| maxdist <i>maxdist</i> | minclock <i>minclock</i> | mindist <i>mindist </i>| minsane <i>minsane</i> | orphan <i>stratum</i> | orphanwait <em>delay</em>]</tt></dt>
<dd>This command alters certain system variables used by the the clock selection and clustering algorithms. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. Very rarely is it necessary to change the default values; but, some folks can't resist twisting the knobs. It can be used to select the quality and quantity of peers used to synchronize the system clock and is most useful in dynamic server discovery schemes. The options are as follows:</dd>
<dd>
<dl>
<dt><tt>bcpollbstep <i>poll-gate</i></tt></dt>
<dd>This option will cause the client to delay believing backward time steps from a broadcast server for <tt>bcpollbstep</tt> poll intervals. NTP Broadcast networks are expected to be trusted, and if the server's time gets stepped backwards then it's desireable that the clients follow this change as soon as possible. However, in spite of various protections built-in to the broadcast protocol, it is possible that an attacker could perform a carefully-constructed replay attack and cause clients to erroneously step their clocks backward. If the risk of a successful broadcast replay attack is greater than the risk of the clients being out of sync in the event that there is a backward step on the broadcast time servers, this option may be used to cause the clients to delay beliveving backward time steps until <i>poll-gate</i> consecutive polls have been received. The default is 0, which means the client will accept these steps upon receipt. Any value from 0 to 4 can be specified.</dd>
<dt><tt>beacon <i>beacon</i></tt></dt>
<dd>The manycast server sends packets at intervals of 64 s if less than <tt>maxclock</tt> servers are available. Otherwise, it sends packets at the <i><tt>beacon</tt></i> interval in seconds. The default is 3600 s. See the <a href="discover.html">Automatic Server Discovery</a> page for further details.</dd>
<dt><tt>ceiling <i>ceiling</i></tt></dt>
+1
View File
@@ -16,6 +16,7 @@ noinst_HEADERS = \
intreswork.h \
iosignal.h \
l_stdlib.h \
libssl_compat.h \
lib_strbuf.h \
libntp.h \
mbg_gps166.h \
Loaded 100 of 1819 files, more files were not shown because too many files have changed in this diff. Show more