Commit Graph

14270 Commits

Author SHA1 Message Date
Jilles Tjoelker
5844994b1e sem_open: Make sure to fail an O_CREAT|O_EXCL open, even if that semaphore
is already open in this process.

If the named semaphore is already open, sem_open() only increments a
reference count and did not take the flags into account (which otherwise
happens by passing them to open()). Add an extra check for O_CREAT|O_EXCL.

PR:		kern/166706
Reviewed by:	davidxu
MFC after:	10 days
2012-04-09 14:17:22 +00:00
Andrew Turner
fcb6e7147b Unlike other functions __aeabi_read_tp function must preserve r1-r3. The
currently generated code clobbers r3. Fix this by loading ARM_TP_ADDRESS
using inline assembly.

Approved by:	imp (mentor)
2012-04-08 04:36:27 +00:00
Stanislav Sedov
4630ab1f82 - Use __NO_TLS preprocessor value to make assumptions about TLS support
on a platform.
2012-04-08 03:55:25 +00:00
Stanislav Sedov
b30d62be27 - Revert part of r234005, which I did not intend to commit.
Sorry! :(
2012-04-07 23:51:16 +00:00
Stanislav Sedov
47db1ea0bf - Add kernel config file for QEMU-emulated gumstix board. 2012-04-07 23:48:51 +00:00
Nathan Whitehorn
351f30528e Properly resolve the _ctx_start function descriptor (the symbol _ctx_start
is a descriptor, not a code address), which prevents crashes when starting
a context. This fixes QEMU on powerpc64.

MFC after:	3 days
2012-04-07 22:28:50 +00:00
Joel Dahl
26c9eb4a77 mdoc: fix function type. 2012-04-07 09:26:21 +00:00
Joel Dahl
748611c9c0 mdoc: fix column names, indentation, column separation within each row, and
quotation. Also make sure we have the same amount of columns in each row as
the number of columns we specify in the head arguments.

Reviewed by:	brueffer
2012-04-07 09:05:30 +00:00
David Schultz
1cbd288942 Fix a bug in remquo{,f,l}, in which the quotient didn't always have the
correct sign when the remainder was 0.

Fix a separate bug in remquo alone, in which the remainder and
quotient were both off by a bit in certain cases involving subnormal
remainders.

The bugs affected all platforms except amd64 and i386, on which the
routines are implemented in assembly.

PR:		166463
Submitted by:	Ilya Burylov
MFC after:	2 weeks
2012-04-07 03:59:12 +00:00
Stanislav Sedov
3ef51c5fb9 - Do not use deprecated krb5 error message reporting functions in libtelnet. 2012-04-06 00:03:45 +00:00
Doug Barton
d0f6280db7 Update to version 9.8.2, the latest from ISC, which contains numerous bug fixes. 2012-04-05 04:29:35 +00:00
David Xu
8931e524bf In sem_post, the field _has_waiters is no longer used, because some
application destroys semaphore after sem_wait returns. Just enter
kernel to wake up sleeping threads, only update _has_waiters if
it is safe. While here, check if the value exceed SEM_VALUE_MAX and
return EOVERFLOW if this is true.
2012-04-05 03:05:02 +00:00
David Xu
17ce606321 umtx operation UMTX_OP_MUTEX_WAKE has a side-effect that it accesses
a mutex after a thread has unlocked it, it event writes data to the mutex
memory to clear contention bit, there is a race that other threads
can lock it and unlock it, then destroy it, so it should not write
data to the mutex memory if there isn't any waiter.
The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It
requires thread library to clear the lock word entirely, then
call the WAKE2 operation to check if there is any waiter in kernel,
and try to wake up a thread, if necessary, the contention bit is set again
by the operation. This also mitgates the chance that other threads find
the contention bit and try to enter kernel to compete with each other
to wake up sleeping thread, this is unnecessary. With this change, the
mutex owner is no longer holding the mutex until it reaches a point
where kernel umtx queue is locked, it releases the mutex as soon as
possible.
Performance is improved when the mutex is contensted heavily.  On Intel
i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds
to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is
deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c
2012-04-05 02:24:08 +00:00
Doug Barton
42d3eba523 Vendor import of BIND 9.8.2 2012-04-04 23:11:25 +00:00
Xin LI
32ffd2336c Eliminate two cases of unwanted strncpy(). The name is not required
by the current code, and the results would get overwritten anyway
by subsequent memset().

Reviewed by:	ume
MFC after:	1 month
2012-04-02 07:42:17 +00:00
John Baldwin
e506e182dd Export some more useful info about shared memory objects to userland
via procstat(1) and fstat(1):
- Change shm file descriptors to track the pathname they are associated
  with and add a shm_path() method to copy the path out to a caller-supplied
  buffer.
- Use the fo_stat() method of shared memory objects and shm_path() to
  export the path, mode, and size of a shared memory object via
  struct kinfo_file.
- Add a struct shmstat to the libprocstat(3) interface along with a
  procstat_get_shm_info() to export the mode and size of a shared memory
  object.
- Change procstat to always print out the path for a given object if it
  is valid.
- Teach fstat about shared memory objects and to display their path,
  mode, and size.

MFC after:	2 weeks
2012-04-01 18:22:48 +00:00
Joel Dahl
66265da747 mdoc: terminate quoted strings. 2012-03-30 12:34:34 +00:00
Joel Dahl
10b4d262da Remove unnecessary Xo/Xc.
Reviewed by:	brueffer
2012-03-29 20:23:35 +00:00
Joel Dahl
a53e0df1d7 mdoc: Ud takes no argument. 2012-03-29 16:20:20 +00:00
Joel Dahl
1844d4fe2d Remove superfluous paragraph macro. 2012-03-29 16:07:22 +00:00
Joel Dahl
288eac5aed mandoc complains loudly when <TAB>s are misused in columnated lists. Fix
this syntax violation and while I'm here also convert <TAB> to Ta and adjust
quotation marks in order to prevent this problem in the future.
2012-03-29 16:02:40 +00:00
Joel Dahl
f8727698eb mdoc: sort prologue macros. 2012-03-29 06:19:00 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Juli Mallett
3dce589cb9 Fix 32-bit libgeom consumers run on 64-bit kernels with COMPAT_FREEBSD32.
Kernel pointer values are used as opaque unique identifiers, which are then
used to reconstruct references between various providers, classes, etc., inside
libgeom from the source XML.  Unfortunately, they're converted to pointer-width
integers (in the form of pointers) to do this, and 32-bit userland pointers
cannot hold sensible representations (however opaque) of 64-bit kernel pointers
on all systems.

In the case where the leading bits are zero and 32 distinct bits of pointer can
be identified, this will happen to work.  On systems where the upper 32-bits of
kernel pointers are non-zero and the same for all kernel pointers, this will
result in double frees and all kinds of bizarre crashes and linkage between
objects inside libgeom.

To mitigate this problem, treat the opaque identifiers in the XML as C strings
instead, and internalize them to give unique and consistent per-object pointer
values in userland for each identifier in the XML.  This allows us to keep the
libgeom logic the same with only minor changes to initial setup and parsing.

It might be more sensible for speed reasons to treat the identifiers as numbers
of a large size (uintmax_t, say) rather than strings, but strings seem fine for
now.

(As an added side-effect, this makes it slightly easier to identify unresolved
 references, but nothing has been added to inform the user of those.)
2012-03-29 03:13:43 +00:00
Jim Harris
0f70b33419 Fix comment to specify correct struct name.
Reviewed by: gjb
Approved by: sbruno
2012-03-28 23:51:06 +00:00
Fabien Thomas
f5f9340b98 Add software PMC support.
New kernel events can be added at various location for sampling or counting.
This will for example allow easy system profiling whatever the processor is
with known tools like pmcstat(8).

Simultaneous usage of software PMC and hardware PMC is possible, for example
looking at the lock acquire failure, page fault while sampling on
instructions.

Sponsored by: NETASQ
MFC after:	1 month
2012-03-28 20:58:30 +00:00
Joel Dahl
3b3faeb9da Fix Fo arguments.
Reviewed by:	gabor
2012-03-28 19:20:28 +00:00
Joel Dahl
539617ec61 mdoc: add missing El macro. 2012-03-27 20:50:14 +00:00
Joel Dahl
478c2636bb Minor indentation and paragraph nits. 2012-03-27 20:39:49 +00:00
Joel Dahl
24eb28257a Remove useless Ta macro. 2012-03-27 15:55:56 +00:00
Joel Dahl
c1f71e84f1 Minor mdoc nit. 2012-03-27 15:22:10 +00:00
Oleksandr Tymoshenko
68fc871575 Handle MIPS .reginfo section as ELF_T_BYTE 2012-03-26 21:31:57 +00:00
Joel Dahl
46355096e1 mdoc: correct .Bd/.Bl arguments.
Reviewed by:	brueffer
2012-03-26 21:22:53 +00:00
Joel Dahl
bea977e7f6 mdoc: sort prologue macros. 2012-03-26 19:23:57 +00:00
Robert Millan
63eebf9c6b Register signal 33 explicitly as reserved by real-time library, and
use it by its new name (SIGLIBRT) rather than internal definition
in librt (SIGSERVICE).

Approved by:	davidxu, arch
2012-03-26 19:12:09 +00:00
Joel Dahl
6ae6870fe8 mdoc: remove unknown macro. 2012-03-26 19:06:59 +00:00
Jilles Tjoelker
91792417bb libthr: In the atfork handlers for signals, do not skip the last signal.
_SIG_MAXSIG works a bit unexpectedly: signals 1 till _SIG_MAXSIG are valid,
both bounds inclusive.

Reviewed by:	davidxu
MFC after:	1 week
2012-03-26 17:05:26 +00:00
Joel Dahl
5b40a50e9a mdoc: remove empty lines. 2012-03-26 15:30:28 +00:00
Joel Dahl
61a0bf2af8 This string should be quoted.
Noticed by:	brueffer
2012-03-26 15:29:02 +00:00
Joel Dahl
c2965cd185 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
Joel Dahl
7226ab98cf Fix date. 2012-03-26 14:56:23 +00:00
Jean-Sébastien Pédron
7e3d5c1fca Use program exit status as pam_exec return code (optional)
pam_exec(8) now accepts a new option "return_prog_exit_status". When
set, the program exit status is used as the pam_exec return code. It
allows the program to tell why the step failed (eg. user unknown).
However, if it exits with a code not allowed by the calling PAM service
module function (see $PAM_SM_FUNC below), a warning is logged and
PAM_SERVICE_ERR is returned.

The following changes are related to this new feature but they apply no
matter if the "return_prog_exit_status" option is set or not.

The environment passed to the program is extended:
    o  $PAM_SM_FUNC contains the name of the PAM service module function
       (eg. pam_sm_authenticate).
    o  All valid PAM return codes' numerical values are available
       through variables named after the return code name. For instance,
       $PAM_SUCCESS, $PAM_USER_UNKNOWN or $PAM_PERM_DENIED.

pam_exec return code better reflects what went on:
    o  If the program exits with !0, the return code is now
       PAM_PERM_DENIED, not PAM_SYSTEM_ERR.
    o  If the program fails because of a signal (WIFSIGNALED) or doesn't
       terminate normally (!WIFEXITED), the return code is now
       PAM_SERVICE_ERR, not PAM_SYSTEM_ERR.
    o  If a syscall in pam_exec fails, the return code remains
       PAM_SYSTEM_ERR.

waitpid(2) is called in a loop. If it returns because of EINTR, do it
again. Before, it would return PAM_SYSTEM_ERR without waiting for the
child to exit.

Several log messages now include the PAM service module function name.

The man page is updated accordingly.

Reviewed by:	gleb@, des@
Sponsored by:	Yakaz (http://www.yakaz.com)
MFC after:	2 weeks
2012-03-26 12:18:15 +00:00
Joel Dahl
edf5bf9919 mdoc: document title should be all caps. 2012-03-25 19:34:05 +00:00
Joel Dahl
12afe06c06 Make sure sections are sorted into conventional order. 2012-03-25 16:00:56 +00:00
Joel Dahl
41949a1ed5 Remove superfluous paragraph macro. 2012-03-25 12:13:24 +00:00
Oleksandr Tymoshenko
e3a078dfed Update manual pages for MIPS-related CPUs:
- Rename pmc.mips to pmc.mips24k since it covers just one CPU,
    no whole architecture
- Add documetnations for Octeon's PMC counters
- Remove CAVEATS section from pmc.mips24k page: PMC for MIPS supports
    sampling now.
2012-03-25 02:22:32 +00:00
Joel Dahl
d284271a53 Minor mdoc fixes. 2012-03-24 15:17:18 +00:00
Oleksandr Tymoshenko
07d39325d6 Build libproc and librtld_db for MIPS 2012-03-24 05:18:27 +00:00
Stanislav Sedov
26ec46c8d6 - Avoid using deprecated heimdal functions in pam_krb5. 2012-03-24 01:02:03 +00:00
Oleksandr Tymoshenko
f2242861f8 Make libproc compilable for MIPS 2012-03-23 23:07:02 +00:00