Commit Graph

14045 Commits

Author SHA1 Message Date
Baptiste Daroussin
a9e4a4780a Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwd
while here, fix missing parentheses of the return statement of pw_make.

Approved by:	des (mentor)
2012-01-05 10:40:24 +00:00
Ed Schouten
19c262fe87 Change index() and rindex() to a weak alias.
This allows people to still write statically linked applications that
call strchr() or strrchr() and have a local variable or function called
index.

Discussed with:	bde@
2012-01-05 10:32:53 +00:00
Pedro F. Giffuni
83057baf15 Quiet down clang -Werror.
Reported by:	Pawel Worach
Approved by:	jhb (mentor)
2012-01-04 20:05:38 +00:00
Fabien Thomas
ba89031aea Update PMC events from October 2011 Intel documentation.
Submitted by:	Davide Italiano <davide.italiano@gmail.com>
MFC after:	3 days
2012-01-04 07:58:36 +00:00
Xin LI
6fe5169cff Document the fact that chroot(2) is no longer part of POSIX since SUSv3
and add a SECURITY CONSIDERATIONS section for recommended practices.
2012-01-04 02:04:20 +00:00
Pedro F. Giffuni
4c995944af Integrate the line drawing algorithm from the book "Graphic Gems 1".
http://www.graphicsgems.org/

At the time it claimed to be 3-4 times faster than the traditional
algorithm.

PR:		18769
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-01-03 19:47:32 +00:00
Ed Schouten
b3608ae18f Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
2012-01-03 18:51:58 +00:00
Ed Schouten
46632c18bd Merge index() and strchr() together.
As I looked through the C library, I noticed the FreeBSD MIPS port has a
hand-written version of index(). This is nice, if it weren't for the
fact that most applications call strchr() instead.

Also, on the other architectures index() and strchr() are identical,
meaning we have two identical pieces of code in the C library and
statically linked applications.

Solve this by naming the actual file strchr.[cS] and let it use
__strong_reference()/STRONG_ALIAS() to provide the index() routine. Do
the same for rindex()/strrchr().

This seems to make the C libraries and static binaries slightly smaller,
but this reduction in size seems negligible.
2012-01-03 07:14:01 +00:00
Dimitry Andric
f8f33f6ab6 In several llvm library Makefiles, remove extraneous slashes at the end
of SRCDIR definitions.

MFC after:	3 days
2012-01-01 18:36:42 +00:00
Nathan Whitehorn
3f922e14a3 Instead of forcing -O1 on PowerPC for LLVM and clang, fix the actual
problem by adding -fno-strict-aliasing to CFLAGS. Since this is a global
issue that just happened to manifest on PowerPC, add this to CFLAGS
unconditionally.

MFC after:	1 week
2012-01-01 15:56:15 +00:00
Ed Schouten
7686ff743c Upgrade libcompiler_rt to upstream revision 147390.
This version of libcompiler_rt adds support for __mulo[sdt]i4(), which
computes a multiply and its overflow flag. There are also a lot of
cleanup fixes to headers that don't really affect us.

Updating to this revision should make it a bit easier to contribute
changes back to the LLVM developers.
2011-12-31 19:01:48 +00:00
Ed Schouten
219fb04889 Import compiler-rt r147390. 2011-12-31 14:55:23 +00:00
Dimitry Andric
b9b670e347 Add some additional const poison after r228972. The 'mapping' array in
lib/libc/gen/strtofflags.c became const, but gcc did not warn about
assigning its members to non-const pointers.  Clang warned about this
with:

lib/libc/gen/strtofflags.c:98:12: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types]
                        for (sp = mapping[i].invert ? mapping[i].name :
                                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed by:	jilles
2011-12-30 20:41:24 +00:00
Robert Watson
719728bf11 Fix typo in Makefile comment.
MFC after:	3 days
2011-12-30 10:45:00 +00:00
Jilles Tjoelker
8c87e0405a libc: Eliminate some relative relocations in file flags table. 2011-12-29 22:15:18 +00:00
Sergey Kandaurov
5f09751fe3 Fix manual section for acl_get(3) and mac_get(3) family functions.
Reviewed by:	rwatson
MFC after:	1 week
2011-12-29 21:12:22 +00:00
Jilles Tjoelker
5b7aa0fc6e libc: Eliminate some relative relocations in getusershell(). 2011-12-27 23:35:10 +00:00
Jilles Tjoelker
571eea83bb libc: Eliminate some relative relocations in setlocale(). 2011-12-27 23:28:01 +00:00
Ed Schouten
6d57c75097 Add locally implemented atomic intrinsics to libcompiler_rt.
The built-in atomic operations are not implemented in our version of GCC
4.2 for the ARM and MIPS architectures. Instead of emitting locked
instructions, they generate calls to functions that can be implemented
in the C runtime.

Only implement the atomic operations that are used by <stdatomic.h> for
datatype sizes that are supported by atomic(9). This means that on these
architectures, we can only use atomic operations on 32-bits and 64-bits
variables, which is typically sufficient.

This makes <stdatomic.h> work on all architectures except MIPS, since
MIPS and SPARC64 still use libgcc. Converting these architectures to
libcompiler_rt is on my todo list.
2011-12-27 22:13:51 +00:00
Xin LI
b0266169d4 Update rtprio(2) manual page to reflect the latest changes in -CURRENT as
well as provide documentation for rtprio_thread(2) system call.

MFC after:	1 month
X-MFC-after:	r228470
2011-12-27 10:34:00 +00:00
Ed Schouten
fc6f0665ba Add libstdthreads.
This library implements the C11 threads interface on top of the pthreads
library.  As discussed on the lists, the preferred way to implement
this, is as a separate library.

It is unlikely that these functions will be used a lot in the future. It
would have been easier if the C11 working group standardized (a subset
of) pthreads and clock_nanosleep(). Having it as a separate library
allows the embedded people to omit it from their system.

Discussed on:	arch@, threads@
2011-12-26 21:51:53 +00:00
Glen Barber
bd45f5676d Add missing opening and closing brackets in getopt_long.3 and getsubopt.3
to make the examples reflect reality more closely.

MFC after:	1 week
X-MFC-After:	9.0-RELEASE
2011-12-26 03:14:37 +00:00
Justin Hibbits
7b25dcca76 Implement hwpmc counting PMC support for PowerPC G4+ (MPC745x/MPC744x).
Sampling is in progress.

Approved by:	nwhitehorn (mentor)
MFC after:	9.0-RELEASE
2011-12-24 19:34:52 +00:00
Colin Percival
3e65b9c6e6 Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]

Fix a buffer overflow in telnetd. [11:08]

Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]

Add sanity checking of service names in pam_start. [11:10]

Approved by:    so (cperciva)
Approved by:    re (bz)
Security:       FreeBSD-SA-11:06.bind
Security:       FreeBSD-SA-11:07.chroot
Security:       FreeBSD-SA-11:08.telnetd
Security:       FreeBSD-SA-11:09.pam_ssh
Security:       FreeBSD-SA-11:10.pam
2011-12-23 15:00:37 +00:00
Guy Helmer
6890d15663 Handle malloc failures in yplib.c.
PR:		bin/83349
2011-12-23 02:13:42 +00:00
Guy Helmer
53fc6e1e4d Handle failures to malloc memory to hold key or val copies.
PR:		bin/83348
2011-12-23 01:56:25 +00:00
Ed Schouten
cb301c1a81 Add placeholder code for prepending pathnames to tftp.
At work we have a single tftp server that provides installation data for
a variety of operating systems. I'd rather place our FreeBSD-related
files in a subdirectory, instead of the root.

It would be nice if this setting could be run-time configurable, but at
least in our specific case, this is not possible, as pxeboot is
chainloaded through pxelinux.

Sponsored by:	Kumina bv
2011-12-22 09:36:37 +00:00
Martin Matuska
45d3b226a6 Use contrib sources for building libarchive, tar and cpio.
Make "make test" fully operational.

MFC after:	2 weeks
2011-12-22 08:42:07 +00:00
Eitan Adler
855291741d - Fix style(9) bugs in glob.c
Approved by:	jilles
2011-12-20 22:56:44 +00:00
Eitan Adler
0d6d372c03 - Add restrict keyword to glob(3)
PR:		kern/161958
Submitted by:	Henning Petersen <henning.petersen@t-online.de>
Approved by:	jilles
MFC after:	3 days
2011-12-20 22:56:13 +00:00
Martin Matuska
05d8f68a62 Sync libarchive with vendor branch release/2.8:
3730:
Fix issue 174 (Windows path names, not relevant for FreeBSD)

3734:
Merge r1989: archive_clear_error should set errno to 0.

3735:
Merge r3247 from trunk: Clear errors before returning
from archive_read_support_format_all()

3799:
Check the position before dereferencing the pointer.
This avoids dereferencing one byte past the end of a string

3824:
Merge r3823 from trunk for issue 199 (hang in iso9660 reading)

Obtained from:	http://code.google.com/p/libarchive
MFC after:	2 weeks
2011-12-20 20:34:02 +00:00
Martin Matuska
f6ccfb42a2 Update libarchive, tar and cpio to version 2.8.5
The following additional vendor revisions are applied:

Revision 3740:
Use archive_clear_error() to clear the error markers.

Obtained from:	http://code.google.com/p/libarchive
MFC after:	2 weeks
2011-12-20 20:06:33 +00:00
Martin Matuska
f873e4d1bd Merge vendor revision 3723:
Fixes extraction of Zip entries that use length-at-end without specifying
either the compressed or uncompressed length.  In particular, fixes bsdtar
extraction of such files.

Obtained from:	http://code.google.com/p/libarchive
Reported by:	Patrick Lamaiziere <patfbsd@davenulle.org> (freebsd-stable@)
MFC after:	1 week
2011-12-20 20:02:07 +00:00
Alexander V. Chernikov
07d7b74b81 Add binding support to libradius(3).
Submitted by:    Sergey Matveychuk <sem33@yandex-team.ru>
Approved by:     ae (mentor)
MFC after:       2 weeks
2011-12-20 11:13:44 +00:00
Dag-Erling Smørgrav
7f106882fe Upgrade to OpenPAM Lycopsida. 2011-12-18 17:22:45 +00:00
Dag-Erling Smørgrav
432a3b2760 Vendor import of OpenPAM Lycopsida. 2011-12-18 17:08:40 +00:00
Michael Tuexen
5dc6a81580 Address warnings found by clang.
MFC after: 3 months.
2011-12-17 14:55:19 +00:00
Dimitry Andric
9e277ed8bf Fix typos in the comments about clang warnings in several
sendmail-related Makefiles.

Spotted by:	arundel
MFC after:	1 week
2011-12-16 17:02:25 +00:00
Dimitry Andric
7be5a1fbf4 In lib/libthread_db/arch/i386/libpthread_md.c, clang gives two incorrect
warnings about alignment, so turn -Wcast-align off for now.

MFC after:	1 week
2011-12-16 15:00:56 +00:00
Gleb Smirnoff
08b68b0e4c A major overhaul of the CARP implementation. The ip_carp.c was started
from scratch, copying needed functionality from the old implemenation
on demand, with a thorough review of all code. The main change is that
interface layer has been removed from the CARP. Now redundant addresses
are configured exactly on the interfaces, they run on.

The CARP configuration itself is, as before, configured and read via
SIOCSVH/SIOCGVH ioctls. A new prefix created with SIOCAIFADDR or
SIOCAIFADDR_IN6 may now be configured to a particular virtual host id,
which makes the prefix redundant.

ifconfig(8) semantics has been changed too: now one doesn't need
to clone carpXX interface, he/she should directly configure a vhid
on a Ethernet interface.

To supply vhid data from the kernel to an application the getifaddrs(8)
function had been changed to pass ifam_data with each address. [1]

The new implementation definitely closes all PRs related to carp(4)
being an interface, and may close several others. It also allows
to run a single redundant IP per interface.

Big thanks to Bjoern Zeeb for his help with inet6 part of patch, for
idea on using ifam_data and for several rounds of reviewing!

PR:		kern/117000, kern/126945, kern/126714, kern/120130, kern/117448
Reviewed by:	bz
Submitted by:	bz [1]
2011-12-16 12:16:56 +00:00
Dimitry Andric
df5eee43c7 Unfortunately, clang gives a warning about sendmail code that cannot be
turned off yet.  Since this is contrib code, and we don't really care
about the warnings, just turn make them non-fatal for now.

MFC after:	1 week
2011-12-16 00:39:44 +00:00
Dimitry Andric
562fc14bc9 In lib/libpmc/libpmc.c, struct pmc_cputype_map's pm_cputype field should
be of type 'enum pmc_cputype', not 'enum pmc_class'.

MFC after:	1 week
2011-12-16 00:13:43 +00:00
Dimitry Andric
7a692f29c2 In lib/libipsec/policy_token.l, use lex's standard "%option noinput"
instead of hand-defining the YY_NO_INPUT macro.

MFC after:	1 week
2011-12-16 00:01:19 +00:00
Dimitry Andric
ff3f429dea Define YY_NO_INPUT in lib/libipsec/policy_token.l, so lex's input()
function does not get defined needlessly.

MFC after:	1 week
2011-12-15 23:22:24 +00:00
Baptiste Daroussin
1926f2f6fa Modify pw_copy:
- if pw is NULL and oldpw is not NULL then the oldpw is deleted
- if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid
then it renames the user

add new gr_* functions so now gr_util API is similar to pw_util API,
this allow to manipulate groups in a safe way.

Reviewed by:	des
Approved by:	des
MFC after:	1 month
2011-12-15 22:07:36 +00:00
Dimitry Andric
e7ac9483a9 Since clang does not support the tls_model attribute used in malloc.c
yet (see LLVM PR 9788), and warns about it, rub it out for now.  When
clang grows support for this attribute, I will revert this again.

MFC after:	1 week
2011-12-15 20:40:11 +00:00
Dimitry Andric
51907e6434 In lib/libc/rpc/crypt_client.c, fix a clang warning about an implicit
conversion between enum desdir/desmode from include/rpc/des.h, and enum
desdir/desmode from include/rpcsvc/crypt.x.  These are actually
different enums, with different value names, but by accident the integer
representation of the enum values happened to be the same.

MFC after:	1 week
2011-12-15 20:27:36 +00:00
Dimitry Andric
477433d829 Remove meaningless self-assignment in res_send.c, otherwise clang will
warn about it.  I guess this was originally done to silence a bogus
warning by an older version of gcc, but I could not reproduce it with
any version of gcc that I have access to.

MFC after:	1 week
2011-12-15 20:10:12 +00:00
Dimitry Andric
b34d83a709 The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific
versions of pthread_md.h have a special case of dereferencing a null
pointer.  Clang warns about this with:

In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
        return (TCB_GET32(tcb_self));
                ^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
            : "m" (*(u_int *)(__tcb_offset(name))));            \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'

Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.

Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.

MFC after:	1 week
2011-12-15 19:42:25 +00:00
Michael Tuexen
539bb45a7f Fix a bug where sctp_sendmdg() uses uninitialized memory.
MFC after: 3 days.
2011-12-15 12:35:03 +00:00