Commit Graph

1377 Commits

Author SHA1 Message Date
rmind 7ae1c4ed1b libkern: add murmurhash module. 2013-06-29 16:02:01 +00:00
riastradh 82db4b9858 Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.
consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
2013-06-24 04:21:19 +00:00
dholland e1610ba4cb Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

   lblkno
   lblktosize
   lfragtosize
   numfrags
   blkroundup
   fragroundup
2013-06-23 07:28:36 +00:00
riastradh bfb8ca3f2e Account bytes drawn from initial call to libkern arc4random.
XXX This unlocked initialization looks rather bogus...
2013-06-23 02:38:22 +00:00
riastradh 6290b0987e Rework rndsink(9) abstraction and adapt arc4random(9) and cprng(9).
rndsink(9):
- Simplify API.
- Simplify locking scheme.
- Add a man page.
- Avoid races in destruction.
- Avoid races in requesting entropy now and scheduling entropy later.

Periodic distribution of entropy to sinks reduces the need for the
last one, but this way we don't need to rely on periodic distribution
(e.g., in a future tickless NetBSD).

rndsinks_lock should probably eventually merge with the rndpool lock,
but we'll put that off for now.

cprng(9):
- Make struct cprng_strong opaque.
- Move rndpseudo.c parts that futz with cprng guts to subr_cprng.c.
- Fix kevent locking.  (Is kevent locking documented anywhere?)
- Stub out rump cprng further until we can rumpify rndsink instead.
- Strip code to grovel through struct cprng_strong in fstat.
2013-06-23 02:35:23 +00:00
dholland 2737439da3 fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
2013-06-23 02:06:04 +00:00
matt 47a6ce0396 Add back {,u}modsi3 for libkern since if we are building standalone tools
we might be using the old ABI and might need them.
2013-06-21 05:06:24 +00:00
matt 7213984b98 modsi3/umodsi3 are only needed !EABI arm 2013-06-20 07:29:50 +00:00
dholland 64912b9b11 blkoff() -> mfs_blkoff()
XXX: this shouldn't be using "mfs" for its symbols as we also have
XXX: sys/ufs/mfs.
2013-06-19 18:18:12 +00:00
dholland f1333577b5 Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
   NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
   INOPB -> FFS_INOPB, LFS_INOPB
   INOPF -> FFS_INOPF, LFS_INOPF
   blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
   sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
2013-06-19 17:51:25 +00:00
christos 855bb66ef7 Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs.
This was done so that boot blocks that want to compile both FFS and LFS in
the same file work.
2013-06-18 18:18:57 +00:00
dholland 5a420c1b9a Stick UFS_ in front of these symbols:
DIRBLKSIZ
   DIRECTSIZ
   DIRSIZ
   OLDDIRFMT
   NEWDIRFMT

Part of PR 47909.
2013-06-09 17:57:08 +00:00
dholland 89582ef58a Build properly against the lfs changes. 2013-06-09 00:02:33 +00:00
tsutsui ab5da9a864 Wrap >80 char lines that overflowed on NDADDR -> EXT2FS_NDADDR changes. 2013-05-10 15:22:37 +00:00
matt 5f058922b3 This change arm, armeb, earm, earmeb, earmhf, earmhfeb so all builds that
share a MACHINE_ARCH for userland so that except for etc, will produce
identical sets.

usr/include/machine now points to usr/include/arm
2013-05-02 03:56:38 +00:00
martin e7f80397d9 Make the check in close() for a non-deflatable file mode symetric to
the one in open().
Avoids dealloc() calls on NULL.
2013-04-14 22:23:28 +00:00
nakayama 99b8f1ddbf Remove duplicate source files. 2013-03-17 04:47:16 +00:00
nakayama e923193871 Revert previous. christos fixed the root cause. 2013-03-17 04:45:46 +00:00
christos ab495c9f87 undo sparc64 kludge 2013-03-17 00:47:13 +00:00
nakayama 809b806d54 Make sparc64 32-bit kernel buildable. 2013-03-14 11:53:33 +00:00
christos d3a58d87a8 amend previous sparc64 fix: rump does not know about memcpyset.s 2013-03-11 11:44:48 +00:00
christos 49d47d88c9 On sparc64 memcpy and memset are provided by memcpyset.s (should have been
memcpyset.S, but...). Don't include them in the build because it breaks the
modular build where the kernel library is built as an object.
2013-03-10 07:31:03 +00:00
christos 642baa00c2 recognize OpenBSD too 2013-03-02 22:04:06 +00:00
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