Commit Graph

156713 Commits

Author SHA1 Message Date
Andriy Gapon
676799a00d completely ignore zero-sized elf sections in modules of elf object type (amd64)
Current code doesn't check size of elf sections and may perform needless
actions of zero-sized memory allocation and similar.
The bigger issue is that alignment requirement of a zero-sized section
gets effectively applied to the next section if it has smaller alignment
requirement.  But other tools, like gdb and consequently kgdb,
completely ignore zero-sized sections and thus may map symbols to
addresses differently.

Zero-sized sections are not typical in general.
Their typical (only, even) cause in FreeBSD modules is inline assembly that
creates custom sections which is found in pcpu.h and vnet.h.  Mere inclusion
of one of those header files produces a custom section in elf output.
If there is no actual use for the section in a given module, then the
section remains empty.

Better solution is to avoid creating zero-sized sections altogether,
which is in plans.

Preloaded modules are handled in boot code (load_elf_obj.c), while
dynamically loaded modules are handled by kernel (link_elf_obj.c).

Based on code by:	np
MFC after:		3 weeks
2010-07-23 17:07:51 +00:00
Andriy Gapon
dac509311f cpufreq: allocate long-lived buffer for handling of sysctl requests
At present the cpufreq sysctl handler for current level setting would
allocate and deallocate a temporary buffer of 24KB even to handle a
read-only query.  This puts unnecessary load on memory subsystem when
current level is checked frequently, e.g. when the likes of powerd
and system monitoring software are running.
Change the strategy to allocating a long-lived buffer for handling the
requests.

Reviewed by:	njl
MFC after:	2 weeks
2010-07-23 16:46:42 +00:00
Kirk McKusick
5ee561ee3e Note that foreground fsck should be run after a filesystem related panic.
Suggested by:   Mikhail Teterin (mi@)
MFC after:      1 week
2010-07-23 14:35:51 +00:00
Ivan Voras
984c64736c Make lorunningspace catch up with hirunningspace.
While there, add comment about the magic numbers.

Prodded by:	alc
2010-07-23 12:30:29 +00:00
Konstantin Belousov
5f270659fd Crypto(4) driver for AESNI.
The aeskeys_{amd64,i386}.S content was mostly obtained from OpenBSD,
no objections to the license from core.

Hardware provided by:	Sentex Communications
Tested by:	fabient, pho (previous versions)
MFC after:	1 month
2010-07-23 11:00:46 +00:00
Andrey V. Elsukov
959059ef9e Document that SI unit suffixes are supported for -b and -s options
of add verb. Mention about maximum size limit for "freebsd-boot"
partition. It should be smaller than 545 KB (hardcoded in pmbr).
Show usage of SI unit suffixes in example.

Approved by:	mav (mentor)
MFC after:	1 week
2010-07-23 11:00:43 +00:00
Brian Somers
318a43da85 Add a -S switch to override the default syslog pid file. This can be useful
if syslogd's -P switch or a syslogd alternative is being used.

MFC after:	3 weeks
2010-07-23 09:11:47 +00:00
Alexander Motin
a6cca5d8a1 Add some comments. 2010-07-23 08:20:14 +00:00
Alexander Motin
44d1534122 Update MIPS timer code (except RMI) to utilize new MI event timer
infrastructure.

Reviewed by:	neel
2010-07-23 07:46:55 +00:00
Andrey V. Elsukov
733a9e2783 Prevent access after free to table entry in case when
user deletes partition that not yet created (changes doesn't
committed to disk).

PR:		148687
Approved by:	mav (mentor)
MFC after:	7 days
2010-07-23 06:30:01 +00:00
Martin Matuska
2bacd082bd Enable fake resolving of SMB RIDs by using nulldomain and UID_NOBODY
- fixes panics when Solaris/OpenSolaris pools that contain files
uploaded with the SMB protocol are accessed

Enable seting/unsetting the sharesmb property (dummy action)
- allows users who import pools from Solaris/Opensolaris to unset
the sharesmb property and get rid of annoying messages

PR:		kern/145778, kern/148709
Approved by:	pjd, delphij (mentor)
MFC after:	7 weeks
2010-07-22 23:30:24 +00:00
Andrew Turner
6fc08f19a6 Add the s3c24x0 real time clock driver
Approved by:	imp (mentor)
2010-07-22 23:23:39 +00:00
Andrew Turner
6eae6892da Rework how device memory is allocated on the s3c24x0 CPU's.
The device virtual addresses are now able to be allocated at runtime rather
than from the static pmap_devmap at boot. The only exception is memory
required before we have had a chance to dynamically allocate it.

While here reduce the space between the statically allocated devices by
reducing the distance between the virtual addresses.

Approved by:	imp (mentor)
2010-07-22 23:12:19 +00:00
Rui Paulo
6f450d8e09 Fix previous commit: don't remove the WERROR definition when using
clang.

Submitted by:	Dimitry Andric <dimitry at andric.com>
Reviewed by:	jkim
2010-07-22 21:31:35 +00:00
Weongyo Jeong
0f3801fa37 Fixes a mistake to calculate CALC_COEFF2() value that tmp[3] is
used even if it's unreachable.

PR:		kern/144505
Submitted by:	Henning Petersen <henning.petersen at t-online dot de>
MFC after:	1 week
2010-07-22 20:08:02 +00:00
Gabor Kovesdan
cf62d79aa8 - Regenerate after adding WITH_GNU_GREP 2010-07-22 19:30:13 +00:00
Gabor Kovesdan
ade4363774 - Bump __FreeBSD_version for BSD grep import
Approved by:	delphij (mentor)
2010-07-22 19:15:26 +00:00
Gabor Kovesdan
4dc88ebedf Add BSD grep to the base system and make it our default grep.
Deliverables: Small and clean code (1,4 KSLOC vs GNU's 8,5 KSLOC),
              lower memory usage than GNU grep, GNU compatibility,
              BSD license.

TODO:         Performance is somewhat behind GNU grep but it is only
              significant for bigger searches.  The reason is complex, the
              most important factor is that GNU grep uses lots of
              optimizations to improve the speed of the regex library.
              First, we need a modern regex library (practically by adopting
              TRE), add support for GNU-style non-standard regexes and then
              reevalute the performance issues and look for bottlenecks.  In
              the meantime, for those, who need better performance, it is
              possible to build GNU grep by setting WITH_GNU_GREP.

Approved by:            delphij (mentor)
Obtained from:          OpenBSD (http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/grep/),
                        freegrep (http://github.com/howardjp/freegrep)
Sponsored by:           Google SoC 2008
Portbuild tests run by: kris, pav, erwin
Acknowledgements to:    fjoe (as SoC 2008 mentor),
                        everyone who helped in reviewing and testing
2010-07-22 19:11:57 +00:00
Rui Paulo
582a734e13 Build clang libraries by default with -fno-exceptions and with
-fno-rtti. The clang libaries that really use exceptions and virtual
functions can enable LLVM_REQUIRES_EH and LLVM_REQUIRES_RTTI
respectively. This saves space on the resulting binaries and follows
what's being done upstream.

Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-07-22 19:09:34 +00:00
Rui Paulo
7d54a05ac8 Correctly setup LDADD with regards to libstand. The submitter points
out that "on amd64, libstand.a is compiled for i386, but is still installed
under ${WORLDTMP}/usr/lib instead of ${WORLDTMP}/usr/lib32.  Even if it
would be installed there, ld on amd64 is set up incorrectly with a
${TOOLS_PREFIX}/usr/lib/i386 default path, so it wouldn't link.  The reason
it does link under gcc is that gcc passes -L${WORLDTMP}/usr/lib twice,
even for -m32 builds, which is also incorrect, but accidentally works in
this case."

Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-07-22 18:57:47 +00:00
Rui Paulo
247cd15268 Make these files compile with clang.
Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-07-22 18:52:29 +00:00
Rui Paulo
fcfec2f998 Disable building libobjc with clang as it's not yet supported.
Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-07-22 18:49:27 +00:00
Rui Paulo
3cc97e66ad Handle a few corner cases for clang like we did with icc. These should
reduce the number of warnings seen while building the kernel.

Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-07-22 18:47:41 +00:00
Jung-uk Kim
82040afcf3 Fix an obvious typo from r1.1. We were acquiring an exclusive writer lock
regardless of the given flags.

MFC after:	3 days
2010-07-22 18:44:40 +00:00
Kirk McKusick
90104f5413 Note that foreground fsck should be run after a filesystem related panic.
Suggested by:	Mikhail Teterin (mi@)
MFC after:	1 week
2010-07-22 18:33:10 +00:00
Rebecca Cran
1bc5b32ccb If a size suffix isn't entered, just use the value entered. This fixes
a bug caused by r209235 where entering a number of blocks after
previously entering a size in MB/GB would result in the size of the
previous partition being used.

PR:	bin/148266
Submitted by:	jpaetzel
Approved by:	rrs (mentor)
2010-07-22 17:35:36 +00:00
Matthew D Fleming
033459c8f1 Remove unused variable that snuck in during development.
Approved by:    zml (mentor)
2010-07-22 17:23:43 +00:00
Matthew D Fleming
242ed5d96c Fix taskqueue_drain(9) to not have false negatives. For threaded
taskqueues, more than one task can be running simultaneously.

Also make taskqueue_run(9) static to the file, since there are no
consumers in the base kernel and the function signature needs to change
with this fix.

Remove mention of taskqueue_run(9) and taskqueue_run_fast(9) from the
taskqueue(9) man page.

Reviewed by:    jhb
Approved by:    zml (mentor)
2010-07-22 16:41:09 +00:00
Simon L. B. Nielsen
74d53216ac Hook newsyslog regression tests to the Makefile 'build'.
MFC after:	3 weeks
2010-07-22 11:38:48 +00:00
Simon L. B. Nielsen
0f68c374aa Add regression tests for newsyslog. These are far from a complete
test of newsyslog, as they were mainly made to test 'newsyslog -t',
but they do test the basic functionality.

The test 'framework' was based on dds@'s code in
src/tools/regression/bin/mv/.

Note that currently these tests are not fully correct for the
non-timestamp based rotation case, as it seems like newsyslog actually
by default keeps a file too much around.

MFC after:	3 weeks
2010-07-22 11:37:54 +00:00
Simon L. B. Nielsen
872e964d07 Add support for creating the archived log filenames using a time-stamp
instead of the traditional simple counter.

Using the time-stamp based file-names, once a log file is archived, it
will not change name until it is deleted.  This means that many backup
systems will only perform one backup of the archived log file, instead
for performing a new backup of the logfile upon each logfile rotation.

This implementation is separate from the patches in the mentioned PR,
as I wasn't aware of the existence of the PR until after I had
implemented the same functionality as the patches in the PR provide.
Unlike the PR, this new code does honor the 'log count' in
newsyslog.conf so old logfiles are deleted.  This new code does not
currently support never deleting the archived logfiles.

PR:		bin/29363
MFC after:	3 weeks
2010-07-22 11:23:18 +00:00
Jaakko Heinonen
f4e7c5a894 Convert md(4) to use alloc_unr(9) and alloc_unr_specific(9) for unit
number allocation. The old approach had some problems such as it allowed
an overflow to occur in the unit number calculation.

PR:		kern/122288
2010-07-22 10:24:28 +00:00
Konstantin Belousov
e2b801ddd9 Verify return value of the sigset manipulation functions
to catch invalid signal numbers [1]. Use consistent style of
not assigning the return value to a local variable.

Reported by:	Garrett Cooper <yanegomi gmail com> [1]
MFC after:	1 week
2010-07-22 09:14:18 +00:00
Konstantin Belousov
87d45a0392 When compat32 binary asks for the value of hw.machine_arch, report the
name of 32bit sibling architecture instead of the host one. Do the
same for hw.machine on amd64.

Add a safety belt debug.adaptive_machine_arch sysctl, to turn the
substitution off.

Reviewed by:	jhb, nwhitehorn
MFC after:	2 weeks
2010-07-22 09:13:49 +00:00
Pawel Jakub Dawidek
1a517c3ec5 Actually, only the fullsync mode is implemented, not memsync mode.
Correct manual page.

MFC after:	3 days
2010-07-22 08:30:14 +00:00
Edward Tomasz Napierala
175389cff2 Remove spurious '/*-' marks and fix some other style problems.
Submitted by:	bde@
2010-07-22 05:42:29 +00:00
Andrew Turner
05ef546154 - Add myself to committers-src.dot
Approved by:	imp (mentor)
2010-07-21 21:23:23 +00:00
Xin LI
d74001ad8d Apply vendor version 1.20.00.17.
This version adds support for ARC1880; additionally this version fixed
an issue where all devices on a SAS port gets offlined when any device
failed on the port [1].

Many thanks to Areca for continuing to support FreeBSD.

PR:		kern/148502 [1]
Submitted by:	Ching-Lung Huang <ching2048 areca com tw>
Obtained from:	Areca
Tested by:	Rich Ercolani <rercola acm jhu edu> [1]
MFC after:	2 weeks
2010-07-21 18:50:24 +00:00
Rui Paulo
2b95672852 MFamd64:
Add USD_GETBASE(), USD_SETBASE(), USD_GETLIMIT() and USD_SETLIMIT().
2010-07-21 18:47:52 +00:00
Kai Wang
85de6c411e * Remove a superfluous error description.
* Document an additional error that may be returned: `ELF_E_ARCHIVE`.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:29:00 +00:00
Kai Wang
0806107365 Add a cross-reference to elf_rawfile(3).
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:23:07 +00:00
Kai Wang
52d63629e6 * Note that ar(1) archives may also be opened using elf_memory(3).
* Ignore the passed in value of the `fd` argument for ar(1) archives
  opened with elf_memory(3).

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:18:57 +00:00
Bjoern A. Zeeb
101235dcb3 Since r186119 IP6 input counters for octets and packets were not
working anymore.  In addition more checks and operations were missing.

In case lla_lookup results in a match, get the ifaddr to update the
statistics counters, and check that the address is neither tentative,
duplicate or otherwise invalid before accepting the packet.  If ok,
record the address information in the mbuf.  [ as is done in case
lla_lookup does not return a result and we go through the FIB ].

Reported by:	remko
Tested by:	remko
MFC after:	2 weeks
2010-07-21 13:01:21 +00:00
Kai Wang
d284162491 Remove a redundant word.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:00:01 +00:00
Kai Wang
d961c5b461 Move helper functions _libelf_ar_get_{name,number,string}() and
`_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c"
to break the circular dependency between "elf_memory.o" and
"libelf_ar.o".

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:54:34 +00:00
Kai Wang
e2efa43644 Fix a memory leak.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:30:58 +00:00
Alexander Motin
e88f9fb47f Use proper sysctl type (quad) for et_frequency. It fixes output on sparc64. 2010-07-21 12:23:49 +00:00
Kai Wang
86f5401b91 * Deprecate elf_getshnum(), elf_getphnum() and elf_getshstrndx() in
favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()`
  respectively.
* Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and
  `elf_getshdrnum()`.
* Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and
  `elf_getshnum()`.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:14:50 +00:00
Kai Wang
9eab8b61d9 Avoid switching between "unsigned char" and "char" in the C code
generated from "libelf_convert.m4".

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 11:26:18 +00:00
Kai Wang
1d69e83ddd Add support for translating sections of type ELF_T_GNUHASH.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:57:22 +00:00