Commit Graph

1354 Commits

Author SHA1 Message Date
matt f35a96a42a Modify earm rule to match any machine_arch starting with earm. 2013-02-06 07:18:15 +00:00
matt 080a1c2724 Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
2013-01-23 22:34:37 +00:00
macallan b3be12c418 pull in strnlen.S 2013-01-23 20:38:27 +00:00
dholland dcd34a91c5 Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
   ROOTINO -> UFS_ROOTINO
   WINO -> UFS_WINO
   NXADDR -> UFS_NXADDR
   NDADDR -> UFS_NDADDR
   NIADDR -> UFS_NIADDR
   MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
   MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
2013-01-22 09:39:11 +00:00
matt e140e7a99f Pass down an empty CPUFLAGS since CPUFLAGS is contained in CFLAGS. 2012-12-12 15:12:11 +00:00
matt d341a32e61 Don't pass down CPUFLAGS since its value is already in CFLAGS. 2012-12-12 15:10:27 +00:00
christos 293b3c5124 add new divsi3 related files. 2012-10-30 16:36:03 +00:00
christos 58e206816c add split files. 2012-10-10 02:15:31 +00:00
matt 325a8822fe Add ARMv5 support the clz instruction 2012-09-01 11:24:36 +00:00
drochner 8588929dc5 Add "consttime_bcmp" and "explicit_bzero" functions for both kernel
abd userland, as proposed on tech-security, with explicit_bzero using
a volatile function pointer as suggested by Alan Barrett.
Both do what the name says. For userland, both are prefixed by "__"
to keep them out of the user namespace.
Change some memset/memcmp uses to the new functions where it makes
sense -- these are just some examples, more to come.
2012-08-30 12:16:48 +00:00
joerg c14f2d4ef8 Deal with optional HAVE_GCC. 2012-08-10 16:05:26 +00:00
matt 9c2af1c9cc If earm*, compile new aeabi runtime routines. 2012-08-06 02:14:57 +00:00
mhitch ddc56403a8 Fix cd9660_read() to not read past the end of the file. This would result
in incorrect resid values, and causes the read of /boot.cfg to ignore the
file.  If the requested transfer extends past the end of the file, force
the internal buffer to be used, and when transferring data from the
internal buffer, limit the transfer to what's left in the file.  CDROM
boot will now process the /boot.cfg file.
2012-07-23 00:49:20 +00:00
dsl 6a03bb6b37 Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
  contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
  isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
2012-05-21 21:34:16 +00:00
tls 2b09c6c851 Add a spin mutex to the rndsink structure; it is used to avoid lock
ordering and sleep-holding-locks problems when rekeying, and thus
to avoid a nasty race between cprng destruction and reseeding.
2012-04-10 14:02:27 +00:00
tsutsui 1296da9587 Fix a bug that libsa ls doesn't work in case of filename with directory path.
("ls /path/and/file" always returns not found)  From MINIX via Evgeniy Ivanov.
2012-03-02 12:08:44 +00:00
njoly 923a542ecd void function _arc4randbytes cannot return a value. 2012-02-14 18:57:35 +00:00
dholland 7609b9bc56 Migrate one last leftover bit (used only by the kernel now) to
sys/ufs/ufs and remove the old quota headers and no-longer-used shared
code. Ok by releng.
2012-02-05 14:19:02 +00:00
tls 7b0b7dedd9 Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.
2012-02-02 19:42:57 +00:00
rmind c1591c4ef3 Add CTASSERT_SIGNED() and CTASSERT_UNSIGNED(). 2012-01-22 02:57:36 +00:00
joerg 714fe69669 Don't use __cmsg_alignbytes in the kernel. Mark it as constant function
for userland as its value never changes. This allows the compiler to
optimise most invocations away.
2012-01-20 00:25:29 +00:00
christos 488f092662 PR/45796: Evgeniy Ivanov minixfs3 support. 2012-01-16 18:46:20 +00:00
christos 8ead40fd5d PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
2012-01-16 18:44:13 +00:00
tsutsui c2e8ce644b Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

 - add 'ls' op to struct fs_ops to support ls command on each fs,
   enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
   in libsa
 - split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
   that opens the target fs and calls fs-depedent XXX_ls() functions
 - add a ls op for ext2fs
   (all other fs than ufs and ext2fs don't have actual ls ops yet)
 - replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
      replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
2011-12-25 06:09:08 +00:00
drochner 47be4b7567 make "rs" static -- this name is too unspecific for the global namespace 2011-11-29 13:16:26 +00:00
tls 38f95ba1b7 Remove rnd_extract_data from the public kernel API (it is for use by the
stream generators only).  Clean up some related minor issues.
2011-11-29 03:50:31 +00:00
tls f27d6532f5 Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not).  This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
2011-11-28 08:05:05 +00:00
tsutsui 48b15c9676 Disable a DIAGNOSTIC test which causes kernel stack overflow on all arm ports.
Boot failure is reported from several arm users (nonaka@, ryo@, and others),
and too large auto variable in arc4_randrekey() is pointed out by enami@.
2011-11-27 00:09:04 +00:00
enami 0ceee4c5f8 Use exact 32bit integral type to declare variable to store
32bit random value.  This is necessary since it is overwritten
by four bytes.
2011-11-26 14:04:20 +00:00
enami 6f7055e2a8 Fix white space usage. 2011-11-26 13:53:37 +00:00
joerg 916c58b88e Spell restrict with __. 2011-11-25 12:45:00 +00:00
para 4255d01378 make it compile without DIAGNOSTIC defined 2011-11-20 15:37:31 +00:00
tls 3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00
mrg 030041f5bd use LIBISPRIVATE instead of home-grown. 2011-10-30 00:28:57 +00:00
christos 63efa6113b shouldn't need .size for ppc64. 2011-10-28 02:00:50 +00:00
chs e873fd069d use gcc builtin for memset() on vax too. 2011-10-01 16:06:24 +00:00
christos b3bf6991f2 Don't include <sys/systm.h> because it brings in too much stuff that
conflicts with standalone code. Instead modify kern_assert() to be like
panic() and call that.
2011-09-29 20:50:09 +00:00
jym 325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
jym c0cdfbbb3d Do as Joerg said and kill the __STDC__ blocks. They only make sense for
things used by assembler, which won't be the case for these macros.
2011-09-25 20:31:18 +00:00
jym b0471da334 Make strnlen(3) accessible in kernel. ok christos@. 2011-09-01 22:35:17 +00:00
dyoung 9943264696 Build and install ppath(3), property-list paths library. 2011-08-26 21:22:07 +00:00
matt 0435f73056 Fix bug when only restoring r31 (lr was not being restored properly). 2011-08-12 14:48:00 +00:00
uwe 89e9839f44 Reword the comment about "millicode" nature of these functions and add
it to sdivsi3_i4i.S too.
2011-08-05 02:00:25 +00:00
uwe 41f19aa9d6 Reword the comment about "millicode" nature of these functions and add
it to sdivsi3.S too.

Remove !_KERNEL code left over from the days when we shared these
files with userland.

Use .L prefix for local label.
2011-08-05 01:59:39 +00:00
uwe ab79e8db68 For unsignad integer division gcc used to emit a call to __udivsi3
"millicode" function that uses compiler-private ABI.  Newer gcc uses
heavily tuned __udivsi3_i4i that is NOT compatible with __udivsi3
because it's expected to clobber different registers.  We don't want
to link the kernel against libgcc and we don't have resources to write
heavily tuned version ourselves, so clone __udivsi3 but adjust it to
conform to the __udivsi3_i4i clobber spec.

Ditto for signed division.

You can make gcc use old routines with -mdiv=call-div1 to avoid few
extra instructions to save/restore the right registers in the signed
division funcion.
2011-08-04 03:20:09 +00:00
jakllsch a6deec34f7 Fix printf formating in ifdef DEBUG sections. 2011-07-30 03:43:20 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
mrg b259e2f2c8 revert the _i4i aliases. they are not the right thing. 2011-07-14 09:48:03 +00:00
mrg 2f4b41bf98 add weak aliases for __sdivsi3_i4i and __udivsi3_i4i. 2011-07-06 01:29:54 +00:00
matt fee0e13d37 If GCC 4.0 or later, use __builtin_offsetof for offsetof.
This make GCC 4.5 with offsetof in mbuf.h and kern_cpu.c
2011-07-05 01:56:45 +00:00