]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoRename the module for 'device enc' to "if_enc" to avoid conflicting with
jhb [Tue, 2 Oct 2012 12:25:30 +0000 (12:25 +0000)]
Rename the module for 'device enc' to "if_enc" to avoid conflicting with
the CAM "enc" peripheral (part of ses(4)).  Previously the two modules
used the same name, so only one was included in a linked kernel causing
enc0 to not be created if you added IPSEC to GENERIC.  The new module
name follows the pattern of other network interfaces (e.g. "if_loop").

MFC after: 1 week

11 years ago There is a complex race in in_pcblookup_hash() and in_pcblookup_group().
glebius [Tue, 2 Oct 2012 12:03:02 +0000 (12:03 +0000)]
 There is a complex race in in_pcblookup_hash() and in_pcblookup_group().
Both functions need to obtain lock on the found PCB, and they can't do
classic inter-lock with the PCB hash lock, due to lock order reversal.
To keep the PCB stable, these functions put a reference on it and after PCB
lock is acquired drop it. If the reference was the last one, this means
we've raced with in_pcbfree() and the PCB is no longer valid.

  This approach works okay only if we are acquiring writer-lock on the PCB.
In case of reader-lock, the following scenario can happen:

  - 2 threads locate pcb, and do in_pcbref() on it.
  - These 2 threads drop the inp hash lock.
  - Another thread comes to delete pcb via in_pcbfree(), it obtains hash lock,
    does in_pcbremlists(), drops hash lock, and runs in_pcbrele_wlocked(), which
    doesn't free the pcb due to two references on it. Then it unlocks the pcb.
  - 2 aforementioned threads acquire reader lock on the pcb and run
    in_pcbrele_rlocked(). One gets 1 from in_pcbrele_rlocked() and continues,
    second gets 0 and considers pcb freed, returns.
  - The thread that got 1 continutes working with detached pcb, which later
    leads to panic in the underlying protocol level.

  To plumb that problem an additional INPCB flag introduced - INP_FREED. We
check for that flag in the in_pcbrele_rlocked() and if it is set, we pretend
that that was the last reference.

Discussed with: rwatson, jhb
Reported by: Vladimir Medvedkin <medved rambler-co.ru>

11 years agoStyle.
hselasky [Tue, 2 Oct 2012 10:09:23 +0000 (10:09 +0000)]
Style.

MFC after: 1 week

11 years agoRemove unused field.
hselasky [Tue, 2 Oct 2012 10:05:39 +0000 (10:05 +0000)]
Remove unused field.

MFC after: 1 week

11 years agomdoc: point to an existing cross reference.
pluknet [Tue, 2 Oct 2012 09:53:50 +0000 (09:53 +0000)]
mdoc: point to an existing cross reference.

11 years agoFix build with LOG_FILE undefined and DEBUGGING disabled.
pluknet [Tue, 2 Oct 2012 09:23:16 +0000 (09:23 +0000)]
Fix build with LOG_FILE undefined and DEBUGGING disabled.

11 years agoFix build with DEBUGGING disabled.
pluknet [Tue, 2 Oct 2012 09:19:28 +0000 (09:19 +0000)]
Fix build with DEBUGGING disabled.

11 years agoIntroduce a new TLB invalidation function for efficiently invalidating
alc [Tue, 2 Oct 2012 07:14:22 +0000 (07:14 +0000)]
Introduce a new TLB invalidation function for efficiently invalidating
address ranges, and use this function in pmap_remove().

Tested by: jchandra

11 years agoProvide a generic way to disable devices at boot time
eadler [Tue, 2 Oct 2012 03:33:41 +0000 (03:33 +0000)]
Provide a generic way to disable devices at boot time

PR: kern/119202
Requested by: peterj
Reviewed by: sbruno, jhb
Approved by: cperciva
MFC after: 1 week

11 years agoImplement the Sun/GNU extension of using a default
eadler [Tue, 2 Oct 2012 00:30:26 +0000 (00:30 +0000)]
Implement the Sun/GNU extension of using a default
prefix when no arguments are supplied.

Reviewed by: jilles
Approved by: cperciva
MFC after: 1 week

11 years agoadd SG state type
eadler [Tue, 2 Oct 2012 00:30:20 +0000 (00:30 +0000)]
add SG state type

PR: bin/171664
Submitted by: Jan Beich jbeich@tormail.org
Approved by: cperciva
MFC after: 1 week

11 years agoCorrect the tip about finding all the directories on the system
eadler [Tue, 2 Oct 2012 00:30:15 +0000 (00:30 +0000)]
Correct the tip about finding all the directories on the system
Add a tip about clearing the screen.
Make things more consistent by removing quotes around 'make search'

Approved by: cperciva
MFC after: 3 days

11 years agoIndicate (loudly) that ports csup is going away.
eadler [Mon, 1 Oct 2012 22:27:34 +0000 (22:27 +0000)]
Indicate (loudly) that ports csup is going away.

While here clarify some other portions.

Approved by: cperciva (implicit)
MFC after: 3 days

11 years agoAdd the mps(4) driver to the i386 GENERIC config file. LSI has tested it
ken [Mon, 1 Oct 2012 21:42:32 +0000 (21:42 +0000)]
Add the mps(4) driver to the i386 GENERIC config file.  LSI has tested it
on i386 and verified that it works.

Submitted by: Harald Schmalzbauer, John Baldwin, Kashyap Desai
MFC after: 3 days

11 years agoDo not treat empty name as an uid 0
bapt [Mon, 1 Oct 2012 17:00:33 +0000 (17:00 +0000)]
Do not treat empty name as an uid 0

Reported by: Robert Bonomi <bonomi@mail.r-bonomi.com>

11 years agoRemove useless atoi(3), previous strspn(3) makes sure that a_name->val is a
bapt [Mon, 1 Oct 2012 16:42:07 +0000 (16:42 +0000)]
Remove useless atoi(3), previous strspn(3) makes sure that a_name->val is a
number.
This also allow pw user show to work as expected.

PR: bin/172112
Submitted by: "Ilya A. Arkhipov" <rum1cro@yandex.ru>
MFC after: 1 month

11 years agoSupport kernel options from ubldr.
kientzle [Mon, 1 Oct 2012 14:56:48 +0000 (14:56 +0000)]
Support kernel options from ubldr.

11 years agoAttila Bogar and Herbert Poeckl both reported similar problems
rmacklem [Mon, 1 Oct 2012 12:28:58 +0000 (12:28 +0000)]
Attila Bogar and Herbert Poeckl both reported similar problems
w.r.t. a Linux NFS client doing a krb5 NFS mount against the
FreeBSD server. We determined this was a Linux bug:
http://www.spinics.net/lists/linux-nfs/msg32466.html, however
the mount failed to work, because the Destroy operation with a
bogus encrypted checksum destroyed the authenticator handle.
This patch changes the rpcsec_gss code so that it doesn't
Destroy the authenticator handle for this case and, as such,
the Linux mount will work.

Tested by: Attila Bogar and Herbert Poeckl
MFC after: 2 weeks

11 years ago- Rename .sgml files to .xml to track the recent doc changes
gabor [Mon, 1 Oct 2012 11:26:49 +0000 (11:26 +0000)]
- Rename .sgml files to .xml to track the recent doc changes

MFC after: 1 day

11 years agoAdd the UPDATING note about padlock rng support requiring the config change.
kib [Mon, 1 Oct 2012 10:46:35 +0000 (10:46 +0000)]
Add the UPDATING note about padlock rng support requiring the config change.

Requested by: Dewayne Geraghty <dewayne.geraghty@heuristicsystems.com.au>
MFC after: 3 days

11 years agoRegenerate usb.conf
hselasky [Mon, 1 Oct 2012 06:48:59 +0000 (06:48 +0000)]
Regenerate usb.conf

MFC after: 1 week

11 years ago- Enforce CAP_MKFIFO on mkfifoat(2), not on mknodat(2). Without this change
pjd [Mon, 1 Oct 2012 05:43:24 +0000 (05:43 +0000)]
- Enforce CAP_MKFIFO on mkfifoat(2), not on mknodat(2). Without this change
  mkfifoat(2) was not restricted.
- Introduce CAP_MKNOD and enforce it on mknodat(2).

Sponsored by: FreeBSD Foundation
MFC after: 2 weeks

11 years agoInherit USB mode from RootHUB port where the USB device is connected.
hselasky [Mon, 1 Oct 2012 05:42:43 +0000 (05:42 +0000)]
Inherit USB mode from RootHUB port where the USB device is connected.
Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs.
This simplifies some checks in the USB controller drivers.

MFC after: 1 week

11 years agoRemove unused variables from the OMAP ehci code.
andrew [Mon, 1 Oct 2012 05:15:13 +0000 (05:15 +0000)]
Remove unused variables from the OMAP ehci code.

11 years agoFix the clobber list on the atomic operators that do comparisons. Without
andrew [Mon, 1 Oct 2012 05:12:17 +0000 (05:12 +0000)]
Fix the clobber list on the atomic operators that do comparisons. Without
this some compilers will place a cmp instruction before the atomic operation
and expect to be able to use the result afterwards. By adding "cc" to the
list of used registers we tell the compiler to not do this.

11 years agoThe USB Bluetooth driver should only grab its own interfaces. This allows the
hselasky [Sun, 30 Sep 2012 19:31:20 +0000 (19:31 +0000)]
The USB Bluetooth driver should only grab its own interfaces. This allows the
USB bluetooth driver to co-exist with other USB device classes and drivers.

Reported by: Geoffrey Levand
MFC after: 1 week

11 years ago- Simplify the implementation of atomic_compare_exchange_strong_explicit.
tijl [Sun, 30 Sep 2012 17:33:30 +0000 (17:33 +0000)]
- Simplify the implementation of atomic_compare_exchange_strong_explicit.
- Evaluate the memory order argument in atomic_fetch_*_explicit macros.
- Implement atomic_store_explicit using atomic_exchange_explicit instead
  of a plain assignment.

Reviewed by: theraven
MFC after: 2 weeks

11 years agoAdd missing header needed by free(9).
kevlo [Sun, 30 Sep 2012 15:42:20 +0000 (15:42 +0000)]
Add missing header needed by free(9).
Spotted by: David Wolfskill <david at catwhisker dot org>

11 years agoFix the style.
ae [Sun, 30 Sep 2012 13:17:33 +0000 (13:17 +0000)]
Fix the style.

11 years agoRemember the file format of the last loaded module and try to use it for
ae [Sun, 30 Sep 2012 13:14:37 +0000 (13:14 +0000)]
Remember the file format of the last loaded module and try to use it for
next files.

11 years agoReduce the number of attempts to detect proper kld format for the amd64
ae [Sun, 30 Sep 2012 12:24:15 +0000 (12:24 +0000)]
Reduce the number of attempts to detect proper kld format for the amd64
loader.

11 years agoRemove an unneeded NULL check after M_WAITOK.
kevlo [Sun, 30 Sep 2012 09:26:26 +0000 (09:26 +0000)]
Remove an unneeded NULL check after M_WAITOK.

11 years agoFree result of device_get_children(9).
kevlo [Sun, 30 Sep 2012 09:21:10 +0000 (09:21 +0000)]
Free result of device_get_children(9).

11 years agoFix disk_cleanup() to work without DISK_DEBUG too.
ae [Sun, 30 Sep 2012 07:52:40 +0000 (07:52 +0000)]
Fix disk_cleanup() to work without DISK_DEBUG too.

11 years agomdoc: remove superfluous paragraph macro.
joel [Sun, 30 Sep 2012 07:51:57 +0000 (07:51 +0000)]
mdoc: remove superfluous paragraph macro.

11 years agoStop calling pmap_remove_write() from pmap_remove_all(). Doing so is not
alc [Sun, 30 Sep 2012 03:54:57 +0000 (03:54 +0000)]
Stop calling pmap_remove_write() from pmap_remove_all().  Doing so is not
only inefficient but also leads to recursive lock acquisition.

Tested by: ray

11 years agoclarify the wording for 'first' and 'last'
eadler [Sun, 30 Sep 2012 03:25:04 +0000 (03:25 +0000)]
clarify the wording for 'first' and 'last'

Approved by: wblock
MFC after: 3 days

11 years agoDocument the security.bsd.unprivileged_idprio in idprio(1) in addition
eadler [Sun, 30 Sep 2012 03:21:21 +0000 (03:21 +0000)]
Document the security.bsd.unprivileged_idprio in idprio(1) in addition
to rtprio(2).

Approved by: wblock
MFC after: 3 days

11 years agoEliminate an unused declaration.
alc [Sat, 29 Sep 2012 22:28:00 +0000 (22:28 +0000)]
Eliminate an unused declaration.

11 years agoClear and re-setup all function pointers that glue pf(4) and pfsync(4)
glebius [Sat, 29 Sep 2012 20:11:00 +0000 (20:11 +0000)]
Clear and re-setup all function pointers that glue pf(4) and pfsync(4)
together whenever the pfsync0 is brought down or up respectively.

11 years agoSimplify send out queue code:
glebius [Sat, 29 Sep 2012 20:02:26 +0000 (20:02 +0000)]
Simplify send out queue code:
- Write method of a queue now is void,length of item is taken
  as queue property.
- Write methods don't need to know about mbud, supply just buf
  to them.
- No need for safe queue iterator in pfsync_sendout().

Obtained from: OpenBSD

11 years agoEliminate unused variables.
alc [Sat, 29 Sep 2012 19:09:11 +0000 (19:09 +0000)]
Eliminate unused variables.

11 years agoAdd support for mincore(). Specifically, this is an adaptation of the
alc [Sat, 29 Sep 2012 17:20:16 +0000 (17:20 +0000)]
Add support for mincore().  Specifically, this is an adaptation of the
pmap_mincore() implementation that was added to the original arm pmap
in r235717.

11 years agoAlmost each time when loader opens a file, this leads to calling
ae [Sat, 29 Sep 2012 16:47:56 +0000 (16:47 +0000)]
Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file.
This leads to reading partition table metadata for each call. To
reduce the number of disk I/O we have a simple block cache, but it
is very dumb and more than half of I/O operations related to reading
metadata, misses this cache.

Introduce new cache layer to resolve this problem. It is independent
and doesn't need initialization like bcache, and will work by default
for all loaders which use the new DISK API. A successful disk_open()
call to each new disk or partition produces new entry in the cache.
Even more, when disk was already open, now opening of any nested
partitions does not require reading top level partition table.
So, if without this cache, partition table metadata was read around
20-50 times during boot, now it reads only once. This affects the booting
from GPT and MBR from the UFS.

11 years ago- Get rid of #ifdef __FreeBSD__.
glebius [Sat, 29 Sep 2012 16:42:01 +0000 (16:42 +0000)]
- Get rid of #ifdef __FreeBSD__.
- Use correct format when printing uint64_t.

11 years ago* src/math_private.h:
kargl [Sat, 29 Sep 2012 16:40:12 +0000 (16:40 +0000)]
* src/math_private.h:
  . Change the API for the LD80C by removing the explicit passing
    of the sign bit.  The sign can be determined from the last
    parameter of the macro.
  . On i386, load long double by bit manipulations to work around
    at least a gcc compiler issue.  On non-i386 ld80 architectures,
    use a simple assignment.

* ld80/s_expl.c:
  . Update the only consumer of LD80C.

Submitted by: bde
Approved by: das (mentor)

11 years agoIf devclass_get_devices(9) returns success but a count of 0,
kevlo [Sat, 29 Sep 2012 16:27:13 +0000 (16:27 +0000)]
If devclass_get_devices(9) returns success but a count of 0,
free the pointer.

11 years agoAdd missing va_end.
kevlo [Sat, 29 Sep 2012 16:19:01 +0000 (16:19 +0000)]
Add missing va_end.

11 years agoRemove unused variables.
kevlo [Sat, 29 Sep 2012 16:15:27 +0000 (16:15 +0000)]
Remove unused variables.

11 years agoDisable splitfs support, since we aren't support floppies for a long
ae [Sat, 29 Sep 2012 15:08:55 +0000 (15:08 +0000)]
Disable splitfs support, since we aren't support floppies for a long
time. This slightly reduces an overhead, when loader tries to open
file that doesn't exist.

11 years agolibc: Use O_CLOEXEC for various internal file descriptors.
jilles [Sat, 29 Sep 2012 11:54:34 +0000 (11:54 +0000)]
libc: Use O_CLOEXEC for various internal file descriptors.

This fixes a race condition where another thread may fork() before CLOEXEC
is set, unintentionally passing the descriptor to the child process.

This commit only adds O_CLOEXEC flags to open() or openat() calls where no
fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still
leaves a race window so it should be fixed later.

11 years agoGive a clue how to force tcpdump(8) to interpret correctly CARP packets.
glebius [Sat, 29 Sep 2012 10:49:02 +0000 (10:49 +0000)]
Give a clue how to force tcpdump(8) to interpret correctly CARP packets.

11 years agoUpdate a comment to reflect recent locking changes.
alc [Sat, 29 Sep 2012 08:11:12 +0000 (08:11 +0000)]
Update a comment to reflect recent locking changes.

11 years agocarp_send_ad() should never return without rescheduling next run.
glebius [Sat, 29 Sep 2012 05:52:19 +0000 (05:52 +0000)]
carp_send_ad() should never return without rescheduling next run.

11 years agoAllow deferred word-splitting via f_sysrc_get() by allowing $IFS in the
dteske [Sat, 29 Sep 2012 03:41:21 +0000 (03:41 +0000)]
Allow deferred word-splitting via f_sysrc_get() by allowing $IFS in the
"clean-room" environment used to query rc.conf(5) parameters.

This brings bsdconfig(8)'s sysrc.subr in-line with both the sysrc(8) manual
[provided by sysutils/sysrc] and sysrc(8)'s own sysrc.subr (now identical to
bsdconfig(8)'s sysrc.subr as of this patch).

Finally, this will allow a clean import of sysutils/sysrc (sans sysrc.subr,
already provided here).

Reviewed by: jilles
Approved by: adrian (co-mentor)

11 years agoSimplify and somewhat redesign interaction between pf_purge_thread() and
glebius [Fri, 28 Sep 2012 20:43:03 +0000 (20:43 +0000)]
Simplify and somewhat redesign interaction between pf_purge_thread() and
pf_purge_expired_states().

Now pf purging daemon stores the current hash table index on stack
in pf_purge_thread(), and supplies it to next iteration of
pf_purge_expired_states(). The latter returns new index back.

The important change is that whenever pf_purge_expired_states() wraps
around the array it returns immediately. This makes our knowledge about
status of states expiry run more consistent. Prior to this change it
could happen that n-th run stopped on i-th entry, and returned (1) as
full run complete, then next (n+1) full run stopped on j-th entry, where
j < i, and that broke the mark-and-sweep algorythm that saves references
rules. A referenced rule was freed, and this later lead to a crash.

11 years agoThe drbr(9) API appeared to be so unclear, that most drivers in
glebius [Fri, 28 Sep 2012 18:28:27 +0000 (18:28 +0000)]
The drbr(9) API appeared to be so unclear, that most drivers in
tree used it incorrectly, which lead to inaccurate overrated
if_obytes accounting. The drbr(9) used to update ifnet stats on
drbr_enqueue(), which is not accurate since enqueuing doesn't
imply successful processing by driver. Dequeuing neither mean
that. Most drivers also called drbr_stats_update() which did
accounting again, leading to doubled if_obytes statistics. And
in case of severe transmitting, when a packet could be several
times enqueued and dequeued it could have been accounted several
times.

o Thus, make drbr(9) API thinner. Now drbr(9) merely chooses between
  ALTQ queueing or buf_ring(9) queueing.
  - It doesn't touch the buf_ring stats any more.
  - It doesn't touch ifnet stats anymore.
  - drbr_stats_update() no longer exists.

o buf_ring(9) handles its stats itself:
  - It handles br_drops itself.
  - br_prod_bytes stats are dropped. Rationale: no one ever
    reads them but update of a common counter on every packet
    negatively affects performance due to excessive cache
    invalidation.
  - buf_ring_enqueue_bytes() reduced to buf_ring_enqueue(), since
    we no longer account bytes.

o Drivers handle their stats theirselves: if_obytes, if_omcasts.

o mlx4(4), igb(4), em(4), vxge(4), oce(4) and  ixv(4) no longer
  use drbr_stats_update(), and update ifnet stats theirselves.

o bxe(4) was the most correct driver, it didn't call
  drbr_stats_update(), thus it was the only driver accurate under
  moderate load. Now it also maintains stats itself.

o ixgbe(4) had already taken stats from hardware, so just
  - drop software stats updating.
  - take multicast packet count from hardware as well.

o mxge(4) just no longer needs NO_SLOW_STATS define.

o cxgb(4), cxgbe(4) need no change, since they obtain stats
  from hardware.

Reviewed by: jfv, gnn

11 years agoFix some nearby type and style errors.
mdf [Fri, 28 Sep 2012 17:34:34 +0000 (17:34 +0000)]
Fix some nearby type and style errors.

Pointed out by: bde

11 years agoMake sure we don't leak a mbuf in a fail case.
hselasky [Fri, 28 Sep 2012 16:23:01 +0000 (16:23 +0000)]
Make sure we don't leak a mbuf in a fail case.

11 years agoRemove some trailing bytes which are not part of the ethernet packet.
hselasky [Fri, 28 Sep 2012 15:33:13 +0000 (15:33 +0000)]
Remove some trailing bytes which are not part of the ethernet packet.

Discussed with: bgray @

11 years agoCorrect NYET handling. Remove superfluous transfer complete interrupt mask.
hselasky [Fri, 28 Sep 2012 15:24:14 +0000 (15:24 +0000)]
Correct NYET handling. Remove superfluous transfer complete interrupt mask.

11 years agoSlight stylification.
des [Fri, 28 Sep 2012 13:50:37 +0000 (13:50 +0000)]
Slight stylification.

11 years agoRemove unnecessary #include.
des [Fri, 28 Sep 2012 12:29:25 +0000 (12:29 +0000)]
Remove unnecessary #include.

11 years agoChange queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make
mav [Fri, 28 Sep 2012 12:13:34 +0000 (12:13 +0000)]
Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make
them enabled on HEAD by default. It is probably better to do single compare
then hunt for unexpected memory corruption.

11 years ago- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
jhb [Fri, 28 Sep 2012 11:59:32 +0000 (11:59 +0000)]
- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
  bits under #ifdef _KERNEL but leave definitions for various structures
  defined by standards ($PIR table, SMAP entries, etc.) available to
  userland.
- Consolidate duplicate SMBIOS table structure definitions in ipmi(4)
  and smbios(4) in <machine/pc/bios.h> and make them available to
  userland.

MFC after: 2 weeks

11 years agoChange "only only" to "only" in portsnap(8).
issyl0 [Fri, 28 Sep 2012 11:40:59 +0000 (11:40 +0000)]
Change "only only" to "only" in portsnap(8).

Spotted by: Ruslan Mahmatkhanov
Approved by: gabor (mentor, implicit)

11 years agoFix the mis-handling of the VV_TEXT on the nullfs vnodes.
kib [Fri, 28 Sep 2012 11:25:02 +0000 (11:25 +0000)]
Fix the mis-handling of the VV_TEXT on the nullfs vnodes.

If you have a binary on a filesystem which is also mounted over by
nullfs, you could execute the binary from the lower filesystem, or
from the nullfs mount. When executed from lower filesystem, the lower
vnode gets VV_TEXT flag set, and the file cannot be modified while the
binary is active. But, if executed as the nullfs alias, only the
nullfs vnode gets VV_TEXT set, and you still can open the lower vnode
for write.

Add a set of VOPs for the VV_TEXT query, set and clear operations,
which are correctly bypassed to lower vnode.

Tested by: pho (previous version)
MFC after: 2 weeks

11 years agoAdd a note to portsnap(8) about the behaviour of the example cron command.
issyl0 [Fri, 28 Sep 2012 11:11:42 +0000 (11:11 +0000)]
Add a note to portsnap(8) about the behaviour of the example cron command.

PR: docs/171759
Submitted by: Paul Hoffman (phoffman at proper dot com)
Approved by: cperciva, gabor (mentor)
MFC after: 3 days

11 years agoMake the loader a bit smarter, when it tries to open disk and the slice
ae [Fri, 28 Sep 2012 10:49:41 +0000 (10:49 +0000)]
Make the loader a bit smarter, when it tries to open disk and the slice
number is not exactly specified. When the disk has MBR, also try to read
BSD label after ptable_getpart() call. When the disk has GPT, also set
d_partition to 255.  Mostly, this is how it worked before.

11 years agoRemove the topology lock from disk_gone(), it might be called with regular
pjd [Fri, 28 Sep 2012 08:22:51 +0000 (08:22 +0000)]
Remove the topology lock from disk_gone(), it might be called with regular
mutexes held and the topology lock is an sx lock.

The topology lock was there to protect traversing through the list of providers
of disk's geom, but it seems that disk's geom has always exactly one provider.

Change the code to call g_wither_provider() for this one provider, which is
safe to do without holding the topology lock and assert that there is indeed
only one provider.

Discussed with: ken
MFC after: 1 week

11 years agoMake sure that each va_start has one and only one matching va_end,
kevlo [Fri, 28 Sep 2012 07:51:30 +0000 (07:51 +0000)]
Make sure that each va_start has one and only one matching va_end,
especially in error cases.

11 years agoEliminate a stale comment. It describes another use case for the pmap in
alc [Fri, 28 Sep 2012 05:30:59 +0000 (05:30 +0000)]
Eliminate a stale comment.  It describes another use case for the pmap in
Mach that doesn't exist in FreeBSD.

11 years agoSanitize varname argument in f_sysrc_find. This is as much for security as it
dteske [Fri, 28 Sep 2012 01:39:25 +0000 (01:39 +0000)]
Sanitize varname argument in f_sysrc_find. This is as much for security as it
is for sanity.

Reviewed by: jilles
Approved by: adrian (co-mentor)

11 years agoFix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.
mdf [Thu, 27 Sep 2012 23:31:19 +0000 (23:31 +0000)]
Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix bin/ build with a 64-bit ino_t.
mdf [Thu, 27 Sep 2012 23:31:12 +0000 (23:31 +0000)]
Fix bin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix sbin/ build with a 64-bit ino_t.
mdf [Thu, 27 Sep 2012 23:31:06 +0000 (23:31 +0000)]
Fix sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix fsck_ffs build with a 64-bit ino_t.
mdf [Thu, 27 Sep 2012 23:30:58 +0000 (23:30 +0000)]
Fix fsck_ffs build with a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agoFix up kernel sources to be ready for a 64-bit ino_t.
mdf [Thu, 27 Sep 2012 23:30:49 +0000 (23:30 +0000)]
Fix up kernel sources to be ready for a 64-bit ino_t.

Original code by: Gleb Kurtsou

11 years agolibc/fts: Use O_CLOEXEC for internal file descriptors.
jilles [Thu, 27 Sep 2012 22:05:54 +0000 (22:05 +0000)]
libc/fts: Use O_CLOEXEC for internal file descriptors.

Because fts keeps internal file descriptors open across calls, making such
descriptors close-on-exec helps not only multi-threaded applications but
also single-threaded applications.

In particular, this prevents passing a temporary file descriptor for saving
the current directory to processes created via find -exec.

11 years agoEnsure that all cases that enqueue a netgraph item for delivery by a
rstone [Thu, 27 Sep 2012 20:12:51 +0000 (20:12 +0000)]
Ensure that all cases that enqueue a netgraph item for delivery by a
ngthread properly set the item's depth to 1.  In particular, prior to this
change if ng_snd_item failed to acquire a lock on a node, the item's depth
would not be set at all.  This fix ensures that the error code from rcvmsg/
rcvdata is properly passed back to the apply callback.  For example, this
fixes a bug where an error from rcvmsg/rcvdata would not previously
propagate back to a libnetgraph consumer when the message was queued.

Reviewed by: mav
MFC after: 1 month
Sponsored by: Sandvine Incorporated

11 years agoComplete revert of r239963:
pfg [Thu, 27 Sep 2012 20:06:37 +0000 (20:06 +0000)]
Complete revert of r239963:

The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after: 3 days
Reported by: David Wolfskill
Tested by: David Wolfskill

11 years agoComplete revert of r239963:
pfg [Thu, 27 Sep 2012 19:10:25 +0000 (19:10 +0000)]
Complete revert of r239963:

The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after: 3 days
Reported by: David Wolfskill
Tested by: David Wolfskill

11 years agoFix pseudo checksum calculation.
fjoe [Thu, 27 Sep 2012 18:15:01 +0000 (18:15 +0000)]
Fix pseudo checksum calculation.

This fixes ipfilter w/ network controllers that implement only
partial rx csum offloading.

PR: 106438
Obtained from: upstream
MFC after: 1 week

11 years agosigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.
jilles [Thu, 27 Sep 2012 17:48:04 +0000 (17:48 +0000)]
sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition.

Passing an invalid pointer results in undefined behaviour.

The wrappers in libthr access some of the data pointed to by the arguments
in userland, so that an invalid pointer will cause a signal and not an
[EFAULT] error return.

Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is
not a proper error in the sense that the call still commits (changing the
signal disposition or accepting the signal).

MFC after: 1 week

11 years agoRevert r240931, as the previous comment was actually in sync with POSIX.
pjd [Thu, 27 Sep 2012 16:43:23 +0000 (16:43 +0000)]
Revert r240931, as the previous comment was actually in sync with POSIX.

I have to note that POSIX is simply stupid in how it describes O_EXEC/fexecve
and friends. Yes, not only inconsistent, but stupid.

In the open(2) description, O_RDONLY flag is described as:

O_RDONLY Open for reading only.

Taken from:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Note "for reading only". Not "for reading or executing"!

In the fexecve(2) description you can find:

The fexecve() function shall fail if:

[EBADF]
The fd argument is not a valid file descriptor open for executing.

Taken from:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html

As you can see the function shall fail if the file was not open with O_EXEC!

And yet, if you look closer you can find this mess in the exec.html:

Since execute permission is checked by fexecve(), the file description
fd need not have been opened with the O_EXEC flag.

Yes, O_EXEC flag doesn't have to be specified after all. You can open a file
with O_RDONLY and you still be able to fexecve(2) it.

11 years agoMake sure the "wMaxPacketSize" limitations are respected.
hselasky [Thu, 27 Sep 2012 15:45:24 +0000 (15:45 +0000)]
Make sure the "wMaxPacketSize" limitations are respected.

11 years agoMake sure we record NAK tokens in the TD structure for IN direction.
hselasky [Thu, 27 Sep 2012 15:23:38 +0000 (15:23 +0000)]
Make sure we record NAK tokens in the TD structure for IN direction.
Improve host channel disabling. Wait two times 125us for channel to be
disabled. The DWC OTG doesn't like when channels are re-used too early.

11 years agoKernel and modules have "set_vnet" linker set, where virtualized
trociny [Thu, 27 Sep 2012 14:55:15 +0000 (14:55 +0000)]
Kernel and modules have "set_vnet" linker set, where virtualized
global variables are placed. When a module is loaded by link_elf
linker its variables from "set_vnet" linker set are copied to the
kernel "set_vnet" ("modspace") and all references to these variables
inside the module are relocated accordingly.

The issue is when a module is loaded that has references to global
variables from another, previously loaded module: these references are
not relocated so an invalid address is used when the module tries to
access the variable. The example is V_layer3_chain, defined in ipfw
module and accessed from ipfw_nat.

The same issue is with DPCPU variables, which use "set_pcpu" linker
set.

Fix this making the link_elf linker on a module load recognize
"external" DPCPU/VNET variables defined in the previously loaded
modules and relocate them accordingly. For this set_pcpu_list and
set_vnet_list are used, where the addresses of modules' "set_pcpu" and
"set_vnet" linker sets are stored.

Note, archs that use link_elf_obj (amd64) were not affected by this
issue.

Reviewed by: jhb, julian, zec (initial version)
MFC after: 1 month

11 years agoRemove useless NULL checks after M_WAITOK allocations.
trasz [Thu, 27 Sep 2012 10:51:38 +0000 (10:51 +0000)]
Remove useless NULL checks after M_WAITOK allocations.

11 years agoFix zillions of style(9) and spacing bugs introduced by r240981.
glebius [Thu, 27 Sep 2012 10:46:22 +0000 (10:46 +0000)]
Fix zillions of style(9) and spacing bugs introduced by r240981.

Pointy hat to: sobomax

11 years agoFix several build failures for !COMPAT_FREEBSD32 and
glebius [Thu, 27 Sep 2012 10:30:11 +0000 (10:30 +0000)]
Fix several build failures for !COMPAT_FREEBSD32 and
!COMPAT_FREEBSD* kernels introduced by r240981.

Pointy hat to: sobomax

11 years agoFix bug in TCP_KEEPCNT setting, which slipped in in the last round
glebius [Thu, 27 Sep 2012 07:13:21 +0000 (07:13 +0000)]
Fix bug in TCP_KEEPCNT setting, which slipped in in the last round
of reviewing of r231025.

Unlike other options from this family TCP_KEEPCNT doesn't specify
time interval, but a count, thus parameter supplied doesn't need
to be multiplied by hz.

Reported & tested by: amdmi3

11 years agoTrack the last ANI TX/RX sample correctly.
adrian [Thu, 27 Sep 2012 06:05:54 +0000 (06:05 +0000)]
Track the last ANI TX/RX sample correctly.

This doesn't specifically fix the issue(s) i'm seeing in this 2GHz
environment (where setting/increasing spur immunity causes OFDM restart
errors to skyrocket through the roof; but leaving it at 0 would leave
the environment cleaner..)

Pointy-hat-to: me, for committing this broken code in the first place.

11 years agoImplementing pmap_kextract(va) as pmap_extract(kernel_pmap, va) is
alc [Thu, 27 Sep 2012 05:39:42 +0000 (05:39 +0000)]
Implementing pmap_kextract(va) as pmap_extract(kernel_pmap, va) is
problematic because some callers to pmap_kextract() expect its
implementation to be lock-less.  In particular, uma_dbg_alloc() implicitly
requires this.  Otherwise, lock-order reversals occur between pmap locks and
UMA zone locks.  So, this change introduces a lock-less implementation of
pmap_kextract().

Disable recursion on the pvh global lock in the new armv6 pmap.  While
recursion on this locks occurs in the old arm pmap, it thankfully doesn't
occur in the armv6 pmap.

Tested by: jmg

11 years agoInitialize the num variable to avoid uninitialized data.
kevlo [Thu, 27 Sep 2012 05:26:29 +0000 (05:26 +0000)]
Initialize the num variable to avoid uninitialized data.
This fixes the bug introduced by r238378.

Reviewed by: pfg

11 years agoAdd 32-bit ABI compat shims. Those are necessary for i386 binary-only
sobomax [Thu, 27 Sep 2012 04:28:55 +0000 (04:28 +0000)]
Add 32-bit ABI compat shims. Those are necessary for i386 binary-only
tools like sysutils/hpacucli (HP P4xx RAID controller management
suite) working on amd64 systems.

PR: 139271
Submitted by: Kazumi MORINAGA, Eugene Grosbein
MFC after: 1 week

11 years agoatrun: Do not assume that MAXLOGNAME <= 100.
jilles [Wed, 26 Sep 2012 20:47:39 +0000 (20:47 +0000)]
atrun: Do not assume that MAXLOGNAME <= 100.

The reserved space for fmt was exactly sufficient for a two-digit value of
MAXLOGNAME - 1.

PR: bin/171815
Submitted by: Jeremy Huddleston Sequoia
MFC after: 1 week

11 years agofind: Do not pass fd to save current directory to child processes.
jilles [Wed, 26 Sep 2012 20:16:15 +0000 (20:16 +0000)]
find: Do not pass fd to save current directory to child processes.

This removes one of the two wrongly passed file descriptors. The other one
appears to be from fts(3).

MFC after: 1 week

11 years ago- In the bridge_enqueue() do success/error accounting for
glebius [Wed, 26 Sep 2012 20:09:48 +0000 (20:09 +0000)]
- In the bridge_enqueue() do success/error accounting for
  each fragment, not only once.
- In the GRAB_OUR_PACKETS() macro do increase if_ibytes.

11 years ago- Make C11 atomic macros usable in expressions:
tijl [Wed, 26 Sep 2012 19:49:22 +0000 (19:49 +0000)]
- Make C11 atomic macros usable in expressions:
  - Replace do-while statements with void expressions.
  - Wrap __asm statements in statement expressions.
- Make the macros function-like:
  - Evaluate all arguments exactly once.
  - Make sure there's a sequence point between evaluation of the arguments
    and the function body. Arguments should be evaluated before any memory
    barriers.
- Fix use of __atomic_is_lock_free built-in. It requires the address of
  an atomic variable as second argument. Use this built-in on clang as
  well because clang's __c11_atomic_is_lock_free only takes the size of the
  variable into account.
- In atomic_exchange_explicit put the barrier before instead of after the
  __sync_lock_test_and_set call.

Reviewed by: theraven