Commit Graph

149353 Commits

Author SHA1 Message Date
Brian Somers
887ff31f06 When ``ppp -direct'' is invoked by a program that uses pipe(2) to
create stdin and stdout, don't blindly try to use stdin as a bi-directional
channel.  Instead, detect the pipe and set up a special exec handler
that indirects write() calls through stdout.

This fixes the problem where ``set device "!ssh -e none host ppp
-direct label"'' no longer works with an openssh-5.2 server side as
that version of openssh ignores the USE_PIPES config setting and
*always* uses pipes (rather than socketpair) for stdin/stdout channels.

MFC after:	3 days
2009-08-24 17:19:45 +00:00
Brian Somers
c5e246d446 When realloc()ing device memory for transfer to another ppp process,
don't continue to use the realloc()d pointer - it might have changed!

Remove some stray diagnostics while I'm here.

MFC after:	3 days
2009-08-24 17:18:17 +00:00
Bjoern A. Zeeb
89ffc202d6 Fix handling of .note.ABI-tag section for GNU systems [1].
Handle GNU/Linux according to LSB Core Specification 4.0,
Chapter 11. Object Format, 11.8. ABI note tag.

Also check the first word of desc, not only name, according to
glibc abi-tags specification to distinguish between Linux and
kFreeBSD.

Add explicit handling for Debian GNU/kFreeBSD, which runs
on our kernels as well [2].

In {amd64,i386}/trap.c, when checking osrel of the current process,
also check the ABI to not change the signal behaviour for Linux
binary processes, now that we save an osrel version for all three
from the lists above in struct proc [2].

These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
and Linux binaries on the same machine again for at least i386 and
amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).

PR:		kern/135468
Submitted by:	dchagin [1] (initial patch)
Suggested by:	kib [2]
Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
Reviewed by:	kib
MFC after:	3 days
2009-08-24 16:19:47 +00:00
Alexander Leidinger
20cb1f56a9 - Update config to doxygen 1.5.2 (I use this with 1.5.9).
- Add linprocfs and linsysfs to the linuxulator dox.
- Take the generated includes from the .m files from a subdirectory
  instead of putting everything into $(.OBJDIR). This imporves the
  human readbility of the source directory contents a lot, if you do not
  create a separate OBJDIR.
- Assume UTF-8 encoding for every input file.
- Strip the source and dest path from the output, we are not interested
  in the absolute location on the machine where the docs are created,
  relative the the root of the FreeBSD source is what interests us.
- Exclude .svn directories.
- Switch to alphabetic index.
- Use one line per INCLUDE_PATH member in the common dox-config.
- Bump the __FreeBSD__ version to 9.		[MFC: to 8]
- Switch from hardcoded .m files to an run-time generated one. Takes
  a little bit more time to get started with actual work, but at least
  is more future-proof. If you generate dox for all subsystems, the
  time to find all .m files in the source is magnitutes lower than
  producing the docs.
- Make the *DEST_PATH overidable from the environment. This allows to
  produce the output directly in the docroot of a webserver.
- Fix the path when telling the user where he can find the API docs.

MFC after:	1 month (after 8.0)
2009-08-24 13:10:55 +00:00
Robert Watson
8e937462f4 Make if_grow static -- it's not used outside of if.c, and with the
internals destined to change, it's better if it remains that way.

MFC after:	3 days
2009-08-24 12:52:05 +00:00
Michael Tuexen
24ae5c4a73 This fixes a bug where the value set by SCTP_PARTIAL_DELIVERY_POINT
was not honored, if the socket buffer size was not 4 times that large.

Approved by: rrs (mentor)
MFC after: 3 days.
2009-08-24 11:46:40 +00:00
Ed Schouten
00ee13a0af Our implementation of granpt(3) could be valid in the future.
When I wrote the pseudo-terminal driver for the MPSAFE TTY code, Robert
Watson and I agreed the best way to implement this, would be to let
posix_openpt() create a pseudo-terminal with proper permissions in place
and let grantpt() and unlockpt() be no-ops.

This isn't valid behaviour when looking at the spec. Because I thought
it was an elegant solution, I filed a bug report at the Austin Group
about this. In their last teleconference, they agreed on this subject.
This means that future revisions of POSIX may allow grantpt() and
unlockpt() to be no-ops if an open() on /dev/ptmx (if the implementation
has such a device) and posix_openpt() already do the right thing.

I'd rather put this in the manpage, because simply mentioning we don't
comply to any standard makes it look worse than it is. Right now we
don't, but at least we took care of it.

Approved by:	re (kib)
MFC after:	3 days
2009-08-24 11:16:44 +00:00
Randall Stewart
0fa753b3fb This fixes two bugs in the NR-Sack code:
1) When calculating the table offset for sliding the sack
    array, the two byte values must be "ored" together in order
    for us to do the correct sliding of the arrays.
 2) We were NOT properly doing CC and other changes to things only
    NR-Sacked. The solution here is to make a separate function that
    will actually do both CC/updates and free things if its NR sack'd.
    This actually shrinks out common code from three places (much better).

MFC after:	3 days
2009-08-24 11:13:32 +00:00
Ed Schouten
2992abe047 Allow multiple console devices per driver without insane code duplication.
Say, a driver wants to have multiple console devices to pick from, you
would normally write down something like this:

	CONSOLE_DRIVER(dev1);
	CONSOLE_DRIVER(dev2);

Unfortunately, this means that you have to declare 10 cn routines,
instead of 5. It also isn't possible to initialize cn_arg on beforehand.

I noticed this restriction when I was implementing some of the console
bits for my vt(4) driver in my newcons branch. I have a single set of cn
routines (termcn_*) which are shared by all vt(4) console devices.

In order to solve this, I'm adding a separate consdev_ops structure,
which contains all the function pointers. This structure is referenced
through consdev's cn_ops field.

While there, I'm removing CONS_DRIVER() and cn_checkc, which have been
deprecated for years. They weren't used throughout the source, until the
Xen console driver showed up. CONSOLE_DRIVER() has been changed to do
the right thing. It now declares both the consdev and consdev_ops
structure and ties them together. In other words: this change doesn't
change the KPI for drivers that used the regular way of declaring
console devices.

If drivers want to use multiple console devices, they can do this as
follows:

	static const struct consdev_ops mydriver_cnops = {
		.cn_probe	= mydriver_cnprobe,
		...
	};
	static struct mydriver_softc cons0_softc = {
		...
	};
	CONSOLE_DEVICE(cons0, mydriver_cnops, &cons0_softc);
	static struct mydriver_softc cons1_softc = {
		...
	};
	CONSOLE_DEVICE(cons1, mydriver_cnops, &cons1_softc);

Obtained from:	//depot/user/ed/newcons/...
2009-08-24 10:53:30 +00:00
Marko Zec
0cb8b6a9b7 When "jail -c vnet" request fails, the current code actually creates and
leaves behind an orphaned vnet.  This change ensures that such vnets get
released.

This change affects only options VIMAGE builds.

Submitted by:	jamie
Discussed with:	bz
Approved by:	re (rwatson), julian (mentor)
MFC after:	3 days
2009-08-24 10:16:19 +00:00
Marko Zec
52db6805ea When moving ifnets from one vnet to another, and the ifnet
has ifaddresses of AF_LINK type which thus have an embedded
if_index "backpointer", we must update that if_index backpointer
to reflect the new if_index that our ifnet just got assigned.

This change affects only options VIMAGE builds.

Submitted by:	bz
Reviewed by:	bz
Approved by:	re (rwatson), julian (mentor)
2009-08-24 10:14:09 +00:00
Marko Zec
0348c661d1 Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet
context inside the RPC code.

Temporarily set td's cred to mount's cred before calling socreate() via
__rpc_nconf2socket().

Submitted by:	rmacklem (in part)
Reviewed by:	rmacklem, rwatson
Discussed with:	dfr, bz
Approved by:	re (rwatson), julian (mentor)
MFC after:	3 days
2009-08-24 10:09:30 +00:00
Marko Zec
2b73aacaf9 Introduce a div_destroy() function which takes over per-vnet cleanup tasks
from the existing modevent / MOD_UNLOAD handler, and register div_destroy()
in protosw as per-vnet .pr_destroy() handler for options VIMAGE builds.  In
nooptions VIMAGE builds, div_destroy() will be invoked from the modevent
handler, resulting in effectively identical operation as it was prior this
change.  div_destroy() also tears down hashtables used by ipdivert, which
were previously left behind on ipdivert kldunloads.

For options VIMAGE builds only, temporarily disable kldunloading of ipdivert,
because without introducing additional locking logic it is impossible to
atomically check whether all ipdivert instances in all vnets are idle, and
proceed with cleanup without opening a race window for a vnet to open an
ipdivert socket while ipdivert tear-down is in progress.

While here, staticize div_init(), because it is not used outside of
ip_divert.c.

In cooperation with:	julian
Approved by:	re (rwatson), julian (mentor)
MFC after:	3 days
2009-08-24 10:06:02 +00:00
Marko Zec
d57425ab65 When registering a protocol to an existing protocol domain via
pf_proto_register(), iterate over all existing vnets to call protosw_init()
and thus the appropriate .pr_init() handler in the context of each vnet.
NB in the future we probably want to separate pr_init() handlers into
two, i.e. per-vnet and global, functions.

This change has no impact on nooptions VIMAGE builds.

Approved by:	re (rwatson), julian (mentor)
MFC after:	3 days
2009-08-24 10:03:41 +00:00
Ed Schouten
daf4075a30 Unhardcode 0x100 inside kbdcontrol.
In preparation for Unicode support for the keyboard layer, we'd better
get rid of all the hardcoded 0x100/0xff constants in kbdcontrol.
Instead, add a flag called SPECIAL stored in the top bit of the integer.

Adding Unicode support is very simple now; just change u_char map[] to
u_int map[] in keyent_t, change the bounds checking in kbdcontrol to
0x1FFFFF and modify the ioctls to allow loading these new keymaps.
2009-08-24 09:17:01 +00:00
Ed Schouten
416b15e41e Cleanups to the Xen console driver:
- Use CONSOLE_DRIVER() instead of the deprecated CONS_DRIVER() declaration.

- This means we cannot use cn_checkc anymore, which is supposed to do
  the same as cn_getc nowadays. Remove the cn_getc implementation (that
  was never being called) and rename cn_checkc to cn_getc.

- Don't run-time patch cn_putc, but add the logic to xc_cnputc().

This means I could do some cleanups to our console code...

Tested by:	nobody on hackers@
2009-08-24 08:27:42 +00:00
Alfred Perlstein
cb18f7d12b - Patch to allow USB controller to resume operation after
being polled.

         - Remove the need for Giant from the USB HUB driver.

         - Leave device unconfigured instead of disabling the USB port
           when Huawei Autoinstall disk detection triggers. This should
           fix problems that the Huawei device is not detected after
           Autoinstall eject is issued.
         - Reported by: Nikolay Antsiferov

         - Fix memory use after free race for USB character devices.
         - Reported by: Lucius Windschuh

         - Factor out the enumeration lock into three functions to make the
         coming newbus lock conversion more easy.
          - usbd_enum_lock
          - usbd_enum_unlock
          - usbd_enum_is_locked

Submitted by:	hps
2009-08-24 05:05:38 +00:00
Alfred Perlstein
a5508450dc Remove redundant locking.
Submitted by:	hps
2009-08-24 05:03:59 +00:00
Alfred Perlstein
f2db024fe6 Add a reminder comment to optimize bus_dmamap_sync calls.
Submitted by:	hps
2009-08-24 05:03:30 +00:00
Alfred Perlstein
77c33ae7cc Add mass storage quirks.
PR:             usb/137138,usb/137226,usb/137789,usb/135372

Submitted by:	hps
2009-08-24 05:02:36 +00:00
Alfred Perlstein
40675d1a70 - fix uvisor support, mostly correct buffer sizes used.
- correct device info flag for SONY Cli NR70V

Reported by: Marc Fonvieille
Submitted by:	hps
2009-08-24 05:01:40 +00:00
Alfred Perlstein
ec1201a2c9 - Fix false positive uipaq probe
Reported by: Alexander Motin <mav@freebsd.org>

Submitted by:	hps
2009-08-24 05:01:06 +00:00
Alfred Perlstein
9739167c64 - fix CDC ethernet matching order so that the match flags get correct.
Reported by: Juergen Lock

Submitted by:	hps
2009-08-24 05:00:33 +00:00
Alfred Perlstein
069f9a8bd6 We used force all of the GPIO pins low first and then
enable the ones we want. This has been changed to better
match the ADMtek's reference design to avoid setting the
power-down configuration line of the PHY at the same time
it is reset.

Submitted by:	John Hood via hps
2009-08-24 05:00:07 +00:00
Alfred Perlstein
03a7d05c2d - FIFO's are always opened separately in read and write
direction even if the actual device is opened for read and
        write. Fix fflags check so that the UFM and URIO drivers work.
Reported by: Krassimir Slavchev

Submitted by:	hps
2009-08-24 04:59:09 +00:00
Alfred Perlstein
247549d145 - patch for cordump slowdown. Avoid using DELAY(1000) when no
keys are pressed.
        - Reported by: Various people

        - add sysctl to disable keyboard led control request
        - Reported by: Yoshihiro Ota

        - Save system CPU usage: Patch to stop keyboard timer when no
        keys are pressed.

Submitted by:	hps
MFC after:	3 days
2009-08-24 04:58:42 +00:00
Alfred Perlstein
34b4872224 - allow disabling "root_mount_hold()" by
setting a sysctl/tunable at boot
        - remove some redundant initial explore code

Submitted by:	hps
2009-08-24 04:58:11 +00:00
Alfred Perlstein
f24b6817d6 Remove redundant Giant reference. Giant will be dropped
automatically when the mutex argument is NULL.

Reported by: Various people
Submitted by: hps
2009-08-24 04:57:48 +00:00
Ken Smith
521bb8f319 Oops. Needed to adjust a little bit more of the line for packages-8-stable
now that we're prepping for 8.0's release.

Submitted by:	pluknet at gmail dot com
Pointy hat:	kensmith
2009-08-24 03:04:13 +00:00
Olivier Houchard
7c4e421f76 KDB needs <machine/db_machdep.h>, so move it under #ifdef KDB.
While I'm there, remove dead code, we will never support acorn26.
2009-08-23 23:37:53 +00:00
Jilles Tjoelker
eb33e843b8 sh: Fix crash when undefining or redefining a currently executing function.
Add a reference count to function definitions.
Memory may leak if multiple SIGINTs arrive in interactive mode,
this will be fixed later by changing SIGINT handling.

PR:		bin/137640
2009-08-23 21:09:46 +00:00
Robert Watson
6852110b64 Rather than using IFNET_RLOCK() when iterating over (and modifying) the
ifnet list during if_ef load, directly acquire the ifnet_sxlock
exclusively.  That way when if_alloc() recurses the lock, it's a write
recursion rather than a read->write recursion.

This code structure is arguably a bug, so add a comment indicating that
this is the case.  Post-8.0, we should fix this, but this commit
resolves panic-on-load for if_ef.

Discussed with:	bz, julian
Reported by:	phk
MFC after:	3 days
2009-08-23 21:00:21 +00:00
Robert Watson
77dfcdc445 Rework global locks for interface list and index management, correcting
several critical bugs, including race conditions and lock order issues:

Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an
sxlock.  Either can be held to stablize the lists and indexes, but both
are required to write.  This allows the list to be held stable in both
network interrupt contexts and sleepable user threads across sleeping
memory allocations or device driver interactions.  As before, writes to
the interface list must occur from sleepable contexts.

Reviewed by:	bz, julian
MFC after:	3 days
2009-08-23 20:40:19 +00:00
Ed Schouten
bfdaa52382 Allow pty(4) to be loaded as a kld.
Unfortunately, the wrappers that are present in pts(4) don't have the
mechanics to allow pty(4) to be unloaded safely, so I'm forcing this kld
to return EBUSY. This also means we have to enable some extra code in
pts(4) unconditionally.

Proposed by:	rwatson
2009-08-23 20:26:09 +00:00
Olivier Houchard
562c5c5bf0 No need to remove the same flag multiple times. 2009-08-23 19:54:36 +00:00
Doug Barton
6913541fe4 Prior to the dire warning about values of network_interfaces other than
AUTO the biggest mistake users made was leaving lo0 off the list. Since
lo0 is effectively mandatory, check for it and add it to the list if
it's not there.
2009-08-23 19:52:47 +00:00
Antoine Brodin
01318abc57 ObsoleteFiles.inc:
kthread_create(9) was resurrected as a mlink to kproc(9)
2009-08-23 18:28:58 +00:00
Ivan Voras
43ec3cc665 Remove (c) line.
Requested by:	pjd
Approved by:	gnn (mentor)
MFC after:	1 month
2009-08-23 18:15:13 +00:00
Hajimu UMEMOTO
d429d7201e - Add AS lookup functionality to traceroute6(8) as well.
- Support for IPv6 transport for AS lookup.
- Introduce $RA_SERVER to set whois server.
- Support for 4 byte ASN.
- ANSIfy function declaration in as.c.

Tested by:	IHANet folks.
2009-08-23 17:00:16 +00:00
Simon L. B. Nielsen
2f1ff7669c Merge DTLS fixes from vendor-crypto/openssl/dist:
- Fix memory consumption bug with "future epoch" DTLS records.
- Fix fragment handling memory leak.
- Do not access freed data structure.
- Fix DTLS fragment bug - out-of-sequence message handling which could
  result in NULL pointer dereference in
  dtls1_process_out_of_seq_message().

Note that this will not get FreeBSD Security Advisory as DTLS is
experimental in OpenSSL.

MFC after:	1 week
Security:	CVE-2009-1377 CVE-2009-1378 CVE-2009-1379 CVE-2009-1387
2009-08-23 16:29:47 +00:00
Sam Leffler
41fe1fab16 Enable _DIRENT_HAVE_D_TYPE so wpa_cli scans directories properly
for it's unix domain socket.  Before this change wpa_cli would take
the first file in the directory that was not "." or "..".

Submitted by:	Brandon Gooch <jamesbrandongooch@gmail.com>
MFC after:	3 days
2009-08-23 16:04:10 +00:00
Robert Noland
e1ec1f53b1 Add GET_PARAM support for Z pipes.
This is needed for occulsion queries on rv530 chips.

MFC after:	2 weeks
2009-08-23 15:02:58 +00:00
Robert Noland
f588a0bda5 Add kernel support for Radeon R6/7xx 3D.
You will still need Mesa from git and possibly an updated DDX driver,
but this is working fairly well now.

MFC after:	2 weeks
2009-08-23 14:55:57 +00:00
Joseph Koshy
dd1259dafb Use a more appropriate choice of words.
Submitted by:	danfe
2009-08-23 14:48:25 +00:00
Simon L. B. Nielsen
f0c2a617df Import DTLS fix from upstream OpenSSL 0.9.8 branch:
Fix DTLS fragment bug - out-of-sequence message handling which could
result in NULL pointer dereference in
dtls1_process_out_of_seq_message().

Note that this will not get FreeBSD Security Advisory as DTLS is
experimental in OpenSSL.

Security:	CVE-2009-1387
Obtained from:	OpenSSL CVS
		http://cvs.openssl.org/chngview?cn=17958
2009-08-23 14:39:15 +00:00
Robert Noland
fe173b46fd Add a read only sysctl tracking the hw.drm.msi tunable.
MFC after:	2 weeks
2009-08-23 14:33:12 +00:00
Robert Noland
2418baa339 Clean up the handling of device minors
Submitted by:	Ed
MFC after:	2 weeks
2009-08-23 14:31:20 +00:00
Robert Noland
f21c255c2a Clean up the locking in drm_alloc_resource()
MFC after:	2 weeks
2009-08-23 14:27:46 +00:00
Simon L. B. Nielsen
58c74b7534 Import DTLS fix from upstream OpenSSL 0.9.8 branch:
Do not access freed data structure.

Note that this will not get FreeBSD Security Advisory as DTLS is
experimental in OpenSSL.

Security:	CVE-2009-1379
Obtained from:	OpenSSL CVS
		http://cvs.openssl.org/chngview?cn=18156
2009-08-23 14:15:28 +00:00
Simon L. B. Nielsen
f8f8fb827d Import DTLS fix from upstream OpenSSL 0.9.8 branch:
Fix fragment handling memory leak.

Note that this will not get FreeBSD Security Advisory as DTLS is
experimental in OpenSSL.

Security:	CVE-2009-1378
Obtained from:	OpenSSL CVS
		http://cvs.openssl.org/filediff?f=openssl/ssl/d1_both.c&v1=1.4.2.13&v2=1.4.2.15
2009-08-23 14:12:01 +00:00