741 Commits

Autor SHA1 Mensagem Data
Brian Swetland ff83aeec1c [linenoise] allow get columns query to timeout
Change-Id: Ifa92588c564205818eef7b24b356d440254eca64
2017-09-12 06:04:42 +00:00
Brian Swetland 685a2f5e3b [musl][dl] provide dl_clone_loader_service()
If there is an active loader service and it supports obtaining
a new connection, this function will return a new connection.

Change-Id: I58fe4d2450dc656340ed352424ef095ad19227fe
2017-09-12 01:08:01 +00:00
Petr Hosek c67a9eb4d0 [libc] Use atomic_load to read FILE->lock
FILE->lock is atomic_int and so should be read using atomic_load.
Previously this wasn't reported, but with a new Clang this is
triggering an error because of -Wtautological-unsigned-zero-compare.

Change-Id: I3fe11f4be356a96d688e90614a9498d3c9eba05e
2017-09-09 03:53:29 +00:00
George Kulakowski aeab97fdf7 [musl] Remove some unused files
Change-Id: I0e4d9b63efa56cd8498d6a3bb9e75b458142dd33
2017-09-07 21:53:34 +00:00
George Kulakowski 59e644b1dc [zircon][mxtl->fbl] Rename mxtl to fbl
Change-Id: Ie21b6498e1bfb0a7fa0315e40b9e5c3ee78646be
2017-09-07 13:57:27 -07:00
George Kulakowski 77a89c40ca [gn] gn format all BUILD.gn files
Change-Id: Ibf190b9304343df41219f4f40c1ee9eb54c83678
2017-09-07 20:07:13 +00:00
Roland McGrath 204b5192a1 [kernel][arm64] Optimized arm64 memcpy, memset
These are taken verbatim from Linaro's cortex-strings.  memset is
from an older version of cortex-strings that does not use NEON.  The
current cortex-strings memcpy (also now used in libc) never used NEON.

MG-526 #done

Change-Id: Ic01878a1c702c3677103e5db0c67ce114e201183
2017-09-06 01:48:39 +00:00
Roland McGrath b8cf9ba986 [ulib][musl] Optimized aarch64 string routines
These are taken verbatim from Linaro's cortex-strings package.
One mechanical cosmetic change to the assembly was necessary for
it to build with Clang/LLVM's assembler because the Linaro code
was using a GAS variant of the official syntax instead of what
the ARMv8 manual says to use.  We can revert that to go back
to verbatim when https://bugs.llvm.org//show_bug.cgi?id=34488 is fixed.

MG-1111 #done

Change-Id: I186ee61b9184f247ba77a27622389eee4bde493c
2017-09-06 01:06:29 +00:00
George Kulakowski 626dbd76fe [musl] Remove unused dummy fenv.c
All our architectures support these.

Change-Id: I35dc26ee30e7d122029487b7d63c2f639f1349eb
2017-09-05 22:09:55 +00:00
Roland McGrath 151f2374c9 [ulib][musl] Simplify assembly alias macros
A single "sym = othersym" handles .type and .size automatically.
So these macros can be simpler.

Change-Id: I9b7b45a8f426f7d59a68f7f5089b3664bc0fd9cd
2017-09-05 21:46:36 +00:00
Roland McGrath f47c34a591 [ulib][musl][math] Rewrite x86_64 fenv routines in C
This makes the code more readable and it makes the functions
doing memory access susceptible to sanitizer instrumentation.

Change-Id: I5bb0c627e82ae2a584f9f00a7d00c2f88b8eab9e
2017-09-05 21:21:04 +00:00
Roland McGrath 00b4646055 [ulib][musl] Don't use x86-64 assembly version of mempcpy in ASan build
The ASan runtime intercepts memcpy to provide checking on its pointer
arguments, but expects libc's mempcpy to do its own checking.  So use
the vanilla C version that will just call the intercepted memcpy.

Change-Id: I06b3d46410d2ea85916b9e8de3507f6e577d1018
2017-09-05 19:37:45 +00:00
Julia Hansbrough b2d0235585 [musl] Remove -Werror=incompatible-pointer-types.
Everything seems to build fine without it.

Change-Id: I0a68f16cf6b05f209d7501b7dcc9a455d81ac25e
2017-09-05 19:18:08 +00:00
Roland McGrath 7969d8f023 [ulib][musl][math] Rewrite aarch64 fenv routines in C
This makes the code more readable and it makes the functions
doing memory access susceptible to sanitizer instrumentation.

Change-Id: I846eaa1f7246eea69a2831e6e011248b3eab6db0
2017-09-05 19:15:45 +00:00
Travis Geiselbrecht e1490736b6 [kernel][vm] move kernel/kernel/vm to just kernel/vm
Change-Id: I8f724a9f8a61415712661d1fdd3dc4e1c70cf620
2017-09-02 11:27:05 -07:00
Roland McGrath 595458687b [ulib][musl][ldso] Clean up R_*_RELATIVE reloc handling
Rewrite _dl_start to be more readable and not use a stack array.
It now depends on ld.so being linked with -z combreloc so it can
use optimal code relying on DT_RELACOUNT.  Also clear out some
remaining MIPS reloc support and drop the IS_RELATIVE macro.

Change-Id: Ia8e97db9edcd74c6c55351ebbd0fe5f38f0ab317
2017-08-28 02:52:03 +00:00
Julia Hansbrough 455e4549bd [musl] Clean up -Wno-parentheses in musl.
Change-Id: I26fed03750841222a400b418cd92f64206f5f397
2017-08-24 21:10:01 +00:00
Christopher Anderson 141460ec79 [acpi] Standardize pci access around PIO
According to the PCIe Base Spec section 7.2 all PCIe devices
must be compatible with PCI 3.0 configuration accesses. This
change standarizes the ACPI OS abstraction layer to only use PIO
access for ACPI initialization. This results in us not needing
to do any error prone probing and cuts down on assumptions we
need to make around the hardware the system is running on.

As an added bonus, it greatly reduces the complexity of the
abstraction layer between ACPICA and magenta.

Change-Id: I3c30b73058a0c4c6c361f2d17ca8d15a27bda050
2017-08-23 23:09:15 +00:00
Andrew Krieger a1a80a6a7d [kernel][entropy] Add cmdlines for jitterentropy
Add a few cmdline-tweakable parameters for the jitterentropy entropy
collector. The cmdlines are used to support MG-1022 (optimizing
jitterentropy's parameter values).

Change-Id: I1d78c49738edf498819097b8f0bc85b1803cf445
2017-08-22 18:15:06 -07:00
Brian Swetland 98530a1138 [cksum] remove stray decl
This was causing clang to fail in some builds...

Change-Id: I5a47825b4eff30cb0fa06439ba2a1bf989d87a8b
2017-08-22 14:18:33 -07:00
Brian Swetland 14de2128e0 [cksum] modernize crc/adler code
- use modern standard types
- use ansi C definitions
- regularize type usage
- make buildable in kernel again

Change-Id: I16ba18f8c75dcbc3b9e1403bcb0c7fcfb97b1af0
2017-08-22 20:38:19 +00:00
George Kulakowski 1aa09b9827 [musl][threads] Declare internal thread routines in pthread_impl.h
Change-Id: I12304f53aaa8214fea15a92c8b084ee772233a4f
2017-08-22 00:53:46 +00:00
George Kulakowski c550014a85 [musl][signals] Remove dead signal handler declaration
Change-Id: I219865a025c052a4884ff374e09961d7bad9055a
2017-08-22 00:52:56 +00:00
George Kulakowski 1cd173c819 [musl] Make thrd_{create,exit,join} call non-public pthread functions
Change-Id: Id64a71f3210d8891b598b7c02d22ecfc65784c77
2017-08-20 11:30:53 -07:00
Roland McGrath fbc4712d6d [ulib][musl] Increase PTHREAD_STACK_MIN to 3072
This constant is used by launchpad to decide how big the initial
stack needs to be (in addition to the bootstrap message size).
So it must be sufficient for all the stack use in the dynamic
linker and libc startup path (not including the bootstrap message
size), up until the point where __libc_start_main switches
stacks.  The actual stack size is always rounded up to whole
pages, so it's worthwhile to keep this size smaller than a page
so that when the bootstrap message is small the initial stack
only needs one page.

Current stack usage is comfortably under 3k, but more than 2k.
So with the old size of 2k, a bootstrap message size (modulo page
size, 4k) that is between around 1500 and around 1900 would be
too large to leave enough stack space but too small to push
launchpad's calculation up to using another page of stack.

MG-1038 #done

Change-Id: Ia1aadc39aa4717f8ff75ade0087eccb74cafb6d2
2017-08-20 00:39:17 -07:00
George Kulakowski 0a0cc48d47 [musl] Fix the race again in thrd_create
The indirection added to fix the restrict violation reintroduces the
race between the start of the new thread and the side effects
(including writing the out parameter) of the calling thread. It seems
better for the moment to fix thread self detaching, and then invert
the flow of control between thrd_create and pthread_create.

Revert "[musl][threads] Fix a restrict violation between thrd_create and pthread_create"

This reverts commit 0f118a2f01.

Change-Id: Id9bccfa85c2ced24c6916ea8f9de4b7b31ceccf6
2017-08-18 23:16:48 +00:00
George Kulakowski 7f4112b034 [musl][thrd] Return correct errors from thrd_detach
Upstream, these always succeed (assuming correct usage). We added some
best-effort error detection. This means we need to return the
thrd_*-style values rather than the errno style values from
thrd_detach.

Change-Id: Ic1b34980b9ee87552a5e18e7db2ed0fed70e2041
2017-08-18 22:04:42 +00:00
Julia Hansbrough 7799497c10 [musl] Remove -Werror=strict-prototypes.
Seems to build fine without it.

Change-Id: Ia6ccc774c8776f0d3e952419eee9929f38aea36c
2017-08-18 18:47:47 +00:00
George Kulakowski 8857902763 [musl][threads] Remove races in thread creation
After starting the new thread, it may immediately exit and clean up
the thread structure. It's not safe to access the struct after that
call.

Also, write the thrd_t pointer out before starting. Newly C11 threads
synchronize with the end of the thread creation function, so the side
effects must be visible prior to that.

Change-Id: I76ca2563507106dfc2ea2384002606306654ecf5
2017-08-18 17:09:48 +00:00
Andrew Krieger 508c38c4d8 [kernel][entropy] Add jitterentropy collector
Create a crypto::entropy::Collector subclass for jitterentropy.

Note: this class is intentionally not used to seed the global PRNG yet.
That will come after we've tested jitterentropy and determined the
right parameters to use.

Change-Id: Ia125b1a3d396c402a44984bd418a490e2f68adbd
2017-08-16 00:29:37 +00:00
George Kulakowski 4fb0b60705 [musl][threading] Remove unused includes of pthread.h
Change-Id: Iabadad1f62c386acb98d7ea6a872670187289e3a
2017-08-15 20:27:07 +00:00
George Kulakowski dce646a80a [musl][threading] Prefer __thrd_current in non-pthread code
Change-Id: I4f4e6da25df65e9c6660e7f7dc3a3aeee5a309a7
2017-08-15 19:59:07 +00:00
George Kulakowski cd3b81a961 [musl] Move __clock_gettime declaration into a header and dedup a macro
Change-Id: I9fd466b2b58c2bab7f528976373a7b1cd9d8e773
2017-08-15 19:19:11 +00:00
George Kulakowski 843477b835 [musl][threading] Introduce an internal __thrd_current accessor
Change-Id: Id08fcfcf4819b23837aabeabd2c532597ee51a9d
2017-08-15 19:08:03 +00:00
George Kulakowski 0f118a2f01 [musl][threads] Fix a restrict violation between thrd_create and pthread_create
Change-Id: Ib3874948fdde47d80a349ae465aaac7a62af013a
2017-08-14 23:51:39 +00:00
George Kulakowski 38cd1a2ad0 [musl][at_quick_exit] Use the COUNT macro to check against instead of a literal
Change-Id: I0859a7f94c24fc7fef75b33c08fa950357d8c199
2017-08-14 14:50:08 -07:00
George Kulakowski 508002e404 [musl][atexit] Release locks when done calling atexit/at_quick_exit callbacks
Unlocking is not necessary, as our process is moribund. But it's good hygiene,
and removes a warning from static analysis.

Change-Id: I6bbca9585edc039ea91a2a63a76675454de56e75
2017-08-14 18:56:48 +00:00
George Kulakowski 3ecf8d29dc [musl][pthread] Remove pthread_atfork support
No reason to support this when we won't support fork.

Change-Id: Ifb181fbb110f6b41355c18c75b3ea087dbb3ed76
2017-08-11 17:28:28 +00:00
Aaron Green 852b694cab [third_party] Roll BoringSSL
This CL updates the uboringssl subset of BoringSSL to match that in
//third_party/boringssl.

Change-Id: I37512741e9ec09b85a00811b5ec78ff9e7bd0a45
2017-08-10 22:16:20 +00:00
Aaron Green 6dab532f18 [third_party] Rename boring-crypto to uboringssl
After much effort, the BoringSSL team managed to get a subset of their
codebase through FIPS-140-2 certification.  Unfortunately, they've named
the subset "BoringCrypto".  To avoid the kind of confusion that agencies
that care about FIPS are particularly senstive to, this CL renames the
kernel's subset to uboringssl, pronounced 'micro-boringssl' with 'u' as
a stand-in for mu.

Change-Id: I4778a1847acc4451249f6f10f179c10bfb651454
2017-08-10 22:16:20 +00:00
Todd Eisenberger 6014343c07 [acpica] Make enabling debug features easier
With this, turning on the debug output is mostly just specifying
ENABLE_ACPI_DEBUG=1 while building.  Docs coming soon for how to use the ACPICA
debug interfaces.

Change-Id: I14ccdeedad004e3d127861a6b2f2201e499026f4
2017-08-10 18:00:01 +00:00
Yvonne Yip 99974bdf2c [ulib][acpica] implement AcpiOsUnmapMemory
Fixes handle leak from devhost:acpi.

MG-1000 #done

Change-Id: Ibb5592dbb5231dc203c75d04b161b4cc06c84388
2017-08-09 22:10:25 +00:00
Todd Eisenberger 3f2f593187 [acpica] Fully implement AcpiOsWaitSemaphore
Previously I had not implemented timeouts, which was causing deadlocks
due to ACPICA's internal locking scheme.

MG-1012 #done
MG-1005 #done

Change-Id: Ib75a41d409cc8e44034d47aee22d10db6e5f137a
2017-08-09 12:27:08 -07:00
Roland McGrath 2b20009563 [musl] Use 'j' suffix rather than 'i' suffix in _Complex_I definition
Both the 'i' and 'j' suffixes on a floating-point literal to mean
"imaginary" are GNU extensions.  But ToT Clang (r310423) has stopped
accepting 'i' in non-GNU -std= modes, while it still accepts 'j'.

Change-Id: If76ce3176f0bd2e38f625657c68417bd9e4708a9
2017-08-09 01:50:53 +00:00
George Kulakowski e886377c1e [musl][fork] Fix the ENOSYS return in fork
When removing SYS_clone, I unwrapped this particular syscall() macro
wrongly. This extra-bogus return is confusing some test suites.

Change-Id: If5a1e32cd421f1ce79b078194af25e97adbf026e
2017-08-09 00:55:24 +00:00
Yvonne Yip 22dc573450 [acpica] convert osfuchsia.c to c++
Change-Id: I91bcc63a07b9ed35e4168af2de51795ee6ae5cf2
2017-08-08 22:28:44 +00:00
George Kulakowski 910e8e6578 [musl][signals] Remove last unused signal helpers from pthread_impl.h
Change-Id: I2cd96c62b34e4cb355931958d509f3eed5b2963b
2017-08-08 22:01:21 +00:00
George Kulakowski d0896df71d [musl][signals] Remove unused struct k_sigaction and signal restore functions
Change-Id: Ie676b37dee08ca029248f0f46b7939b163330a9c
2017-08-08 21:51:47 +00:00
George Kulakowski 5bf4b3bf5f [musl][arch] Remove various unused arch-specific macro definitions
The LDSO_ARCH name is no longer used.

CRTJMP was used on linux to jump to the entry point. We use a
different mechanism to return a function pointer and argument to _start.

Change-Id: Iad96d518f0664a74f9c780d9064439db68a0f3b9
2017-08-08 21:51:37 +00:00
George Kulakowski a1deb28a41 [musl] Remove unused MC_PC definitions
Change-Id: I95db711e44510a00fd95937e9f85ec829c980174
2017-08-08 21:51:17 +00:00