dragonfly.git
12 years agoCCVER=gcc46: Minor tweaks for buildworld
John Marino [Sat, 28 Jan 2012 17:19:55 +0000 (18:19 +0100)]
CCVER=gcc46: Minor tweaks for buildworld

Currently WORLD_CCVER=gcc46 will break on gcc4.1, include/rpcsvc, and is
not recognized by libc.  This commit will fix that.  The nis.x fix is the
least understood as the gnatcpp seems not to like multiline macros when
used with rpcgen.

12 years agocustom cc script: Use gcc46's c++ library instead of base
John Marino [Sat, 4 Feb 2012 10:37:42 +0000 (11:37 +0100)]
custom cc script: Use gcc46's c++ library instead of base

There will be a slight performance hit with having to make two calls to
gnatc++ before every real call in order to use gnat-aux's c++ library
rather than the base systems gcc 4.4 c++ library.  The alternative is
hardcoding these values as a function of arch which is less appealing.

12 years agokernel: Remove the no longer functional APIC_IO option.
Sascha Wildner [Fri, 3 Feb 2012 13:13:20 +0000 (14:13 +0100)]
kernel: Remove the no longer functional APIC_IO option.

12 years agovkernel - Fix semi-random SIGILL crashes under heavy network loads
Matthew Dillon [Thu, 2 Feb 2012 23:17:44 +0000 (15:17 -0800)]
vkernel - Fix semi-random SIGILL crashes under heavy network loads

* SIGIO was being installed with SA_NODEFER, resulting in situations
  under heavy network loads where multiple SIGIOs could stack and cause
  a stack overflow.  This often resulted in the sendsig code in the kernel
  generating a SIGILL to the process after being unable to push a new
  signal context.

* Removing SA_NODEFER appears to solve the problem.

Reported-by: tuxillo
12 years agorconfig - Fix getopt options
Antonio Huete Jimenez [Thu, 2 Feb 2012 16:53:18 +0000 (17:53 +0100)]
rconfig - Fix getopt options

12 years agoLINT*: Add DEBUG_LOCKS_LATENCY.
Sascha Wildner [Thu, 2 Feb 2012 11:00:10 +0000 (12:00 +0100)]
LINT*: Add DEBUG_LOCKS_LATENCY.

12 years agokernel: Remove the obsolete SHMALL, SHMMAX and SHMMAXPGS options.
Sascha Wildner [Thu, 2 Feb 2012 10:44:47 +0000 (11:44 +0100)]
kernel: Remove the obsolete SHMALL, SHMMAX and SHMMAXPGS options.

In 6e2ab4bff5412f15d11ea4f8fb4a157de12432a8 we switched to autosizing
maximum shm pages along with a tunable to override.

12 years agokernel - Fix lockmgr lock mismatch panics when iwn used without wlan
Matthew Dillon [Thu, 2 Feb 2012 03:43:26 +0000 (19:43 -0800)]
kernel - Fix lockmgr lock mismatch panics when iwn used without wlan

* If if_iwn is ifconfig'd without going through wlan the wlan_serializer
  is not held during the firmware load stage, resulting in a panic.
  Acquire the serializer for this case.

* Note: iwn worked fine with wlan, but this fixes an annoying panic when
  people try to mess with it without wlan.

Reported-by: fxr (irc)
12 years agouname(1): Bring back CVS IDs except ours.
Sascha Wildner [Thu, 2 Feb 2012 02:23:54 +0000 (03:23 +0100)]
uname(1): Bring back CVS IDs except ours.

12 years agorconfig - LVM stripe script
Antonio Huete Jimenez [Wed, 1 Feb 2012 23:00:46 +0000 (00:00 +0100)]
rconfig - LVM stripe script

It uses lvm(8) facilities to install a DragonFly system in a
logical volume made of as many disk as you specify in the disk
list. It creates a swap partition and a /boot UFS filesystem
as it is required for proper operation.

12 years agosym(4): Sync with FreeBSD.
Sascha Wildner [Wed, 1 Feb 2012 22:36:39 +0000 (23:36 +0100)]
sym(4): Sync with FreeBSD.

This fixes disk detection issues in QEMU, among other things. It is also
available as a module now.

Tested-by: tuxillo
12 years agoLINT*: Fix some wrong paths in the comments.
Sascha Wildner [Wed, 1 Feb 2012 22:39:30 +0000 (23:39 +0100)]
LINT*: Fix some wrong paths in the comments.

12 years agokernel - Add missing DRM_LOCK()
Matthew Dillon [Wed, 1 Feb 2012 21:40:19 +0000 (13:40 -0800)]
kernel - Add missing DRM_LOCK()

* Add missing DRM_LOCK() in the i915 X11 ioctl path

Reported-by: Pierre Abbat
Dump-by: Magliano Andrea
12 years agoroute utils: Recognize IFT_CARP link layer address
Sepherosa Ziehau [Mon, 23 Jan 2012 15:00:11 +0000 (23:00 +0800)]
route utils: Recognize IFT_CARP link layer address

12 years agocarp: Make carp interfaces work like ethernet interfaces
Sepherosa Ziehau [Mon, 23 Jan 2012 08:19:06 +0000 (16:19 +0800)]
carp: Make carp interfaces work like ethernet interfaces

- Use ether_ifattach() instead of if_attach() to attach carp and carp's
  ioctl methed will fallback to ether_ioctl().
- VHID changes will be reflected into the carp's ethernet address.
- Reimplement carp output path.
  *  carp uses the parent's if_output() i.e. ether_output(), but passes
     the carp interface's ifp.
  *  The ether_output() is adjusted to detect the carp interface and
     switch to the carp's parent interface just before performing the
     real output.
  *  ARP resolve will use carp instead of its parent interface, thus
     the ARP output's source ethernet address and the sender hardware
     address are consistent and loopback on the carp will work as
     expected.
- Reimplement carp input path>
  *  Input interface will be changed to carp if the packet is destined
     to the carp's ethernet address.
  *  If the received packet is broadcast or multicast, all of the carps
     on the receiving interface will receive a copy of the packet.
- Fix up gratuitous ARP.
  *  No gratuitous ARP will be sent for carp upon IP address changes.
  *  Gratuitous ARP sent by carp use itself as interface not carp's
     parent interface.
- Fix up ARP input path.  Since ARP request is broadcast packet, parent
  interface of the carp will also receive the packet and will reply the
  ARP request.  If carp and its parent interface have same IP address,
  the parent's ARP reply will confuse the ARP requester: the ethernet
  address of the IP is no longer carp's ethernet address.
- Rework carp's prefix route addition and deletion.
  *  Add IP addresses to carp will not add prefix routes
  *  Bring carp interface up will not add prefix routes for carp's
     existing IP addresses
  *  Carp IP addresses prefix route will be added when carp is master,
     and the parent's corresponding IP addresses prefix route will be
     deleted.
  *  Carp IP addresses prefix route will be deleted when carp is no
     longer master and the parent's corresponding IP addresses prefix
     route will be added back.
- Handle carp parent interface's up/down events.
  *  When carp's parent is down, we fake up a parent IP address deletion
     event for carp.
  *  When carp's parent is up, we fake up a parent IP address addition
     event for carp.
- Stringent checks on CARP proto input path.
- Nullfy ifnet's serialier; carp is protected by global carp token.
- Mark CARP protocol MPSAFE

Idea-from: OpenBSD

12 years agokernel - Improve pageout daemon & memory pressure detection w/tmpfs
Matthew Dillon [Wed, 1 Feb 2012 04:52:46 +0000 (20:52 -0800)]
kernel - Improve pageout daemon & memory pressure detection w/tmpfs

* PG_NEED_COMMIT pages are unwired from the buffer cache they are now
  unconditionally placed on the active queue, even if 'activate' is not
  set.

* This results in non-freeable tmpfs pages remaining in the active queue
  most of the time.  They will be cycled into the inactive queue and flushed
  out if swap is present as per normal pageout daemon operation,

  When swap is not present or is full, these pages are reactivated
  unconditionally.

12 years agokernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag
Matthew Dillon [Wed, 1 Feb 2012 04:46:01 +0000 (20:46 -0800)]
kernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag

* Adjust tmpfs to use vm_page_need_commit() instead of redirtying VM
  pages in its strategy code.

* The new mechanism also allows the pageout daemon to act more naturally
  when flushing clean pages with PG_NEED_COMMIT set.

* May fix some tmpfs corruption issues

Reported-by: tuxillo
12 years agokernel - Add vm_page_need_commit() and vm_page_clear_commit()
Matthew Dillon [Wed, 1 Feb 2012 04:41:57 +0000 (20:41 -0800)]
kernel - Add vm_page_need_commit() and vm_page_clear_commit()

* Add vm_page_need_commit() and vm_page_clear_commit().  This controls the
  PG_NEED_COMMIT flag on individual VM pages.

  When set a clean VM page cannot be reused and is still subject to
  flushing by the pageout daemon.

* Refactor buwrite() to use the new mechanism instead of dirtying the
  pages underlying the buffer.

* This allows the normal page and buffer flushing mechanism to operate
  even in situations where the VM page is also the nominal backing store
  for the data (as in tmpfs).

* Will be used by tmpfs.

12 years agokernel - Fix incorrect assertion during udp auto-binding
Matthew Dillon [Tue, 31 Jan 2012 22:18:36 +0000 (14:18 -0800)]
kernel - Fix incorrect assertion during udp auto-binding

* When sendto() is used and the UDP socket is not bound the binding
  operation is done by the netisr thread and causes an assertion due
  to not being a process.

* The assertion is incorrect, remove it.  This only occured when lport has
  not been assigned and the cred check is only needed when it has.

Reported-by: Pierre Abbat
12 years agokern - Skip rlimit check when caller is a kernel thread.
Antonio Huete Jimenez [Mon, 30 Jan 2012 13:29:56 +0000 (14:29 +0100)]
kern - Skip rlimit check when caller is a kernel thread.

Pointed-out-by: vsrinivas
12 years agokernel/cryptodev: Remove useless zlib dependency.
Sascha Wildner [Tue, 31 Jan 2012 11:15:13 +0000 (12:15 +0100)]
kernel/cryptodev: Remove useless zlib dependency.

12 years agokernel: Allow zlib to build as a module.
Sascha Wildner [Tue, 31 Jan 2012 11:10:20 +0000 (12:10 +0100)]
kernel: Allow zlib to build as a module.

Submitted-by: CosmicDJ
12 years agocrypto.ko: Add a missing file.
Sascha Wildner [Tue, 31 Jan 2012 10:17:27 +0000 (11:17 +0100)]
crypto.ko: Add a missing file.

Submitted-by: CosmicDJ
12 years agolibc: correct copyright notice in makecontext.c
Markus Pfeiffer [Fri, 27 Jan 2012 21:59:06 +0000 (21:59 +0000)]
libc: correct copyright notice in makecontext.c

12 years ago<sys/param.h>: Oops, actually bump the version.
Sascha Wildner [Tue, 31 Jan 2012 09:29:20 +0000 (10:29 +0100)]
<sys/param.h>: Oops, actually bump the version.

12 years ago<sys/param.h>: Bump the version for i4b removal (had public headers).
Sascha Wildner [Tue, 31 Jan 2012 09:27:57 +0000 (10:27 +0100)]
<sys/param.h>: Bump the version for i4b removal (had public headers).

12 years agoCleanup ISDN remains via 'make upgrade'.
Sascha Wildner [Tue, 31 Jan 2012 09:22:49 +0000 (10:22 +0100)]
Cleanup ISDN remains via 'make upgrade'.

12 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Venkatesh Srinivas [Tue, 31 Jan 2012 05:18:17 +0000 (00:18 -0500)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

12 years agotmpfs: Support NFS export of tmpfs filesystems.
Venkatesh Srinivas [Tue, 31 Jan 2012 05:15:24 +0000 (00:15 -0500)]
tmpfs: Support NFS export of tmpfs filesystems.

* Implement vop_mountctl and MOUNTCTL_SET_EXPORT interfaces to allow mountd
  to export a tmpfs filesystem.

* Implement vfs_checkexp to allow NFS to function.

Closes: Bug 2277

12 years agocrypt(3)/blowfish - Return NULL on error
Samuel J. Greear [Tue, 31 Jan 2012 01:02:41 +0000 (18:02 -0700)]
crypt(3)/blowfish - Return NULL on error

* According to http://www.openwall.com/lists/oss-security/2011/11/15/3
  crypt(3) should probably not return ":" on error.

* Make crypt_blowfish() return NULL on error as per the crypt(3) manpage.

Submitted-by: Loganaden Velvindron <loganaden@gmail.com>
12 years agotoken.9: Put sections into conventional order.
Sascha Wildner [Mon, 30 Jan 2012 18:42:51 +0000 (19:42 +0100)]
token.9: Put sections into conventional order.

12 years agotoken.9: Start sentences on a new line and remove trailing whitespace.
Sascha Wildner [Mon, 30 Jan 2012 18:40:31 +0000 (19:40 +0100)]
token.9: Start sentences on a new line and remove trailing whitespace.

12 years agotoken.9: Add an MLINK for lwkt_gettoken_shared(9).
Sascha Wildner [Mon, 30 Jan 2012 18:39:55 +0000 (19:39 +0100)]
token.9: Add an MLINK for lwkt_gettoken_shared(9).

12 years agolibthread_xu: Unbreak the build.
Sascha Wildner [Mon, 30 Jan 2012 18:35:06 +0000 (19:35 +0100)]
libthread_xu: Unbreak the build.

12 years agolibthread_xu: Implement stub sem_open/sem_close/sem_unlink.
Venkatesh Srinivas [Mon, 30 Jan 2012 13:04:53 +0000 (08:04 -0500)]
libthread_xu: Implement stub sem_open/sem_close/sem_unlink.

The stub sem_open/sem_close/sem_unlink routines return ENOSYS; this is an
improvement over the default implementation, which returned 0 without doing
any work. libc_r already provided the stubs.

Closes: Bug #2285

12 years agoDocument shared tokens in token(9).
Venkatesh Srinivas [Mon, 30 Jan 2012 13:00:19 +0000 (08:00 -0500)]
Document shared tokens in token(9).

12 years agoRemove ISDN support. Tools, kernel code, manpages, examples, everything.
Sascha Wildner [Mon, 30 Jan 2012 11:35:22 +0000 (12:35 +0100)]
Remove ISDN support. Tools, kernel code, manpages, examples, everything.

We were the last to keep it (FreeBSD disconnected it in 2007 and removed
it in 2008).

Makefile_upgrade.inc will be updated later.

12 years agobinutils/ld: Don't add /usr/lib to the library search path twice.
Sascha Wildner [Mon, 30 Jan 2012 11:19:49 +0000 (12:19 +0100)]
binutils/ld: Don't add /usr/lib to the library search path twice.

The various toolchains we build during buildworld need different
search paths for various stages. The ${USRDATA_PREFIX} variable,
which has different values depending on the stage, is used as a
prefix so that the compilers we use to build our world can search
their includes and libraries in /usr/obj. For the compiler that
ultimately gets installed upon installworld, the prefix is empty.

In ld's Makefile, the correct path prefixed with ${USRDATA_PREFIX}
is already added to the default path a few lines above, so all is
good. This commit removes the extra /usr/lib that was unconditionally
added after the prefixed one (which is wrong).

12 years agocustom cc script: Fix "Unterminated quoted string" error
John Marino [Mon, 30 Jan 2012 07:48:20 +0000 (08:48 +0100)]
custom cc script: Fix "Unterminated quoted string" error

When updating gcc46 to handle c++ by default, the old quotation mark
was accidently left in place, causing a world build breakage at
include/rpc.

12 years agokernel: Add some missing headers to the Makefiles of cryptodev and tun.
Sascha Wildner [Sun, 29 Jan 2012 21:39:58 +0000 (22:39 +0100)]
kernel: Add some missing headers to the Makefiles of cryptodev and tun.

Reported-by: CosmicDJ on #dragonflybsd
12 years agotexinfo: Add /usr/pkg/info to the list of directories searched by info(1).
Sascha Wildner [Sun, 29 Jan 2012 21:15:31 +0000 (22:15 +0100)]
texinfo: Add /usr/pkg/info to the list of directories searched by info(1).

12 years agoasr(4): Sync with FreeBSD.
Sascha Wildner [Sun, 29 Jan 2012 15:13:13 +0000 (16:13 +0100)]
asr(4): Sync with FreeBSD.

Updates us to V1.10 which is mostly cleanup:

* Massive cleanup of the driver to remove dead code and non-conformant
  style.

* Removed most i386-specific code to make it more portable.

* Converted to the bus_space API.

Tested with an old ASR-2110S.

12 years agokernel - properly initialize vnode->v_pfsmp
Francois Tigeot [Sun, 29 Jan 2012 08:42:38 +0000 (09:42 +0100)]
kernel - properly initialize vnode->v_pfsmp

* add and rewrite comments to document it better

12 years agocustom cc script: add c++ support for gcc46 compiler
John Marino [Sat, 28 Jan 2012 16:34:57 +0000 (17:34 +0100)]
custom cc script: add c++ support for gcc46 compiler

12 years agocompilers.conf: Update default CXX path for gcc46
John Marino [Sat, 28 Jan 2012 15:36:28 +0000 (16:36 +0100)]
compilers.conf: Update default CXX path for gcc46

lang/gnat-aux builds the languages c, c++, obj-c, fortran, and Ada
by default.  Its now reasonable to have the default CXX value for
gcc46 point to gnatc++.

12 years agoMerge branch 'master' of /repository/git/dragonfly
Venkatesh Srinivas [Sat, 28 Jan 2012 03:47:08 +0000 (19:47 -0800)]
Merge branch 'master' of /repository/git/dragonfly

12 years agoRevert "sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it"
Thomas Nikolajsen [Sat, 28 Jan 2012 01:04:27 +0000 (02:04 +0100)]
Revert "sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it"

This reverts commit dbcbcaa29ebe161b19b6cec288c1a8559aebc0a0.

12 years agoCOMPAT_LINUX: Remove need for COMPAT_43
Thomas Nikolajsen [Sat, 28 Jan 2012 00:59:37 +0000 (01:59 +0100)]
COMPAT_LINUX: Remove need for COMPAT_43

Implement linux_sethostname and linux_ostat natively to
stop using implementation from COMPAT_43.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2289>
Submitted-by: Samuel J. Greear and Matt Dillon
12 years agokernel -- nata: Use ATA_DEFAULT_TIMEOUT (10) rather than 1 for ATA controlcmds.
Venkatesh Srinivas [Fri, 27 Jan 2012 10:55:15 +0000 (02:55 -0800)]
kernel -- nata: Use ATA_DEFAULT_TIMEOUT (10) rather than 1 for ATA controlcmds.

A one-second timeout for control commands was inappropriate for
SET TRANSFER MODE/ENABLE RCACHE/ENABLE WCACHE on spun-down WD Caviar Greens,
among others.

12 years agolast(1)/sort(1): Remove __RCSID().
Sascha Wildner [Fri, 27 Jan 2012 09:55:09 +0000 (10:55 +0100)]
last(1)/sort(1): Remove __RCSID().

12 years agosys/config: Readd COMPAT_DF12 to i386 kernels, to run FreeBSD 4 binaries
Thomas Nikolajsen [Thu, 26 Jan 2012 22:58:05 +0000 (23:58 +0100)]
sys/config: Readd COMPAT_DF12 to i386 kernels, to run FreeBSD 4 binaries

Commit ce6b2144 made this change to GENERIC,
do the same for the other i386 kernels.

12 years agosys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it
Thomas Nikolajsen [Thu, 26 Jan 2012 22:52:53 +0000 (23:52 +0100)]
sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2289>

12 years agolibc: add getcontext, setcontext, makecontext and swapcontext on x86_64
Markus Pfeiffer [Wed, 25 Jan 2012 13:11:23 +0000 (13:11 +0000)]
libc: add getcontext, setcontext, makecontext and swapcontext on x86_64

The *context functions are not part of the POSIX standard anymore, but
are still used by quite some packages.

12 years agodrm - Add PCI ID for Radeon HD 4250 (AMD 880 onboard video)
Samuel J. Greear [Thu, 26 Jan 2012 04:39:34 +0000 (21:39 -0700)]
drm - Add PCI ID for Radeon HD 4250 (AMD 880 onboard video)

12 years agoRevert "Remove mergemaster(8)."
Sascha Wildner [Wed, 25 Jan 2012 18:35:25 +0000 (19:35 +0100)]
Revert "Remove mergemaster(8)."

This reverts commit 650094e10aa76969d99d60b3e506b55e4e2bf5fc.

It is still being used by people.

I thought mergemaster was only useful in conjunction with maintained
CVS IDs. Should have known about its -s option.

Requested-by: pavalos
12 years agoRemove mergemaster(8).
Sascha Wildner [Wed, 25 Jan 2012 18:05:05 +0000 (19:05 +0100)]
Remove mergemaster(8).

12 years agokget.8: Rewrite it a bit and fix some mdoc stuff.
Sascha Wildner [Wed, 25 Jan 2012 09:24:08 +0000 (10:24 +0100)]
kget.8: Rewrite it a bit and fix some mdoc stuff.

12 years agoRevert "nataraid(4): Add devstat support."
Sascha Wildner [Wed, 25 Jan 2012 08:05:46 +0000 (09:05 +0100)]
Revert "nataraid(4): Add devstat support."

This reverts commit 3e184884618d66845f8b90e6dae483155da6dce6.

Oops, it was a bit too untested and causes nasty messages on the
console. Will investigate and commit a proper fix.

Reported-by: Joerg Anslik <joerg@anslik.de>
12 years agokernel - Fix SILI callout timer race
Matthew Dillon [Mon, 23 Jan 2012 20:55:33 +0000 (12:55 -0800)]
kernel - Fix SILI callout timer race

* Do similar fix for SILI that we did for AHCI.

* callout_stop_sync() can block.  If this occurs a race can cause a
  CCB to be processed for completion twice.

* Add a serial number to detect this situation.

* If the serial number does not match after the timeout is stopped
   we don't want to mess with the xa at all.

Tested-by: lentferj
12 years agokernel: Use bioq_takefirst() in a few more places.
Sascha Wildner [Mon, 23 Jan 2012 13:20:14 +0000 (14:20 +0100)]
kernel: Use bioq_takefirst() in a few more places.

12 years agoldscript.*: sync with FreeBSD
John Marino [Sun, 22 Jan 2012 19:09:11 +0000 (20:09 +0100)]
ldscript.*: sync with FreeBSD

12 years agocsu: Add .note.ABI-tag and .note.GNU-stack
John Marino [Mon, 23 Jan 2012 00:21:15 +0000 (01:21 +0100)]
csu: Add .note.ABI-tag and .note.GNU-stack

For all arches except sparc, gcc emits the section directive for the
following struct with a PROGBITS type.  However, newer versions of binutils
(after 2.16.90) require the section to be of NOTE type, to guarantee that
the .note.ABI-tag section correctly ends up in the first page of the final
executable.

Unfortunately, there is no clean way to tell gcc to use another section
type, so this C file (or the C file that includes it) must be compiled in
multiple steps:

- Compile the .c file to a .s file.
- Edit the .s file to change the 'progbits' type to 'note', for the section
  directive that defines the .note.ABI-tag section.
- Compile the .s file to an object file.

These steps are done in the invididual Makefiles for each applicable arch.

Taken-from: FreeBSD SVN 217375 (13 JAN 2011)

On i386 crtn.S:
Keep the stack aligned to a 16 byte boundary when calling init functions
so that we don't cause a bus error if they start storing SSE math stuff
on the stack.

Taken-from: FreeBSD SVN 146369 (19 MAY 2005)

12 years agoelf: Add translation function between vm_prot_t and p_flags
John Marino [Sat, 21 Jan 2012 19:48:38 +0000 (20:48 +0100)]
elf: Add translation function between vm_prot_t and p_flags

No functionality added, just refactors code.  This will be useful if
stack protection is implemented in the future.

12 years agoman rtld: add -fPIC flag to _rtld_functrace example
John Marino [Sat, 21 Jan 2012 22:28:57 +0000 (23:28 +0100)]
man rtld: add -fPIC flag to _rtld_functrace example

12 years agortld: Add STT_GNU_IFUNC and R_MACHINE_IRELATIVE_GNU support
John Marino [Sat, 21 Jan 2012 23:00:15 +0000 (00:00 +0100)]
rtld: Add STT_GNU_IFUNC and R_MACHINE_IRELATIVE_GNU support

Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to
rtld. This adds runtime bits neccessary for the use of the dispatch
functions from the dynamically-linked executables and shared libraries.

To allow use of external references from the dispatch function, resolution
of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries
for PLT are prepared, and normal resolution of the GOT entries is finished.
Similar to how it is done by GNU, IRELATIVE relocations are resolved in
advance, instead of normal lazy handling for PLT.

Taken-from:
FreeBSD SVN 228435 (12 DEC 2011)
FreeBSD SVN 228503 (14 DEC 2011)
FreeBSD SVN 229508 (04 JAN 2012)

12 years agortld: Use DAGS for symbol lookup; adjust weak symbol logic
John Marino [Sat, 21 Jan 2012 21:35:24 +0000 (22:35 +0100)]
rtld: Use DAGS for symbol lookup; adjust weak symbol logic

get_program_var_addr() must prefer the strong symbol to the weak one.
Search global objects, together with main object and dependencies for the
requested symbol.

Move the common code from symlook_default() into new helper
symlook_global(), and use it both in symlook_global() and
get_program_var_addr().  Supply lock state to get_program_var_addr().

Taken-from: FreeBSD SVN 217223 (10 JAN 2011)

Eliminate the use of symlook_needed function in favor of DAGS.  Place
elements on DAG lists in breadth-first order. This allows us to walk
pre-built list in all cases where breadth-first dependency chain
enumeration is required.

Fix dlsym on special handle obtained by dlopen(NULL, ...) to do what
comment claims it does. Take advantage of recently added symlook_global
function to iterate over main objects and global DAGs lists properly in
search of a symbol. Since rtld itself provides part of the global
namespace, search rtld_obj too.

Remove recursion from init_dag and symlook_needed functions. Use
symlook_needed for ELF filtee processing only and change lookup order
used in the function to match the order used by Solaris runtime linker
under same circumstances. While there, fix weak symbol handling in the
loop so that we return the first weak symbol definition if no strong one
was found, instead of the last one.

Taken-from: FreeBSD SVN 218051 (28 JAN 2011)

12 years agortld: Add stubs to support PT_GNU_STACK
John Marino [Sat, 21 Jan 2012 20:53:12 +0000 (21:53 +0100)]
rtld: Add stubs to support PT_GNU_STACK

This functionality requires kernel support to determine the initial stack
access mode.  This is how it's supposed to work:

If the loaded DSO requires an executable stack as specified by the PF_X
bit or p_flags on PT_GNU_STACK phdr, yet the current stack protection does
not permit execution: The map_stacks_exec function should change the
stack protection mode of all thread stacks.

The PT_GNU_STACK phdr parser has been implemented as well as a private
interface to _rtld_get_stack_prot() in order to export the stack access
mode calculated by rtld.

Left to do:
1) Implement stack protection in the kernel
2) Add PT_GNU_STACK functionality in the kernel
3) Add a method to change stack protection mode in libc or libthread
4) Implement map_stacks_exec function in rtld.

12 years agortld: Implement ELF filters (DT_FILTER and DT_AUXILIARY)
John Marino [Sat, 21 Jan 2012 17:31:30 +0000 (18:31 +0100)]
rtld: Implement ELF filters (DT_FILTER and DT_AUXILIARY)

Filtrees are loaded on demand unless LD_LOADFLTR environment variable is
set or -z loadfltr was specified during the linking.  This forces rtld
to upgrade read-locked rtld_bind_lock to write lock when it encounters an
object with filter during symbol lookup.

Consolidate common arguments of the symbol lookup functions in the SymLook
structure.

Taken-from: FreeBSD SVN 216728 (27 DEC 2010)

12 years agortld: Remove useless arch Makefiles
John Marino [Sat, 21 Jan 2012 21:02:15 +0000 (22:02 +0100)]
rtld: Remove useless arch Makefiles

The ability to build an executable dynamic linker was previously removed
from the main makefile, so uncommenting LDSCRIPT in the arch Makefile
would no longer work even if the elf_rtld.x files were put in the arch
directory.  To avoid confusion, these optional Makefiles have been
completely removed.

12 years agortld: Make thread-safe by replacing libc printf functions
John Marino [Sat, 21 Jan 2012 15:07:30 +0000 (16:07 +0100)]
rtld: Make thread-safe by replacing libc printf functions

The dynamic linker is linked with the specially built static pic libc to
get some C runtime services such as printf().  Unfortunately, the
multithread-safeness measures in libc do now work in the rtld environment.

The dynlinker now uses FreeBSD's kernel printf() implementation instead of
libc's version.  This printf does not require any shared global data and
thus is mt-safe.  This commit replaces printf() and related functions with
rtld_ versions, and also removes calls to err(3).

Currently stdio is still pulled from libc within the libmap implementation
that uses fopen().  This is safe, yet not optimal, and is a candidate for
future change.

The makefile was cleaned up to remove the unused bits to building an
executable dynlinker and also require gnu99.

Taken-from: FreeBSD SVN 225152

12 years agortld: Set foundation to use aux vectors to get osreldate
John Marino [Sat, 21 Jan 2012 13:13:17 +0000 (14:13 +0100)]
rtld: Set foundation to use aux vectors to get osreldate

__getosreldate isn't used by rtld currently.  The FreeBSD dynamic linker
does use it indirectly in libc's mmap wrapper.  The capability is included
here both to ease the task to synchronizing with FreeBSD, and to quickly
obtain the capability in the future if necessary.  It's currently disabled
with the undefined ENABLE_OSRELDATE macro.

The splitting of digest_dynamic required to use aux vectors also has the
benefit of avoiding the use of malloc at startup.

12 years agortld: Compress FreeBSD CVSIDs
John Marino [Sat, 21 Jan 2012 11:08:45 +0000 (12:08 +0100)]
rtld: Compress FreeBSD CVSIDs

The FreeBSD repository is still handled by CVS, but its converted to
Subversion and from that, git.  Neither the svn nor git version feature
expanded $FreeBSD$ tags.  The only way to get this is to pull directly
from CVS which isn't convenient.

In the case of a few files, the only difference between the DragonFly
version and the FreeBSD version is the CVS tag.  As the main development
of rtld is happening on FreeBSD and since I've started collaborating
with FreeBSD developers on new dynamic linker features, we want to
actively keep our linkers synchronized.  Compressing the FreeBSD CVSID
tags makes that easier for me, the only person currently maintaining
the dynamic linker.  The usually-wrong expanded CVS tag wasn't providing
any useful information to me either.

12 years agortld: Remove unused xrealloc function
John Marino [Sat, 21 Jan 2012 10:52:42 +0000 (11:52 +0100)]
rtld: Remove unused xrealloc function

xrealloc was added back in the prebind support days, but wasn't removed
when the resident executable support that replaced it arrived back in
2004.

12 years agoUnbreak buildworld due to the libpcap import.
Peter Avalos [Mon, 23 Jan 2012 08:30:48 +0000 (00:30 -0800)]
Unbreak buildworld due to the libpcap import.

12 years agocarp: Use ifq_set_maxlen() to set send queue's max length
Sepherosa Ziehau [Mon, 23 Jan 2012 03:45:01 +0000 (11:45 +0800)]
carp: Use ifq_set_maxlen() to set send queue's max length

While im here, clean up white space and indentation

12 years agoMerge branch 'master' of /home/www-data/gitweb/dragonfly
Peter Avalos [Mon, 23 Jan 2012 03:07:23 +0000 (19:07 -0800)]
Merge branch 'master' of /home/www-data/gitweb/dragonfly

12 years agoUpdate files for tcpdump-4.2.1 import.
Peter Avalos [Mon, 23 Jan 2012 03:05:13 +0000 (19:05 -0800)]
Update files for tcpdump-4.2.1 import.

12 years agoMerge branch 'vendor/TCPDUMP'
Peter Avalos [Mon, 23 Jan 2012 01:25:22 +0000 (17:25 -0800)]
Merge branch 'vendor/TCPDUMP'

12 years agoImport tcpdump-4.2.1.
Peter Avalos [Mon, 23 Jan 2012 01:08:25 +0000 (17:08 -0800)]
Import tcpdump-4.2.1.

See the CHANGES files for the details.

12 years agokernel/firewire: Move a dereference behind the NULL check.
Sascha Wildner [Mon, 23 Jan 2012 00:55:44 +0000 (01:55 +0100)]
kernel/firewire: Move a dereference behind the NULL check.

12 years agokernel/netgraph: Put parentheses around a SLIST_EMPTY().
Sascha Wildner [Mon, 23 Jan 2012 00:23:46 +0000 (01:23 +0100)]
kernel/netgraph: Put parentheses around a SLIST_EMPTY().

12 years agoUpdate files for libpcap-1.2.1 import.
Peter Avalos [Mon, 23 Jan 2012 00:23:29 +0000 (16:23 -0800)]
Update files for libpcap-1.2.1 import.

Reduce diffs from the vendor source.
Reorganize Makefile to make it ordered like the vendor's.

12 years agobktr(4): Fix some mistakes in #ifdef'd code.
Sascha Wildner [Mon, 23 Jan 2012 00:16:15 +0000 (01:16 +0100)]
bktr(4): Fix some mistakes in #ifdef'd code.

12 years agoMerge branch 'vendor/LIBPCAP'
Peter Avalos [Mon, 23 Jan 2012 00:08:22 +0000 (16:08 -0800)]
Merge branch 'vendor/LIBPCAP'

12 years agoImport libpcap-1.2.1.
Peter Avalos [Sun, 22 Jan 2012 19:00:07 +0000 (11:00 -0800)]
Import libpcap-1.2.1.

Look at CHANGES for the details.

12 years agokernel: Remove a variable that was just used for a sizeof.
Sascha Wildner [Sun, 22 Jan 2012 23:14:47 +0000 (00:14 +0100)]
kernel: Remove a variable that was just used for a sizeof.

12 years agolibc: Clean up fmemopen.
Venkatesh Srinivas [Sun, 22 Jan 2012 23:04:49 +0000 (18:04 -0500)]
libc: Clean up fmemopen.

* Remove private definition of min().

* Switch to use bcopy() for fmemopen_write.

12 years agoRaise default .Os value for the manual pages to 3.1 on master.
Sascha Wildner [Sun, 22 Jan 2012 22:42:25 +0000 (23:42 +0100)]
Raise default .Os value for the manual pages to 3.1 on 

12 years agoSwitch to pkgsrc-2011Q4.
Justin C. Sherrill [Sun, 22 Jan 2012 22:36:21 +0000 (17:36 -0500)]
Switch to pkgsrc-2011Q4.

12 years agokernel: Nuke the old (and deprecated) ata(4) driver and atacontrol(8). v3.1.0
Sascha Wildner [Sun, 22 Jan 2012 21:16:14 +0000 (22:16 +0100)]
kernel: Nuke the old (and deprecated) ata(4) driver and atacontrol(8).

It's been replaced by nata(4)/natacontrol(8) since more than 4 years.

12 years agoMerge branch 'master' of file:///repository/git/dragonfly
Justin C. Sherrill [Sun, 22 Jan 2012 21:06:31 +0000 (13:06 -0800)]
Merge branch 'master' of file:///repository/git/dragonfly

12 years agoShifting master to 3.1.
Justin C. Sherrill [Sun, 22 Jan 2012 21:05:45 +0000 (13:05 -0800)]
Shifting master to 3.1.

12 years agodloader: Remove some unused variables.
Sascha Wildner [Sun, 22 Jan 2012 21:01:40 +0000 (22:01 +0100)]
dloader: Remove some unused variables.

12 years agocrontab(1): Adjust the number of comment lines in front of the tab.
Sascha Wildner [Sun, 22 Jan 2012 20:26:41 +0000 (21:26 +0100)]
crontab(1): Adjust the number of comment lines in front of the tab.

In 229cb57b2cbab37a8a0cc1499cebf7e9c9e1deec I removed the third line
of comment that crontab(1) puts in front of the tab file (which was
the CVS ID of crontab.c), but I forgot to adjust the #define saying
how much lines to skip.

This led to the first line of comment written by the user not being
visible in crontab -e.

Reported-by: lentferj
12 years agofwcontrol(8): Remove an unused variable and raise WARNS to 2.
Sascha Wildner [Sun, 22 Jan 2012 19:35:23 +0000 (20:35 +0100)]
fwcontrol(8): Remove an unused variable and raise WARNS to 2.

12 years agokernel/acpi: Fix a reference to an uninitialized ptr.
Sascha Wildner [Sun, 22 Jan 2012 12:29:29 +0000 (13:29 +0100)]
kernel/acpi: Fix a reference to an uninitialized ptr.

12 years agosendfile: Block or return EAGAIN, iff we are really short of space
Sepherosa Ziehau [Sun, 22 Jan 2012 13:59:30 +0000 (21:59 +0800)]
sendfile: Block or return EAGAIN, iff we are really short of space

Send sockbuf's lowat could be quite "high" (hiwat/2), the originally
code actually only uses 1/2 of the send sockbuf space, thus poor
performance.

12 years agosockbuf: Pre-alloc sockbuf space, so asynchronized pru_send could be used.
Sepherosa Ziehau [Sun, 22 Jan 2012 13:29:29 +0000 (21:29 +0800)]
sockbuf: Pre-alloc sockbuf space, so asynchronized pru_send could be used.

When doing asynchronized pru_send, it is quite possible that we could
break the send sockbuf's upper limit, if we only use ssb_space() to
calculate the remaining sockbuf space.

Now, we add another two counters into sockbuf, when we send a mbuf
chain to the netisr, we update the these two counters to reflect how
much mbufs will be pending on the send sockbuf.  When calculating the
remaining space of the send sockbuf we also take these two counters
into consideration, so we will not break the upper limit of the send
sockbuf.  These two counter will also be updated when the mbufs in
the sockbuf is to be dropped/freed.

Reenable the asynchronized pru_send in sendfile and sosendtcp

12 years agopru_send: Disable asynchornized pru_send usage by default
Sepherosa Ziehau [Sun, 22 Jan 2012 09:36:07 +0000 (17:36 +0800)]
pru_send: Disable asynchornized pru_send usage by default

It may cause problem, e.g. too many mbufs sitting in the TCP send buffer,
when facing with certain attacks, e.g. FIN_WAIT_1 DoS.

Reported-by: pavalos@
12 years agosendfile: Add sysctl to disable the usage of the asynchronized pru_send
Sepherosa Ziehau [Sun, 22 Jan 2012 09:33:08 +0000 (17:33 +0800)]
sendfile: Add sysctl to disable the usage of the asynchronized pru_send