Commit Graph

6200 Commits

Author SHA1 Message Date
Axel Dörfler
6adf7a0c75 VFS: prevent FD inheritance for the kernel completely.
* Each io_context now has a "inherit_fds" member that decides whether
  or not this context allows to inherit FDs to its children.
* This replaces the former O_CLOEXEC mechanism.
2015-09-11 17:08:35 +02:00
Axel Dörfler
e668e80db0 VFS: Always open kernel FDs with O_CLOEXEC.
* Avoids leaking them into userland.
2015-09-11 08:57:15 +02:00
Michael Lotz
d64c7086d5 Various whitespace cleanup only. 2015-09-05 16:09:33 +02:00
Michael Lotz
8b9bb054f4 libroot_debug: Replace two more uses of printf in guarded heap.
Use the internal print_stdout() instead as done when printing the
stack traces.
2015-08-23 13:19:12 +02:00
Michael Lotz
5dbea46970 libroot_debug: Track freeing thread in guarded heap separatley.
Previously the thread member was overwritten with the freeing thread
when a page was freed, leading to confusion when hitting unallocated
pages due to the debugger message still stating "allocated by thread".

Track the freeing thread separately as it might be interesting to know
both, which thread initially allocated and which thread eventually freed
an allocation.
2015-08-23 13:10:12 +02:00
Michael Lotz
c4a9344a11 libroot_debug: Support alignments > B_PAGE_SIZE in guarded heap.
These are always allocated using an area. The allocation size is
increased as to guarantee the availability of a suitable address. The
pages between the allocation info and the actual, aligned start address
and the pages past the allocation end are then protected.

This commit also fixes corruption of the allocation info for large
allocations that used areas. The alignment wasn't taken into account
when calculating the amount of space needed. The alignment could then
lead to rounding down the allocation start such that it would overlap
with the allocation info.
2015-08-20 21:59:41 +02:00
Michael Lotz
5d4501aa01 Assorted whitespace cleanup and typo fixes. 2015-08-20 21:54:41 +02:00
Michael Lotz
efb0a3a853 EntryCache: Add entry_cache_add_missing() for negative caching.
It provides a way for filesystems to cache a lookup failure and
therefore prevents repeated lookups of missing entries. This is a
common scenario for example in command lookup and compiling, where
each directory in PATH or each include directory is searched for the
given entry.
2015-08-20 21:25:56 +02:00
Alexander von Gluck IV
5d91a421b9 glibc/arm: More generic math functions 2015-08-15 00:00:26 -05:00
Alexander von Gluck IV
76cc2d8f45 glibc/arm: Filling in more ARM gaps 2015-08-14 21:06:40 -05:00
Alexander von Gluck IV
17ddd6c09d libroot/arm: Add in some missing math functions
* Using native assembly functions would be a lot faster,
  but would require quite a bit of changes to glibc.
* This gets arm linking for now... I'd personally like
  to see musl in here in the future for gcc4 images. (pre-R2)
2015-08-14 13:46:05 -05:00
Alexander von Gluck IV
ab341b9d63 kernel/arm: Correct platform id on ARM 2015-08-14 12:50:05 -05:00
Michael Lotz
1748116d1c libroot_debug.so: Fix missing alignment in guarded realloc. 2015-08-13 22:33:55 +02:00
Michael Lotz
8fa441bf5c libroot_debug: Revert to a legacy default alignment of 8.
This reverts the legacy default alignment (in absence of max_align_t)
to 8, as it was before.
2015-08-13 22:12:19 +02:00
Michael Lotz
f474606ee9 libroot_debug: Merge guarded heap into libroot_debug.
The individual debug heap implementations are now exposed via a
structure of function pointers and a common frontend dispatches the
malloc and malloc_debug APIs through them.

The MALLOC_DEBUG environment variable can be used to select the guarded
heap by adding 'g', otherwise the debug heap is used as the default.
Consequently the separate libroot_guarded is not needed anymore and has
been removed.

To allow the use of environment variables this early, init_env_post_heap
has been added and the heap dependent atfork() moved there. This allowed
to fold the code of init_heap_post_env into init_heap so the former has
been removed.
2015-08-13 22:12:18 +02:00
Rene Gollent
422b0ec754 libroot: Fix issue reported in ticket #12291.
fts.c:
- Our fts functions were imported from FreeBSD and consequently did not
  use the same weak alias methodology that most of our glibc-derived
  POSIX functions do. These subsequently wound up clashing with the
  implementation of said functions in current versions of coreutils,
  resulting in assertion failures when e.g. running a program through
  stdbuf, since the BSD-derived functions had different flag constraints
  than their GNU peers. Consequently, this change adjusts the fts_*
  family of functions to similarly be exported as weak symbols so they
  can be preempted.
2015-08-10 17:01:35 -04:00
Michael Lotz
f9a8f3e727 Clean up various whitespace and fix one header guard. 2015-08-02 23:19:07 +02:00
Rene Gollent
27dec4bb1e user_debugger: Adjust handling of continue request.
- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
  is in a suspended state rather than waiting on the debug nub port, and
  if so, handles resuming it automatically. This allows the continue message
  to be used on the main thread of a team that was freshly created under
  debug control without the API user having to be cognizant of the distinction.
2015-07-31 17:28:00 -04:00
Jérôme Duval
2a868d7645 glibc: replace extern __inline with __extern_inline.
* this helps to comply with C99. As a reminder, some of these headers
are also used by x86_gcc2 src/libs/stdc++.
2015-07-26 10:09:22 +02:00
Rene Gollent
410b38b5c5 libroot: Fix strto{i,u}max.
- According to POSIX, these functions should map to whatever's appropriate
  for the platform's intmax_t size, which in our case is a 64-bit integer.
  Our (2004) implementation, however, was calling the 32-bit variations of
  strto*(), leading to truncation for larger values.
2015-07-24 21:57:11 -04:00
Axel Dörfler
34671d601a Added execvpe().
* This closes #12114 again; while not POSIX, it's just a line away.
* Removed exect() from the header -- not sure where this came from.
  but I can't find anything about it on the net.
* Consolidated use of asterisk style in exec.cpp.
2015-07-23 13:30:30 +02:00
Axel Dörfler
463d38e40b Fixed exec*(), and __flatten_process_args() with NULL env.
* Not sure if it's following any standard, but environ can be NULL
  (either by manually setting it to NULL, or by calling clearenv()).
2015-07-22 20:44:12 +02:00
Axel Dörfler
7987907008 launch_daemon: We can now talk to the authentication manager.
* When creating the port of the registrar's authentication manager, we
  now set it manually, so that the user/group functions work.
* This allows LaunchDaemon::_StartSession() to set up the user, and
  groups as needed.
2015-07-22 20:43:26 +02:00
Axel Dörfler
ef462ab57f libroot: ensure that the launch_daemon doesn't wait for itself.
* The launch_daemon might indirectly call get_launch_daemon_port()
  which may cause a deadlock. Just fail in this case.
2015-07-22 20:41:09 +02:00
Axel Dörfler
1f374c8b2a libroot: hardcode find_directory() to /home/boot for root.
* This is a work-around to allow the registrar, and the launch_daemon
  to call find_directory() without worries.
2015-07-22 20:41:05 +02:00
Axel Dörfler
bea38cb711 registrar: implemented auth port via launch_daemon.
* get_roster_port_name() is no longer needed.
* This also removes the app_server restart code from the debug
  server -- this will be done by the launch_daemon in the future.
2015-07-22 20:41:01 +02:00
Axel Dörfler
4bf862e368 syslog_daemon: Converted to BServer.
* Instead of letting the kernel search for the syslog port, the
  daemon now registers itself with the kernel (which even solves
  a TODO).
* A port is created for the actual log messages from the launch_daemon,
  and used on start.
* However, the SyslogTest does not yet work, due to the BMessage <->
  KMessage communication problems.
2015-07-22 20:40:47 +02:00
Axel Dörfler
9d69dc097d libroot: added ability to communicate with the launch_daemon.
* These methods don't really work yet, as BMessage doesn't support
  replying with a KMessage; the request is received, but the reply
  never gets to the target.
2015-07-22 20:40:42 +02:00
Axel Dörfler
89168ad8b9 Boot the system via launch_daemon.
* This is actually working already, although we cannot reproduce all
  the features of the former Bootscript yet. This is without any
  dependency support in launch_daemon.
* All shell activity like cleaning out /tmp, setting up the environment,
  setting the time, etc. is not yet working.
2015-07-22 20:40:33 +02:00
Axel Dörfler
035e3e77ed kernel: profile system when SYSTEM_PROFILER is defined.
* This enables a mechanism to profile almost the complete boot process
  (starting with main2()), if SYSTEM_PROFILER is defined to 1.
* You can access the profiling data using "profile -r".
2015-07-22 20:39:52 +02:00
Jérôme Duval
a83446983d libroot: added a complex.h header based on ...
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
* added missing parts from glibc.
* x86_64 was already complete, x86 was missing a few functions.
* should help with #12202, provided that the gcc4 buildtools are rebuilt.
2015-07-10 22:39:21 +02:00
Ingo Weinhold
fb29004aaf disk device manager: Remove obsolete include path
virtualdrive hasn't been used for a long time. Should help with #12162.
2015-07-05 09:40:13 +02:00
Augustin Cavalier
6eafb4b041 Replace a few references to Subversion with Git.
There are a whole bunch more of these around, but these were the
ones I was confident replacing.
2015-06-19 15:36:52 -04:00
Jérôme Duval
0dc6b011fe malloc: implement malloc_usable_size().
* Fix #12132
2015-06-13 14:29:11 +02:00
François Revol
78b7298197 u-boot: PPC: Fix warnings 2015-06-12 23:18:33 +02:00
Hamish Morrison
b092f872b3 fork: update the thread id in the pthread struct after forking
Otherwise the child process's main thread will inherit the thread id
of its parent and pthread operations will be directed at the wrong
thread.
2015-06-04 13:36:29 +01:00
Hamish Morrison
9afa331102 chown: leave owner and group unchanged when values of -1 are passed 2015-06-02 16:54:40 +01:00
Hamish Morrison
d6d439f3f7 Reimplement unnamed POSIX semaphores using user_mutex
* Fixes sharing semantics, so non-shared semaphores in non-shared
  memory do not become shared after a fork.
* Adds two new system calls: _user_mutex_sem_acquire/release(),
  which reuse the user_mutex address-hashed wait mechanism.
* Named semaphores continue to use traditional sem_id semaphores.
2015-05-24 14:03:40 +01:00
Axel Dörfler
748c0f3021 kernel: Fixed broken port tracing.
* Broken since the scheduler merge.
2015-05-11 22:55:41 +02:00
Hamish Morrison
fb67dbf0a4 user mutex: dequeue waiters when waking them up
* This prevents the same waiter being woken multiple times, before it
  has a chance to run and dequeue itself.
2015-05-07 23:20:54 +01:00
Hamish Morrison
10b4fed24f Add support for pthread_condattr_get/setclock()
* Allows use of either CLOCK_REALTIME or CLOCK_MONOTONIC as the time
  base for pthread_cond_timedwait().
2015-05-02 20:55:57 +01:00
Humdinger
040029e0b8 Have B_FIND_PATH_LIB_DIRECTORY return the architecture.
Fixes #12028.
2015-04-28 08:07:22 +02:00
François Revol
a2ddc1c06e Fix CompileDTS rule to locate the device tree blob properly
This avoids having to call it from the BoardSetup files.
2015-04-24 02:27:55 +02:00
Michael Lotz
5d05694ad6 kernel guarded heap: Implement allocations debugger command.
It can be used to dump the current heap allocations with their details
and stack traces if enabled.
2015-04-23 23:04:38 +02:00
Michael Lotz
453ee84e23 kernel guarded heap: Also store team id for allocations. 2015-04-23 23:01:53 +02:00
Michael Lotz
337c4ccf01 kernel debugger: Use memcpy for stack trace on kernel stack.
If it was already determined that the memory is within the kernel
stack, a simple memcpy is enough.

This allows capturing kernel stack traces in situations where a fault
handler cannot be installed (i.e. where one is already installed).
2015-04-23 22:54:45 +02:00
François Revol
5c2425a61e PPC: fix COFF bootloader entry point
The concept of entry point in COFF is actually different than in ELF.

In COFF, the entry point is actually a "descriptor" (pointer) to the actual
start code. So we patch the entry point address when calling objcopy.

Now my old Performa 5400/180 actually starts the loader correctly \o/
2015-04-22 02:43:35 +02:00
François Revol
ade89bf38e PPC: simplify the bootloader linker script
the OF 2.0 COFF loader skips sections other than
.text .data and .bss, so merge others into those three.
2015-04-22 02:43:34 +02:00
François Revol
c3bffc88c9 fix warnings 2015-04-21 00:25:30 +02:00
François Revol
10e57f6e58 PPC: fix handler type cast 2015-04-20 17:19:33 +02:00