Commit Graph

148896 Commits

Author SHA1 Message Date
Robert Watson
2a5658382a Clean up a number of aspects of token generation from audit arguments to
system calls:

- Centralize generation of argument tokens for VM addresses in a macro,
  ADDR_TOKEN(), and properly encode 64-bit addresses in 64-bit arguments.
- Fix up argument numbers across a large number of syscalls so that they
  match the numeric argument into the system call.
- Don't audit the address argument to ioctl(2) or ptrace(2), but do keep
  generating tokens for mmap(2), minherit(2), since they relate to passing
  object access across execve(2).

Approved by:	re (audit argument blanket)
Obtained from:	TrustedBSD Project
MFC after:	1 week
2009-07-02 09:15:30 +00:00
Xin LI
c4f739ec0c Use MPT_MAX_LUNS as maximium number of LUNs, not 7, for SAS and FC cases.
This matches Linux driver behavior.

Discussed with:	scottl
Approved by:	re (kensmith)
MFC after:	1 month
2009-07-02 00:43:10 +00:00
Xin LI
1635f0499e Change explicit maximium numbers to the defined macro MPT_MAX_LUNS.
Approved by:	re (kensmith)
2009-07-02 00:41:37 +00:00
Robert Watson
03f7b00438 For access(2) and eaccess(2), audit the requested access mode.
Approved by:	re (audit argument blanket)
MFC after:	3 days
2009-07-01 22:47:45 +00:00
Edward Tomasz Napierala
4bc61fd4ec Don't panic on attempt to set ACL on a block device file.
This is just a part of kern/125613.

PR:		kern/125613
Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
Reviewed by:	rwatson
Approved by:	re (kib)
2009-07-01 22:30:36 +00:00
Stanislav Sedov
12de41a26f - Properly order headers, local variables and prototypes. [1]
- Remove unneeded headers.
- Return non-zero error code in usage().

Approved by:	re (kib)
Suggested by:	bde [1]
2009-07-01 22:23:26 +00:00
Jeff Roberson
2141453eb4 - Use fd_lastfile + 1 as the upper bound on nd. This is more correct than
using the size of the descriptor array.
 - A lock is not needed to fetch fd_lastfile.  The results are stale the
   instant it is dropped.
 - Use a private mutex pool for select since the pool mutex is not used
   as a leaf.
 - Fetch the si_mtx pointer first before resorting to hashing to compute
   the mutex address.

Reviewed by:	McKusick
Approved by:	re (kib)
2009-07-01 20:43:46 +00:00
Edward Tomasz Napierala
8edfe76ab5 Fix a panic which (reportedly) can happen when unmounting a filesystem
with I/O requests in flight on kernels compiled with "options INVARIANTS".
Also, make it obvious it's not right to call g_valid_obj() (and macros
using it, e.g. G_VALID_CONSUMER()) without topology lock held.

Approved by:	re (kib)
Reported by:	pho
2009-07-01 20:16:29 +00:00
Rafal Jaworowski
f981547c99 Map DPCPU pages into ARM kernel VA space.
DPCPU area was not properly mapped into kernel VA space, which caused page
fault on the first DPCPU access. This patch fixes the problem by mapping DPCPU
area into kernel VA space.

Submitted by:	Michal Hajduk, Piotr Ziecik
Reviewed by:	cognet, stas
Approved by:	re (kib)
Obtained from:	Semihalf
2009-07-01 20:07:44 +00:00
Robert Watson
15ca46f69d Audit file descriptor numbers for various socket-related system calls.
Approved by:	re (audit argument blanket)
MFC after:	3 days
2009-07-01 19:55:11 +00:00
Robert Watson
9e4c1521d5 Define missing audit argument macro AUDIT_ARG_SOCKET(), and
capture the domain, type, and protocol arguments to socket(2)
and socketpair(2).

Approved by:	re (audit argument blanket)
MFC after:	3 days
2009-07-01 18:54:49 +00:00
Doug Rabson
81611ea7c6 Clarify the node about removing NFS_LEGACYRPC
Approved by: re
2009-07-01 18:12:50 +00:00
John Baldwin
cebc7fb16c Improve the handling of cpuset with interrupts.
- For x86, change the interrupt source method to assign an interrupt source
  to a specific CPU to return an error value instead of void, thus allowing
  it to fail.
- If moving an interrupt to a CPU fails due to a lack of IDT vectors in the
  destination CPU, fail the request with ENOSPC rather than panicing.
- For MSI interrupts on x86 (but not MSI-X), only allow cpuset to be used
  on the first interrupt in a group.  Moving the first interrupt in a group
  moves the entire group.
- Use the icu_lock to protect intr_next_cpu() on x86 instead of the
  intr_table_lock to fix a LOR introduced in the last set of MSI changes.
- Add a new privilege PRIV_SCHED_CPUSET_INTR for using cpuset with
  interrupts.  Previously, binding an interrupt to a CPU only performed a
  privilege check if the interrupt had an interrupt thread.  Interrupts
  without a thread could be bound by non-root users as a result.
- If an interrupt event's assign_cpu method fails, then restore the original
  cpuset mask for the associated interrupt thread.

Approved by:	re (kib)
2009-07-01 17:20:07 +00:00
Robert Watson
6d5a61563a When auditing unmount(2), capture FSID arguments as regular text strings
rather than as paths, which would lead to them being treated as relative
pathnames and hence confusingly converted into absolute pathnames.

Capture flags to unmount(2) via an argument token.

Approved by:	re (audit argument blanket)
MFC after:	3 days
2009-07-01 16:56:56 +00:00
Rick Macklem
a4c5a1c315 When unmounting an NFS mount using sec=krb5[ip], the umount system
call could get hung sleeping on "gsssta" if the credentials for a user
that had been accessing the mount point have expired. This happened
because rpc_gss_destroy_context() would end up calling itself when the
"destroy context" RPC was attempted, trying to refresh the credentials.
This patch just checks for this case in rpc_gss_refresh() and returns
without attempting the refresh, which avoids the recursive call to
rpc_gss_destroy_context() and the subsequent hang.

Reviewed by:	dfr
Approved by:	re (Ken Smith), kib (mentor)
2009-07-01 16:42:03 +00:00
Rick Macklem
b766fabd9c Make sure that cr_error is set to ESHUTDOWN when closing the connection.
This is normally done by a loop in clnt_dg_close(), but requests that aren't
in the pending queue at the time of closing, don't get set. This avoids a
panic in xdrmbuf_create() when it is called with a NULL cr_mrep if
cr_error doesn't get set to ESHUTDOWN while closing.

Reviewed by:	dfr
Approved by:	re (Ken Smith), kib (mentor)
2009-07-01 16:38:18 +00:00
Jack F Vogel
6bdcc991ae Multiqueue RX is not correctly enabled on the new 82599
adapter, the SRRCTL register needs to be setup per queue.

Approved by: re
2009-07-01 16:13:01 +00:00
Edward Tomasz Napierala
deda5987bc With NFSv4 ACLs, it is possible that applying a mode to an ACL which
is identical to the mode computed from that ACL will modify the ACL.
For example, mode computed from the following ACL is 0600:

   user:kamila:rwx--------C--:------:allow
        owner@:--x-----------:------:deny
        owner@:rw-p---A-W-Co-:------:allow
        group@:rwxp----------:------:deny
        group@:--------------:------:allow
     everyone@:rwxp---A-W-Co-:------:deny
     everyone@:------a-R-c--s:------:allow

However, applying that mode (chmod 0600) changes the ACL into this:

   user:kamila:rwx-----------:------:deny
   user:kamila:rwx--------C--:------:allow
        owner@:--x-----------:------:deny
        owner@:rw-p---A-W-Co-:------:allow
        group@:rwxp----------:------:deny
        group@:--------------:------:allow
     everyone@:rwxp---A-W-Co-:------:deny
     everyone@:------a-R-c--s:------:allow

In chmod(1) utility, there is an optimisation, which makes it not
call chmod(2) if the mode of the file is the same as the new mode.
Disable that optimisation for files which may have NFSv4 ACLs.

Reviewed by:	rwatson
Approved by:	re (kib)
2009-07-01 15:52:19 +00:00
Robert Watson
422d786676 Audit the file descriptor number passed to lseek(2).
Approved by:	re (kib)
MFC after:	3 days
2009-07-01 15:37:23 +00:00
Robert Watson
c5957d6bba Fix link(2) auditing: use the second audit record path for the new object
name.

Approved by:	re (kib)
MFC after:	3 days
2009-07-01 13:22:08 +00:00
Stanislav Sedov
d981a4e272 - Fix the bug in write(2) called with incorrect parameters resulting in writes
always started from the start of the packet.
- Fix usage string (multiple addresses can be specified).
- Make the source more style(9) compliant.
- Improve error reporting (do not silently fail if something goes
  wrong).
- Make functions static.
- Use warns level 6.

Approved by:	re (kib)
Discussed with:	Marc Balmer <marc@msys.ch>, brian, mbr
2009-07-01 13:07:02 +00:00
Robert Watson
2ef24dde7c udit the 'options' argument to wait4(2).
Approved by:	re (kib)
MFC after:	3 days
2009-07-01 12:36:10 +00:00
Alexander Motin
505feb8f37 Fix infinite loop in ng_iface, that happens when packet passes out via
two different ng interfaces sequentially due to tunnelling.

PR:		kern/134557
Submitted by:	Mikolaj Golub
Approved by:	re (kensmith)
MFC after:	3 days
2009-07-01 08:08:56 +00:00
Doug Rabson
f09a384fae Add usr/include/nfs/rpcv2.h
Submitted by: pluknet at gmail dot com
Approved by: re
2009-07-01 07:37:21 +00:00
Doug Rabson
bab42aad98 Add an entry documenting removal of the NFS_LEGACYRPC option.
Submitted by: Steve Kargl
Approved by: re
2009-07-01 07:35:57 +00:00
Doug Rabson
259d14ed88 Don't include rpcv2.h - it has been removed.
Submitted by: ed@
Approved by: re
2009-07-01 07:34:28 +00:00
Martin Blapp
a6dff0a5de Compiles without higher warn level
M    wake/Makefile

Approved by: re (previous commit)
2009-06-30 22:09:47 +00:00
Brian Somers
ef26f51cb1 Don't imply that only FTP urls are supported when we can't fetch
a package.

Approved by:	re (kib)
MFC after:	3 weeks
2009-06-30 20:53:57 +00:00
Edward Tomasz Napierala
bc8036862b Make it clear where to look for for protocol-specific socket options.
Reviewed by:	rwatson
Approved by:	re (kib)
2009-06-30 20:53:56 +00:00
Alan Cox
9785747f87 Remove a stale comment. The very same revision (r85511) that introduced
this comment also implemented the proposed change to the code.

Approved by:	re (kib)
2009-06-30 19:39:17 +00:00
Doug Rabson
98c497255b Adjust the internal NFS KPI to avoid the last traces of NFS_LEGACYRPC.
Approved by: re
2009-06-30 19:10:17 +00:00
Doug Rabson
b49a2b39fd Remove the old kernel RPC implementation and the NFS_LEGACYRPC option.
Approved by: re
2009-06-30 19:03:27 +00:00
Martin Blapp
58c6a70a52 Add wake, a tool to send Wake on LAN frames to hosts on a local Ethernet network
Submitted by:   Marc Balmer <marc@msys.ch>
Reviewed by:    rwatson
Approved by:	re

M    usr.sbin/Makefile
A    usr.sbin/wake
AM   usr.sbin/wake/wake.c
AM   usr.sbin/wake/Makefile
AM   usr.sbin/wake/wake.8
2009-06-30 18:51:22 +00:00
Edward Tomasz Napierala
fb231f3627 Make gjournal work with kernel compiled with "options DIAGNOSTIC".
Previously, it would panic immediately.

Reviewed by:	pjd
Approved by:	re (kib)
2009-06-30 14:34:06 +00:00
Ed Maste
2dafac3976 Add FIONSPACE from NetBSD. FIONSPACE is provided so that programs may
easily determine how much space is left in the send queue; they do not
need to know the send queue size.

NetBSD revisions:
  sys_socket.c r1.41, 1.42
  filio.h r1.9

Obtained from:	NetBSD
Approved by:	re (kensmith)
2009-06-30 13:38:49 +00:00
Stanislav Sedov
b2d758545b - Add support to atomically set/clear individual bits of a MSR register
via cpuctl(4) driver.  Two new CPUCTL_MSRSBIT and CPUCTL_MSRCBIT ioctl(2)
  calls treat the data field of the argument struct passed as a mask
  and set/clear bits of the MSR register according to the mask value.
- Allow user to perform atomic bitwise AND and OR operaions on MSR registers
  via cpucontrol(8) utility.  Two new operations ("&=" and "|=") have been
  added.  The first one applies bitwise AND operaion between the current
  contents of the MSR register and the mask, and the second performs bitwise
  OR.  The argument can be optionally prefixed with "~" inversion operator.
  This allows one to mimic the "clear bit" behavior by using the command
  like this:
      cpucontrol -m 0x10&=~0x02		# clear the second bit of TSC MSR

  Inversion operator support in all modes (assignment, OR, AND).

Approved by:	re (kib)
MFC after:	1 month
2009-06-30 12:35:47 +00:00
Andriy Gapon
462fab84b8 remove unused/unneeded extern declarations
This should result in no changes to compiled code.

Reviewed by:	alc
Approved by:	re (kib)
MFC after:	1 day
2009-06-30 11:16:32 +00:00
Konstantin Belousov
cfba50c070 For SU mounts, softdep_fsync() might drop vnode lock, allowing other
threads to put dirty buffers on the vnode bufobj list. For regular files
and synchronous fsync requests, check for the condition and restart the
fsync vop if a new dirty buffer arrived.

Tested by:	pho
Approved by:	re (kensmith)
MFC after:	1 month
2009-06-30 10:07:33 +00:00
Konstantin Belousov
a50d1b2a66 Softdep_fsync() may need to lock parent directory of the synced vnode.
Use inlined (due to FFSV_FORCEINSMQ) version of vn_vget_ino() to prevent
mountpoint from being unmounted and freed while no vnodes are locked.

Tested by:	pho
Approved by:	re (kensmith)
MFC after:	1 month
2009-06-30 10:07:00 +00:00
Rui Paulo
0f73b657a9 acpi_wmi_if:
- Document different semantics for ACPI_WMI_PROVIDES_GUID_STRING_METHOD

acpi_wmi.c:
- Modify acpi_wmi_provides_guid_string_method to return absolut number of
  instances known for the given GUID.

acpi_hp.c:
- sysctl dev.acpi_hp.0.verbose to toggle debug output
- A modification so this can deal with different array lengths
  when reading the CMI BIOS - now it works ok on HP Compaq nx7300
  as well.
- Change behaviour to query only max_instance-1 CMI BIOS instances,
  because all HPs seen so far are broken in that respect
  (or there is a fundamental misunderstanding on my side, possible
  as well). This way a disturbing ACPI Error Field exceeds Buffer
  message is avoided.
- New bit to set on dev.acpi_hp.0.cmi_detail (0x8) to
  also query the highest guid instance of CMI bios

acpi_hp.4:
- Document dev.acpi_hp.0.verbose sysctl in man page
- Document new bit for dev.acpi_hp.0.cmi_detail
- Add a section to manpage about hardware that has been reported
  to work ok

Submitted by:	Michael Gmelin, freebsdusb at bindone.de
Approved by:	re (kib)
MFC after:	2 weeks
2009-06-30 09:51:41 +00:00
Bjoern A. Zeeb
ba3b25b35a In case we cannot queue a packet reaching the queue limit, retain the
semantics netisr_queue() always had and free the mbuf along with
returning the error.

Reviewed by:	rwatson
Approved by:	re (kensmith)
2009-06-30 05:21:00 +00:00
John Baldwin
5ed6940d13 Fix build with NFS_LEGACYRPC enabled after the socket upcall locking
changes.

Approved by:	re (kensmith)
2009-06-30 03:18:51 +00:00
Stacey Son
86120afae4 Dynamically allocate the gidset field in audit record.
This fixes a problem created by the recent change that allows a large
number of groups per user.  The gidset field in struct kaudit_record
is now dynamically allocated to the size needed rather than statically
(using NGROUPS).

Approved by:	re@ (kensmith, rwatson), gnn (mentor)
2009-06-29 20:19:19 +00:00
Brooks Davis
6cb7f168db Remove support for the /dev/net/* per-interface devices. They serve
little purpose and are unused in the base system.

The IOCTL functionality is entirely duplicated and routing sockets
provide a richer interface than the kqueue functionality.

Further, it is not practical for these devices to be made sensible in
the face of VIMAGE.

Bump __FreeBSD_version on the off chance that there is any code out
there that actually uses this stuff.

Reviewed by:	rwatson
Discussed with:	bz, zec
Approved by:	re@ (kensmith)
2009-06-29 19:46:29 +00:00
Konstantin Belousov
8c8484d103 Make the structure definitions in the man pages match the real code, and
remove no longer valid caution.

Approved by:	re (kensmith)
2009-06-29 18:54:17 +00:00
Sam Leffler
7850fa71f5 Update to 3.6.2.2 firmware (latest w/o host-based power save support):
o new tx ack queue (not used right now)
o proxy-sta related changes (no proxy sta in driver)
o explicit dwds ena/dis (needed only with proxy sta)
o cleanup BA policy handling
o new ampdu aggressive mode support
o CFEnd use now controllable

Approved by:	re (kensmith)
2009-06-29 18:42:54 +00:00
Jack F Vogel
562a924de0 Type problem when FreeBSD is in a virtualized environment, the
result was when the RX index wrapped it was converted into some
sort of gibberish and written into the RDT register, effectively
killing the RX side of the thing :)

Approved by: re
2009-06-29 18:17:10 +00:00
Konstantin Belousov
a73034ef7f Free struct ucreds allocated in vfs_hang_addrlist() when deleting
the export element.
While there, remove register storage-class specifiers.

Reported and tested by:	pho
Reviewed by:	kan
Approved by:	re (kensmith)
2009-06-29 18:09:07 +00:00
Warner Losh
ca72c49f42 Fix copyrights to reflect the origin of these files.
Approved by:	re@ (rwatson)
2009-06-29 16:45:50 +00:00
Attilio Rao
5257ff7ee1 Don't assume a default (currently 15) value for preloaded klds when
loading hwpmc, but calculate at runtime and allocate the necessary space.
Also the current logic is wrong as it can lead to an endless loop.

Sponsored by:   Sandvine Incorporated
Reported by:    Ryan Stone <rstone at sandvine dot com>
Tested by:      Giovanni Trematerra
                <giovanni dot trematerra at gmail dot com>
Approved by:	re (kib)
2009-06-29 16:03:18 +00:00