Commit Graph

201667 Commits

Author SHA1 Message Date
Renato Botelho
d32a66b2a2 When passwd or group information is changed (by pw, vipw, chpass, ...)
temporary file is created and then a rename() call move it to official file.
This operation didn't have any check to make sure data was written to disk
and if a power cycle happens system could end up with a 0 length passwd
or group database.

There is a pfSense bug with more infor about it:

https://redmine.pfsense.org/issues/4523

The following changes were made to protect passwd and group operations:

* lib/libutil/gr_util.c:
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.c
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file

* usr.sbin/pwd_mkdb/pwd_mkdb.c
 - Added O_SYNC flag on dbopen() calls
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.3
 - pw_lock() returns a file descriptor to master password file on success

Differential Revision:	https://reviews.freebsd.org/D2978
Approved by:	bapt
Sponsored by:	Netgate
2015-07-02 17:30:59 +00:00
Andrew Turner
d2676f552e Remove an unneeded define and old comment referencing amd64. 2015-07-02 16:13:29 +00:00
Andrew Turner
b9b3574474 Remove an old comment, the cache is enabled.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-02 15:26:40 +00:00
Konstantin Belousov
be930a2021 Account for the main process stack being one page below the highest
user address when ABI uses shared page.

Note that the change is no-op for correctness, since shared page does
not fault.  The mapping for the shared page is installed at the
address space creation, the page is unmanaged and its pte/pv entry
cannot be reclaimed.

Submitted by:	Oliver Pinter
Review:	https://reviews.freebsd.org/D2954
MFC after:	1 week
2015-07-02 15:22:13 +00:00
Andrew Turner
40fc1dffc3 Use pmap_load to load table entries. This simplifies finding places where
we access the tables.

Obtained from:	ABT Systems Ltd
Sponsored by:	The fReeBSD Foundation
2015-07-02 15:17:30 +00:00
Andrew Turner
b339ef955c Force the dynamic linker to resolve _end early so we pick up the correct
copy.

Sponsored by:	ABT Systems Ltd
2015-07-02 15:02:59 +00:00
Andrew Turner
74735cf188 Cleanup brk and sbrk to use the same code to find curbrk and minbrk when
both compiling for PIC and non-PIC.

Sponsored by:	ABT Systems Ltd
2015-07-02 14:54:21 +00:00
Ed Maste
4ed220cdd7 Update meta2deps example after i386-elf to i386 rename 2015-07-02 14:44:30 +00:00
Konstantin Belousov
6fdfd88220 Use single instance of the identical INKERNEL() and PMC_IN_KERNEL()
macros on amd64 and i386.  Move the definition to machine/param.h.
kgdb defines INKERNEL() too, the conflict is resolved by renaming kgdb
version to PINKERNEL().

On i386, correct the lowest kernel address.  After the shared page was
introduced, USRSTACK no longer points to the last user address + 1 [*]

Submitted by:	Oliver Pinter [*]
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-07-02 14:37:21 +00:00
Andrew Turner
a380ef6a02 Enable kernel debugging on arm64, other than GDB as it fails to build.
Sponsored by:	ABT Systems Ltd
2015-07-02 14:35:30 +00:00
Konstantin Belousov
1965f86c72 Vnode is not referenced by the vfs_domount() at the point where
asserts are made.  Remove them, since we might dereference freed
memory.  Leaked locks are asserted by the syscall return code anyway.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-07-02 14:31:47 +00:00
Andrew Turner
aeb8eeb590 Save & restore the floating-pont argument registers before calling
_rtld_bind. The compiler may generate code using these registers and not
save them. Unfortunately, as we make use of libc, we are unable to disallow
rtld from using floating-point register without also doing the same for the
parts of libc we use, or by limiting what _rtld_bind is able to call.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FReeBSD Foundation
2015-07-02 14:00:07 +00:00
Christian Brueffer
fa6e0e5334 Add -b to the devlist usage info, forgotten in r260059.
PR:		195094
Submitted by:	robin.hahling@gw-computing.net
MFC after:	1 week
2015-07-02 13:57:26 +00:00
Andrew Turner
5607ec2379 Set MACHINE_CPU to arm64 when building for arm64. This is needed by the
ports tree as they check this value in a number of ports.

PR:		201259
Sponsored by:	ABT Systems Ltd
2015-07-02 13:42:57 +00:00
Alexander Motin
b9b4269c1d Fix couple panics on forced unmount of backing file.
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2015-07-02 12:53:22 +00:00
Christian Brueffer
faf2d8305c Fix an obviously wrong boolean operator.
PR:		200983
Submitted by:	David Bindeman
MFC after:	1 week
2015-07-02 12:14:48 +00:00
Christian Brueffer
0a378964f7 Add the year to the VAX-11/780 announcement entry.
PR:		200961
Submitted by:	John Marshall
MFC after:	1 week
2015-07-02 12:08:05 +00:00
Christian Brueffer
42328e6516 Fix a typo.
PR:		199453
Submitted by:	John Nielsen
2015-07-02 11:46:35 +00:00
Pawel Jakub Dawidek
fefb6a143a Properly propagate errors in metadata reading.
PR:		198860
Submitted by:	Matthew D. Fuller
2015-07-02 10:57:34 +00:00
Pawel Jakub Dawidek
edaa9008ff Allow to omit keyfile number for the first keyfile. 2015-07-02 10:55:32 +00:00
Andriy Gapon
74f75cb1bd zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls
We now take z_teardown_lock as a writer to ensure that there is no I/O
while the filesystem state is in a flux.  Also, zfs_suspend_fs() ->
zfsvfs_teardown() call zfs_unregister_callbacks() and zfs_resume_fs() ->
zfsvfs_setup() call zfs_unregister_callbacks().  Previously there was no
synchronization between those calls and the calls in the re-mounting
case.  That could lead to concurrent execution and a crash.

PR:		180060
Differential Revision:	https://reviews.freebsd.org/D2865
Suggested by:	mahrens
Reviewed by:	delphij, pho, mahrens, will
MFC after:	13 days
Sponsored by:	ClusterHQ
2015-07-02 08:32:02 +00:00
Alexander Motin
556e4c9a83 Disable port multiplier support on Marvell 88SE61xx chips.
According to report, some recent unrelated changes in the driver triggered
timeouts when testing for absent port multiplier.  Cause of this behavior
channge is unclear, but since these chips are old, rare and buggy, it is
easier to just disable port multiplier support, same as done in Linux.

Reported by:	bar
MFC after:	3 days
2015-07-02 08:25:45 +00:00
Glen Barber
e8d7333d7d Fix the path to the UFS/MSDOSFS filesystem labels, since they
cannot possibly exist within the chroot(8) before the target
filesystem actually exists.

MFC after:	3 days
X-MFC-With:	r285018
Sponsored by:	The FreeBSD Foundation
2015-07-02 02:33:58 +00:00
Glen Barber
e07ca0423d Implement an evil workaround that prevents UFS/MSDOS labels from being
written to disk with newfs(8) and newfs_msdosfs(8).

When iterating through snapshot builds in serial, it is possible for
a build failure to leave stale md(4) devices behind, in some cases, they
could have a UFS or MSDOS filesystem label assigned.

If the md(4) is not destroyed (or not able to be destroyed, as has
happened recently due to my own fault), the filesystem label that
already exists can interfere with a new md(4) device that is targeted to
have the same label.

This behavior, although admittedly a logic error in the wrapper build
scripts, has caused intermittent reports (in particular with the armv6
builds) of missing UFS/MSDOSFS labels, causing the image to fallback to
the mountroot prompt.  This appears to only happen when the backing
md(4) device is destroyed before the calling umount(8) on the target
mount, after which the UFS/MSDOSFS label persists.

The workaround is this:  If EVERYTHINGISFINE is set to non-empty value,
check for an existing ufs/rootfs and msdosfs/MSDOSBOOT filesystem label
in arm_create_disk(), and rm(1) them if they exist.

The EVERYTHINGISFINE variable is chosen because it is used in exactly
one other place - release/Makefile.mirrors - and there are big scary
warnings at the top of that file as well that it should *not* be used
under normal circumstances.  This should not destroy a build machine
that also uses '/dev/ufs/rootfs' as the UFS label, and I have verified
in extensive local testing that the destroyed label is recreated when
the md(4) is unmounted/mounted, but this really should not be enabled
by anyone.

Having said all that, I absolutely *do* plan MFC this to stable/10 for
the 10.2-RELEASE cycle, as so far, I have only observed this behavior
on stable/10, but this is a temporary solution until I can unravel all
of the failure paths to properly trap them.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-07-02 02:13:20 +00:00
Luiz Otavio O Souza
5ee00411e4 Add DMA support for Allwinner MMC controller.
DMA handles all data transfers up to 128K or 16 segments and fallback to
pio mode when DMA requirements are not met.

The read performance has improved greatly while the write performance also
showed some improvement but seems limited by the card type and quality.

Submitted by:	Pratik Singhal <pratiksinghal@freebsd.org>
Sponsored by:	Google Summer of Code 2015
Tested on:	A10 (cubieboard) and A20 (cubieboard 2 and banana pi)
2015-07-01 23:27:01 +00:00
Andrew Turner
c950fb6b67 Fix the logic for when to restore the VFP registers. It should restore
them when a different thread last used them, or when the thread was last
run on a different cpu.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-01 17:27:44 +00:00
Christian Brueffer
35189d4784 Bump .Dd for the example code update.
Submitted by:	loos
2015-07-01 16:50:01 +00:00
Konstantin Belousov
3ce8c94f29 Disallow a debugger on 64bit system to set fs/gs bases of the 32bit
process beyond the end of the process address space.  Such setting is
not dangerous to the kernel integrity, but it causes confusing
application misbehaviour.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
2015-07-01 16:37:03 +00:00
Christian Brueffer
02e9fc7858 Add one more file missed in the BIND-removal entries.
PR:		196515
Submitted by:	Trond Endrestol
MFC after:	1 week
2015-07-01 15:54:13 +00:00
Ruslan Bukin
b78ee15e9f First cut of DTrace for AArch64.
Reviewed by:	andrew, emaste
Sponsored by:	ARM Limited
Differential Revision:	https://reviews.freebsd.org/D2738
2015-07-01 15:51:11 +00:00
Christian Brueffer
8b47cda2f7 Use the correct le*dec function to decode a 16bit type.
PR:		194228
Submitted by:	David Horwitt
MFC after:	2 weeks
2015-07-01 14:54:13 +00:00
Glen Barber
57d94a19cb Remove the HH-MM suffix from the build date suffix.
It was useful when working out several kinks when
testing automated image uploading when retrying was
necessary, but now it is making things much too messy.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-07-01 14:51:26 +00:00
Ruslan Bukin
0ff41755cd Add a central location for exclusion checks. We check
here if function is excluded from FBT instrumentation.

Reviewed by:	andrew, emaste, markj
Differential Revision:	https://reviews.freebsd.org/D2899
2015-07-01 14:09:59 +00:00
Ruslan Bukin
27e54fb59e Make libproc compilable on AArch64. 2015-07-01 13:59:26 +00:00
Glen Barber
2206ec827c Refine the lockstat(1) entry based on corrections and
clarifications received during review.

Submitted by:	avg
Sponsored by:	The FreeBSD Foundation
2015-07-01 10:33:19 +00:00
Christian Brueffer
b28dfe6570 Make the example code actually work.
PR:		199440
Submitted by:	waitman@waitman.net
Reviewed by:	loos
MFC after:	1 week
2015-07-01 09:25:23 +00:00
Glen Barber
4079836c5e Fix the gcloud port/package name.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-07-01 08:48:49 +00:00
Navdeep Parhar
fd215e45eb cxgbe(4): request an automatic tx update when a netmap tx queue idles.
The NIC tx queues already do this.

MFC after:	1 week
Differential Revision:
2015-07-01 00:34:14 +00:00
Navdeep Parhar
d50357c6f7 cxgbetool: fix code that decodes T5 SGE contexts. Some of the fields
that changed between T4 and T5 were not displayed correctly.

Obtained from:	Chelsio
MFC after:	3 days
Differential Revision:
2015-06-30 22:30:21 +00:00
Li-Wen Hsu
4889014996 - Fix make depend in sys/modules
Differential Revision:	https://reviews.freebsd.org/D2951
Approved by:	delphij
2015-06-30 19:35:14 +00:00
Glen Barber
811fc8fd4b Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if
not set, which expands to '11.0-CURRENT', for example.

If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix
the VAGRANT_VERSION with the snapshot date.

MFC after:	3 days
X-MFC-Needs:	r284893, r284895, r284896, r284897, r284942
Tested with:	head@r284961 (patched)
Sponsored by:	The FreeBSD Foundation
2015-06-30 19:18:08 +00:00
John-Mark Gurney
0812640475 add units to the length and count so that it's clear what they
are measured in...  Gems like: "len is the length of the buffer."
aren't useful in man pages.
2015-06-30 19:06:14 +00:00
Konstantin Belousov
23e1c1251c Document x86 machine-specific ptrace(2) requests. Provide list of the
ppc requests.

Reviewed by:	brueffer, emaste, gjb (previous version)
Sponsored by:	The FreeBSD Foundation
Review:	https://reviews.freebsd.org/D2962
MFC after:	2 weeks
2015-06-30 18:53:42 +00:00
Hiren Panchasara
5341316696 Add missing DTrace scripts that exist in the source tree to the Makefile for
install.
While here, sort the list.

Differential Revision:	D2950
Submitted by:		Jason Wolfe <j at nitrology.com>
Reviewed by:		gnn, markj, hiren
Sponsored by:		Limelight Networks
2015-06-30 18:23:08 +00:00
Navdeep Parhar
9523d1bfc3 Fix leak in tcp_lro_rx. Simply clearing M_PKTHDR isn't enough, any tags
hanging off the header need to be freed too.

Differential Revision:	https://reviews.freebsd.org/D2708
Reviewed by:	ae@, hiren@
2015-06-30 17:19:58 +00:00
Mark Murray
c4f9c760c9 Updated random(4) boot/shutdown scripting.
Fix the man pages as well.

Differential Revision: https://reviews.freebsd.org/D2924
Approved by: so (delphij)
2015-06-30 17:09:41 +00:00
Mark Murray
d1b06863fb Huge cleanup of random(4) code.
* GENERAL
- Update copyright.
- Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set
  neither to ON, which means we want Fortuna
- If there is no 'device random' in the kernel, there will be NO
  random(4) device in the kernel, and the KERN_ARND sysctl will
  return nothing. With RANDOM_DUMMY there will be a random(4) that
  always blocks.
- Repair kern.arandom (KERN_ARND sysctl). The old version went
  through arc4random(9) and was a bit weird.
- Adjust arc4random stirring a bit - the existing code looks a little
  suspect.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Redo read_random(9) so as to duplicate random(4)'s read internals.
  This makes it a first-class citizen rather than a hack.
- Move stuff out of locked regions when it does not need to be
  there.
- Trim RANDOM_DEBUG printfs. Some are excess to requirement, some
  behind boot verbose.
- Use SYSINIT to sequence the startup.
- Fix init/deinit sysctl stuff.
- Make relevant sysctls also tunables.
- Add different harvesting "styles" to allow for different requirements
  (direct, queue, fast).
- Add harvesting of FFS atime events. This needs to be checked for
  weighing down the FS code.
- Add harvesting of slab allocator events. This needs to be checked for
  weighing down the allocator code.
- Fix the random(9) manpage.
- Loadable modules are not present for now. These will be re-engineered
  when the dust settles.
- Use macros for locks.
- Fix comments.

* src/share/man/...
- Update the man pages.

* src/etc/...
- The startup/shutdown work is done in D2924.

* src/UPDATING
- Add UPDATING announcement.

* src/sys/dev/random/build.sh
- Add copyright.
- Add libz for unit tests.

* src/sys/dev/random/dummy.c
- Remove; no longer needed. Functionality incorporated into randomdev.*.

* live_entropy_sources.c live_entropy_sources.h
- Remove; content moved.
- move content to randomdev.[ch] and optimise.

* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h
- Remove; plugability is no longer used. Compile-time algorithm
  selection is the way to go.

* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h
- Add early (re)boot-time randomness caching.

* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h
- Remove; no longer needed.

* src/sys/dev/random/uint128.h
- Provide a fake uint128_t; if a real one ever arrived, we can use
  that instead. All that is needed here is N=0, N++, N==0, and some
  localised trickery is used to manufacture a 128-bit 0ULLL.

* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h
- Improve unit tests; previously the testing human needed clairvoyance;
  now the test will do a basic check of compressibility. Clairvoyant
  talent is still a good idea.
- This is still a long way off a proper unit test.

* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h
- Improve messy union to just uint128_t.
- Remove unneeded 'static struct fortuna_start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])

* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h
- Improve messy union to just uint128_t.
- Remove unneeded 'staic struct start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
- Fix some magic numbers elsewhere used as FAST and SLOW.

Differential Revision: https://reviews.freebsd.org/D2025
Reviewed by: vsevolod,delphij,rwatson,trasz,jmg
Approved by: so (delphij)
2015-06-30 17:00:45 +00:00
Konstantin Belousov
6ef120027f Do not calculate the stack's bottom address twice.
Submitted by:	Olivц╘r Pintц╘r
Review:	https://reviews.freebsd.org/D2953
MFC after:	1 week
2015-06-30 15:22:47 +00:00
Maxim Konovalov
2a52334e0b o DragonFly 4.2.0 added. 2015-06-30 07:46:06 +00:00
Justin Hibbits
7634b963ec The LDFLAGS isn't needed, and breaks the build on powerpc64.
This hack is very fragile, and was broken on powerpc64 when metamode was
introduced.  Removing it survives a buildworld for all architectures, and
fixes the build on powerpc64.
2015-06-30 06:02:42 +00:00