Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier b0570368f3 limits.h: Clean up and fix _POSIX_* values.
These aren't actual limits, but rather the minimum limit
as specified in POSIX (e.g. _POSIX_NAME_MAX is the minimum
allowed value for NAME_MAX).

Add missing values as defined in POSIX-2024, at least for
features we support, and change wrong values to be the ones
specified in POSIX.

No behavioral intended change (nothing should be using these directly.)
2026-01-06 19:57:07 -05:00
Augustin Cavalier d763a3829a semaphore.h: Add SEM_VALUE_MAX.
It's specified in POSIX, and FreeBSD puts it in this file.

Distinguish it from _POSIX_SEM_VALUE_MAX (which is really a
"minimum value this can have" as specified in POSIX.)
2026-01-06 19:40:23 -05:00
Augustin Cavalier ca5c5d531e unistd: Add _POSIX_DEVICE_CONTROL.
We have posix_devctl, so we should declare this now.
2026-01-06 19:38:49 -05:00
Augustin Cavalier 1e4c529aeb search.h: Declare posix_tnode as specified in POSIX-2024.
FreeBSD does the same.
2026-01-06 19:37:53 -05:00
Augustin Cavalier f869860377 kernel: Return B_HAIKU_VERSION for kernel_version & handle it in uname().
We have returned "1" here since this code was originally written
in 2004 (hrev7290). BeOS R5 apparently returns "1000009" for this
value, while the Be Book gives no details about what this value means.

So, return an actually useful value of the Haiku version, and then
in uname() process this to return a string indicating the Haiku
version. This makes "uname" print the actual system version,
not just the hrev.

It appears Linux and other systems give non-integer values in
info->release, so this should be fine.

Fixes #17030.
2026-01-06 19:30:44 -05:00
Augustin Cavalier 6a1ad86129 Debugger: Fix jobs trying to re-add dependencies.
Linked lists are used to manage these, so if we re-add
jobs we'll corrupt the linked lists and cause crashes.

Fixes #19864 and possibly others.
2026-01-06 18:01:24 -05:00
Augustin Cavalier 708d8e42c3 ps2: Disable v2.
It isn't working properly; see #19874.

Leave the others enable for testing for now. We can disable them
in the beta6 branch if necessary (if nobody reports that they are
indeed working.)
2026-01-06 16:24:03 -05:00
Augustin Cavalier 33bc049b2d freebsd_wlan: Don't include stdbool.h under C++.
Should appease GCC 2.
2025-12-30 22:04:33 -05:00
waddlesplash 781af7ad7a Revert "makebootable: guard against writing to non-bfs partitions"
This reverts commit 41f7e3c29a.

It breaks generation of @*-raw images: they weren't bootable anymore
after this change.

Change-Id: I23afdb99fd7b14d5e5a0dc5d3db244a83817ae4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10173
Reviewed-by: waddlesplash <[email protected]>
2025-12-31 02:58:18 +00:00
Augustin Cavalier 80dc70d5df drivers/ether: Synchronize intel22x, ipro1000, iflib with FreeBSD 15. 2025-12-30 21:56:34 -05:00
Augustin Cavalier 829caf8905 freebsd_network: Additions and motifications for FreeBSD 15 iflib drivers.
* Rewrite machine/atomic.h for clarity and correctness, and add
   a few methods.

 * Add two methods to libkern.h.
2025-12-30 21:55:45 -05:00
Augustin Cavalier a564fd3ccd drivers/ether: Synchronize all non-iflib drivers with FreeBSD upstream.
Mostly minor changes. (Some related to power management refactors
not imported for now.)
2025-12-30 21:54:35 -05:00
Augustin Cavalier e67600e2a4 Synchronize net80211 and all FreeBSD drivers with upstream 15.0.
Tested with realtekwifi.
2025-12-30 19:49:40 -05:00
Augustin Cavalier 4203e71194 freebsd_network: Split m_get3 out of m_get2.
The manpages indicate get2 will return NULL for anything larger
than MJUMPAGESIZE.

(The soon-to-be-merged realtekwifi from FreeBSD 15 uses m_get3 directly.)
2025-12-30 19:18:32 -05:00
Augustin Cavalier e923b9b52b checkfs & resizefs: Adapt following API change in the Storage Kit.
This function always declared that it returned status_t, but
then in practice it didn't. In d225106a20
that was fixed, so these workarounds can be removed now.

Fixes #19862.
2025-12-30 18:36:25 -05:00
Augustin Cavalier ea58f1fc7c kernel/vm: Add missing Put() when removing a reserved area.
This code is triggered whenever an area gets resized to be as large
as, or larger than, a reservation. That can happen with the new heap
when it grows to rather large sizes, in which case we would then leak
the address space when the team was deleted (including all the page
table memory.)

Fixes memory leaks seen e.g. when running Rust compiles, and especially
other short-lived but high-memory-use applications.
2025-12-15 21:24:22 -05:00
Augustin Cavalier 51d39dc74f kernel/vm: Put the address space in get_memory_map_etc.
We don't need a lock here (as we just want the TranslationMap),
but we do need to release the reference we acquired when finished,
otherwise the address space will be leaked.
2025-12-15 21:21:51 -05:00
Augustin Cavalier 24f5beed39 kernel/vm: Minor code cleanup to get_memory_map_etc.
* Move variable declarations closer to use.

 * Adjust comment to be similar to other functions.

No functional change.
2025-12-15 21:21:17 -05:00
Augustin Cavalier ab701fd69e kernel/vm: Print thread ID as decimal, not hex.
Matches the other places this is done.
2025-12-15 21:19:56 -05:00
Augustin Cavalier 0110436f37 ProcessController: Add casts to appease GCC2. 2025-12-15 13:48:57 -05:00
Augustin Cavalier 1e3d21fd30 ProcessController: Allow manual resizing of the replicant window.
There's no real reason to forbid it.

Fixes #13173.
2025-12-15 13:38:42 -05:00
Augustin Cavalier f77f533f72 ProcessController: Scale width by height.
This makes ProcessController look a whole lot nicer on HiDPI.
Tested with 12pt (should be the same), 18pt, 24pt fonts.
2025-12-15 13:34:55 -05:00
Augustin Cavalier 4523120b97 ProcessController: Refactor size computation.
* Don't duplicate the logic, put it all in one place: in a
   static method of the main class.

 * Compose sizes in PCWindow.

Fixes #18049.
2025-12-15 13:34:23 -05:00
Augustin Cavalier 42bb2865fd ProcessController: Base margin on font size.
Arrows don't overlap bars in HiDPI anymore.

Fixes #16306.
2025-12-15 11:58:02 -05:00
Augustin Cavalier 0630e71e0e BuildSetup: Remove some unnecessary disabling of DEBUG.
All these can be built with DEBUG=1 now, it appears.
I tested most of the others and they still fail.

(The settings in this section can be overridden by setting something
else in UserBuildConfig, it appears; they're likely only relevant
when trying to build the entire tree with DEBUG=1.)
2025-12-12 21:19:35 -05:00
Augustin Cavalier a7ee307329 kernel/fs: Clean up and improve logic around address copying.
This follows up after 3b7038d884: migrate the copy-from-userland
logic into a separate method, migrate all consumers to use it, and
add more missing checks and initializations.

Change-Id: I6a2e11a2d0fae7ecf1c94f5b112fa946aaef68ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10055
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-12-12 05:20:38 +00:00
Augustin Cavalier 758538e666 UDF: Put the root node in unmount.
Fixes #19845.
2025-12-09 21:33:29 -05:00
Augustin Cavalier 0125f39fd4 UDF: Upgrade some more TRACEs into ERRORs.
Otherwise it won't be clear why some volumes aren't able to
be mounted.
2025-12-09 21:33:13 -05:00
Augustin Cavalier 333909db33 kernel: Adjust missed OpenHashTable include. 2025-12-09 16:18:49 -05:00
Augustin Cavalier 1257e2ba22 Move most headers containing generic template classes out of kernel/util.
This follows on the move of BitUtils. Many of these headers were
already used in userspace.

Fixes #19849.
2025-12-09 16:11:46 -05:00
Augustin Cavalier 9f786b6af7 Rename "headers/private/utils" to "util".
This undoes some changes from cf930b7e6c.

Nearly all the other utility directories in the tree are named "util"
not "utils", so let's be consistent.
2025-12-09 16:03:02 -05:00
Augustin Cavalier 9c4c97f7f1 BUSBInterface: Fix incorrect management of fEndpoints on updating.
num_endpoints will be changed by the ioctl; we need to use the old
one when deleting the array.

fDescriptor is just zeroed if we fail to fetch, so just perform
the deletions up-front.
2025-12-09 15:00:47 -05:00
Augustin Cavalier 3b66de32f4 libroot/strftime: Add support for %k and %l.
These aren't in POSIX but glibc and FreeBSD support them,
and our ICUTimeData class expects that strftime will handle them.

Fixes #18471 and some of the problems described in #14356.
2025-12-04 16:41:45 -05:00
Augustin Cavalier 984dfdee36 ICUTimeData: Replace all spaces with a regular ' '.
ICU 72 started using Unicode spaces in many patterns.
We don't want those here, so just replace them with
a regular ASCII space character.
2025-12-04 16:23:49 -05:00
Augustin Cavalier 49a702dd58 libroot/locale: Only set all locales if we checked the whole set.
If we only checked one, then of course we can't set LC_ALL,
as that will override ones we didn't verify were the same.

Seems this code has been wrong since it was first imported in 2010.

Fixes #19446.
2025-11-29 19:38:37 -05:00
Augustin Cavalier 1f58862893 app_server: Acquire the window lock in Set*Cursor.
SetScreenMode() and other methods around here also acquire it
in this way.

Adjust one place in ServerApp that would cause a lock-order-inversion
otherwise.

Should fix #19837.
2025-11-29 19:20:42 -05:00
Augustin Cavalier 39c7c29e69 net_server: Run DHCP negotiation on a separate thread to fix hangs.
Previously we ran DHCP negotiation on the looper thread. This meant
that we just blocked it for long periods of time, which stopped
configuration settings changes from working properly, and causing
the Network preferences panel to hang when net_server failed to
respond to its messages.

Now, we spawn a separate thread to do the real work on, and unlock
the looper around the recvfrom() with long timeouts. There's now a
kMsgAutoConfigureFailed that is sent when auto-configuration fails,
so that the AutoconfigLooper can fallback as before. Additionally,
the main NetServer class quits loopers for devices on any configuration
change, rather than deferring it unecessarily (and possibly wrongly, in
some cases.)

Fixes #18037. Probably fixes #17300 and may help with others.
2025-11-27 14:30:54 -05:00
Augustin Cavalier 9cbbc82087 kernel/fs: Block mounting partitions that are already mounted.
Previously this actually succeeded, which could obviously cause
disk corruption and other such problems.

While at it, clean up some code style.

Fixes #16734. Related to #19303.
2025-11-26 23:03:51 -05:00
Augustin Cavalier 5373300610 app_server: Remove window token first in ~ServerWindow.
This way, if the Desktop has locked its window list, RemoveWindow
will wait until the lock is released, at which time we're guaranteed
that the Desktop object will no longer be using this window.

May fix #19750 and related tickets.
2025-11-25 18:46:21 -05:00
waddlesplash b5f59c2d1c Merge "Fix bootstrap build for arm and arm64" 2025-11-22 18:03:38 +00:00
Augustin Cavalier d39ce117e0 app_server: ServerMemoryAllocator takes the original area as the key.
Should fix memory leaks caused by fe8f88cff4.
2025-11-19 16:20:39 -05:00
Augustin Cavalier 1838903ee6 RosterPrivate: Define kMsgAppServerStarted as uint32 to appease GCC2. 2025-11-19 00:46:04 -05:00
Augustin Cavalier 49a92384f4 servers & kits: Rehabilitate app_server restart functionality.
* It's not really possible to distinguish between a first startup
   and a restart inside app_server itself. Due to the new BServer
   setup, the same port will still be used, too. So, change the
   messages sent to just "AppServerStarted".

 * Since the message is sent out much later than the port is created,
   by the time applications see it, the app_server may have already
   been started a while and applications may have connected to it.
   So, check if we really need to reconnect in BApplication before
   actually trying to do that.

 * BWindow now starts with updates disabled, so they must be
   enabled after reconnecting.

After this commit, basic app_server restart functionality works again;
it's restarted automatically by launch_daemon after dying or being killed
and applications automatically reconnect. However, some problems still
linger (e.g. Terminal doesn't always recreate its windows, colors
on the Desktop look wrong, missing desktop background image, etc.)
2025-11-18 22:26:31 -05:00
Augustin Cavalier fe8f88cff4 app_server: Rework ClonedAreaMemory to use ServerMemoryAllocator.
This takes advantage of the new reference (use)-counting logic
inside ServerMemoryAllocator to not re-clone areas needlessly.

Fixes #8501.
2025-11-18 20:10:05 -05:00
Augustin Cavalier 2661f371fb Debugger: Don't wait for threads or user in the CLI input loop.
It seems to be unecessary and just hangs the CLI most of the time
if there's no thread about to stop.

Makes Debugger --team <team> actually work instead of just
hanging.
2025-11-18 18:45:06 -05:00
Augustin Cavalier f4415c8657 tests: Rehabilitate bootloader test.
Now builds and starts again, at least.
2025-11-18 17:39:16 -05:00
Augustin Cavalier d640e20575 BeBuild.h: Add _DEPRECATED.
Change-Id: I983e89fa5324983f3721c50904d2a1d9b2014009
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9087
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: X512 X512 <[email protected]>
Reviewed-by: nephele nephele <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-11-16 16:37:38 +00:00
Augustin Cavalier dee9cb73c6 partitioning_systems: Move Intel-related classes back to the "intel" folder.
This partially reverts commit 61790bdb8a.

These aren't really "common", they're specific to the "Intel" partitioning
system, which GPT also interacts with. So, move them back to the "intel"
folder, but keep the static library setup the commit moving them
to the "common" folder created, which is indeed better and was most
of the advantage of that commit.
2025-11-14 19:24:22 -05:00
Augustin Cavalier 775449bef9 kernel/vm: Don't shrink commitment on precommit in VMAnonymousNoSwapCache.
Same change as was made for VMAnonymousCache.
2025-11-14 19:06:11 -05:00
Augustin Cavalier db168093dd kernel/vm: Adopt() in overcommitting caches needs to adopt commitment.
Fixes incorrectly low commitments causing assertion failures
under AddressSanitizer.
2025-11-14 18:48:25 -05:00
Augustin Cavalier 1dd462720e kernel/vm: Don't shrink commitment on precommit in VMAnonymousCache.
If we were "donated" some commitment (e.g. in copy_on_write_area)
then we don't want to drop it when pre-committing.

Fixes some commitments being too low in forked teams.
2025-11-14 18:48:25 -05:00
Augustin Cavalier 527f059fb1 kernel/vm: Adjust some out-of-date doc comments. 2025-11-14 18:48:24 -05:00
Augustin Cavalier d530817956 Debugger: Fix lock order inversion in CliContext::PrintCurrentThread.
Fixes some hangs in the CLI.
2025-11-13 15:22:57 -05:00
Augustin Cavalier 78e1c0f063 Debugger: Handle terminations occurring during WaitForThreadOrUser.
Otherwise we enter an infinite loop.
2025-11-13 15:22:22 -05:00
Augustin Cavalier 82b9d8f1f7 bootloader: Make Partition::Size return the partition's size.
Partition::ReadAt() and WriteAt() already do bounds-checking
based on the size, but Size() was returning the underlying FD
size, which might be that of the entire disk, not just this
partition. So, move initialization around a bit, and return
the actual size.

Should fix the bootloader menu displaying the wrong sizes
for boot partitions.
2025-11-12 16:50:37 -05:00
Augustin Cavalier f4344e53b8 Interface Kit: Use computed spacing for tooltips.
B_USE_HALF_ITEM_SPACING is 6 with a 12pt font, so this increases
the insets slightly. B_USE_BIG_SPACING should be 20, so that
should be the same.

Improves tooltip appearance on HiDPI.
2025-11-12 16:40:25 -05:00
Augustin Cavalier a9cde90d40 IPv4 & TCP: Implement naive Path MTU Discovery.
* Set IP_DONTFRAG on all TCP sockets by default.

 * Handle receiving B_NET_ERROR_MESSAGE_SIZE, update MaxSegmentSize
   appropriately, and trigger retransmit.

Tested and verified as working.

Part of #1073. However this doesn't implement all of what's needed,
only the most basic form of the algorithm (we don't record MTUs
for reuse later for instance, right now we only store routing
information for the LAN, it appears, so we will need somewhere else
to store that.)

Change-Id: I37a24b50db18af908c6f6257c6fb6d72127d2787
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9402
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-11-12 20:48:08 +00:00
Augustin Cavalier b1231e164d nvme_disk: Add include to fix the build on RISC-V.
Seems this is implicitly included on other architectures somehow.
2025-11-12 14:48:08 -05:00
Augustin Cavalier eb3cdab6e6 nvme_disk: Use IORequestOwners to avoid recursion.
Should fix #19505.
2025-11-12 14:30:07 -05:00
Augustin Cavalier 0e9d580c73 IOScheduler: Rework IORequestOwner management.
* Make IORequestOwner an abstract (ish) class, and move details
   to the Scheduler implementations. This will allow other drivers
   (like NVMe) to use their own, separate IORequestOwner system.

 * Use an object_cache to allocate IOSchedulerSimple::RequestOwners.
   Previously, a single block large enough to store one for every
   thread at maximum thread count (4096) was allocated, meaning
   a few hundred KB per IOScheduler. In the case of low memory,
   a fallback IORequestOwner with a thread ID of -1 is used.

Tested with IDE and usb_disk drivers, seems to be working.
2025-11-12 14:30:06 -05:00
Augustin Cavalier 0ae42c46b1 kernel/vm: Don't change commitment in the Rebase step in the middle-cut case.
As we may have stolen some commitment from the first cache already,
so it will try to increase it here, which won't work if the system
is low on memory.

Should fix #19813.
2025-11-11 20:43:40 -05:00
Augustin Cavalier 21e1997980 kernel/vm: Previously-shared caches may have a different base or size.
Than the one used by the area, anyway, so we need to call Rebase
as well as Resize in all cases where the cache is getting reused.

This case happens (rarely) with the bdwgc's gctest, with mprotect VBD
enabled (which still doesn't work reliably, it sometimes crashes userland
or trips asserts in the kernel, but it seems to trip less after this
change.)

Also, let the CacheChainLocker take care of releasing and unlocking
the cache even in the onlyCacheUser case.
2025-10-31 21:55:57 -04:00
Augustin Cavalier ce88914d78 libroot/malloc: Need to set active inside malloc_usable_size.
Otherwise we'll hit assertions later.
2025-10-31 20:58:01 -04:00
Augustin Cavalier 2d03a444ad BColumnListView: Fix column header color management.
* Use the control color, which is what DrawButtonBackground expects
   to get the previous appearance.

 * Actually use the HEADER_BACKGROUND color from the main view,
   which previously was not used at all, allowing applications
   to override.
2025-10-31 19:51:51 -04:00
Augustin Cavalier 50efce8a80 Tracker: Fix column header background color after control color changes.
BControlLook::DrawButtonBackground now expects the control color
directly, not the panel background color.

Restores the previous appearance (or one close to it) from before
the control color changes.
2025-10-31 19:50:33 -04:00
Augustin Cavalier 4b35628556 kernel/vm: Clarify logic and fix ReleaseRef invocation in map_backing_store.
sourceCache is now only != NULL if it represents the "cache"'s source.
And "cache" will always be locked when we get to "err2", so we need
to use ReleaseRefAndUnlock.

Should fix #19810.
2025-10-31 17:36:04 -04:00
Augustin Cavalier 6831a05164 kernel/fs: Fix mismatched allocation/free in vnode_path_to_vnode.
Should fix #19811.
2025-10-31 15:22:10 -04:00
Augustin Cavalier 960caad380 Application Kit: Account for empty BRegions in LinkReceiver.
Fixes #19799.
Supersedes https://review.haiku-os.org/c/haiku/+/9744.
2025-10-30 23:15:10 -04:00
Augustin Cavalier cb311484f4 kernel/guarded_heap: Release initial cache reference later.
It may trigger allocation of magazines in the object_cache,
which won't work properly while we are in a partially-initialized state.
2025-10-30 23:10:20 -04:00
Augustin Cavalier 14d2f03b3d kernel/vm: Add an ASSERT(wiring != B_ALREADY_WIRED) to create_area.
Creating areas with B_ALREADY_WIRED is done early in the boot process
after VM initialization to create area objects for pages that have
already been allocated and mapped. As such, it should absolutely never
fail, since nearly everything should already have been set up.

But if it does fail, that almost certainly means it either should not
have been called in the first place, or there is some sort of invalid
state. Testing with ARM64 builds, this assertion trips, revealing
that the kernel is actually being placed outside of the declared
KERNEL_BASE+KERNEL_SIZE at present.
2025-10-30 22:42:58 -04:00
Augustin Cavalier d91b1f9f70 libsolv: We need _DEFAULT_SOURCE not _GNU_SOURCE. 2025-10-30 22:39:40 -04:00
Augustin Cavalier 7af0ffd31c Terminal: Drop incorrect declaration.
BColorPreview is in a different namespace now.
2025-10-30 22:39:27 -04:00
Augustin Cavalier 4615980f9b libroot/malloc: Don't use PROLOGUE/EPILOGUE in malloc_usable_size().
To appease a GCC warning and a Clang error about an incorrect
return type from those macros.
2025-10-30 22:38:51 -04:00
Augustin Cavalier 5f6852d862 libroot/glibc: Import changes from upstream to remove inline function in printf_fp.
Clang does not support this extension.
2025-10-30 22:37:51 -04:00
Augustin Cavalier 515f50d1f7 libroot/glibc: Add declarations of debugger() and abort() to appease Clang. 2025-10-30 22:37:22 -04:00
Augustin Cavalier 5769051834 kernel/vm: Drop methods used only by the old guarded heap.
They're not needed anymore. The VMTranslationMap method was confusingly
named anyway, as the other Debug* methods are for use in KDL, while
this one required the regular locks and flush mechanisms.

Change-Id: Ic1baf3d786071562d8beaeb768d996cd1d34f9b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9706
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-10-31 02:36:19 +00:00
Augustin Cavalier d36a3e286b kernel: Rewrite guarded_heap.
Compared to the old kernel guarded heap, this new one:

 * Uses VMTranslationMap and related APIs directly, rather than
   indirectly through the "protection cookie" system. This means
   those custom APIs, which nothing else except the guarded heap
   used, can now be dropped.

 * Does not allocate vm_pages for guard pages, and frees vm_pages
   when not in use. This means that DISABLE_MEMORY_REUSE is much
   more usable now, as it only does not reuse virtual memory,
   allowing for much longer-running systems.

 * Uses trees to manage meta chunks. This avoids unbounded growth
   of the meta chunk count, especially under DISABLE_MEMORY_REUSE.

 * Handles page faults directly and prints information about the
   fault address/allocation automatically.

The system still boots and runs fine with this new guarded heap,
including under USE...FOR_OBJECT_CACHE.

Change-Id: If85e5689a47088790287990c881364fcde4cc76d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9705
Reviewed-by: waddlesplash <[email protected]>
2025-10-31 02:36:19 +00:00
Augustin Cavalier 89f76d7509 kernel/vm: Fix double-read-lock in user_set_memory_swappable.
lock_memory_etc also acquires the address space read lock.
So, just perform that step first and separately from the loop.

Discovered by the RW_LOCK_DEBUG assertions.
2025-10-17 15:56:56 -04:00
Augustin Cavalier c02707824b kernel/fs: Add some more lock assertions. 2025-10-17 15:50:51 -04:00
Augustin Cavalier 0f9f1f124f kernel/vm: Add some more assertions. 2025-10-17 15:43:03 -04:00
Augustin Cavalier a1ef046ad7 kernel/locks: Dump reader threads in "rwlock" command under RW_LOCK_DEBUG.
This makes debugging rwlock deadlocks easier (under kernels with this
option enabled, anyway, which it isn't by default.)
2025-10-17 15:29:31 -04:00
Augustin Cavalier 959feb6161 kernel/fs: Add missing early return in create_socket_fd.
May fix #19682 and others.
2025-10-13 23:16:45 -04:00
Augustin Cavalier f7d2fc176e kernel/slab: Add some more info to a paranoid ASSERT in object_cache_alloc.
This was triggered in #19782. Ultimately more information will be
needed to diagnose what overwrote the memory, and this is a start.
2025-10-10 21:16:20 -04:00
Augustin Cavalier 9359d0860b BWindow: Fix confusion between modifiers and "prepared modifiers".
The former must have B_NO_COMMAND_KEY if the shortcut has no command key,
while the latter should simply not have B_COMMAND_KEY.

This mixup meant that modifiers flags without either set were
passed back to BMenuItem, which then used them when calling
RemoveShortcut(), but that method expects B_NO_COMMAND_KEY
to be specified, so the shortcuts weren't really removed,
resulting in use-after-frees.

Fixes #19426 and related issues.
2025-10-10 16:20:03 -04:00
Augustin Cavalier 4ccb957d6c x86_acpi_cstates: Port to the new ACPI and CPUIDLE APIs.
Tested by OscarL and confirmed to be working on at least
one machine, though on others it hangs, so leaving out
of the default builds for now.

This adds an "acpi_processor_id" field to x86 arch_cpu_info,
gleaned from the MADT, so we can match our cpu_ents to ACPI
processor objects. (FreeBSD does a similar mapping, see
their acpi_cpu_probe method.)

Change-Id: Idb5e3c1fc1efaa4256d60ea17dd1824345369687
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9637
Reviewed-by: waddlesplash <[email protected]>
2025-10-10 18:24:56 +00:00
Augustin Cavalier 779ae8bcd3 EHCI: Try to use physical buffers directly when possible.
EHCI has more DMA restrictions than XHCI, so if we can't use them,
we just fall back to copying the buffers as before.

Tested in QEMU, system booted successfully. However, it seems that
quite a lot of disk I/O can't use physical buffers here, probably
due to packagefs' use of uncached reads.

Change-Id: I4d35642ee1a8f5ba2531f6658f8cbbef5a7785ac
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9613
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2025-10-01 13:09:34 +00:00
Augustin Cavalier db179db57b kernel/events: Fix double-free in create_select_sync.
The wait_for_objects_sync destructor already deletes the set.

Fixes #19566.
2025-09-19 13:17:04 -04:00
Augustin Cavalier 771bccb4b9 network/stack: Assume no hook means no ancillary data.
At least for process_ancillary_data_no_container, anyway,
which is only used by the IP modules at present.

Fixes #19756.
2025-09-17 17:21:30 -04:00
Augustin Cavalier bc5eb45ad5 tests: Fix unix_dgram_test after socket signals refactor.
Some calls now need MSG_NOSIGNAL.
2025-09-17 17:06:38 -04:00
Augustin Cavalier 6b4d2c8127 tests: Add a test for #19755 to the SocketTests. 2025-09-17 17:05:49 -04:00
Augustin Cavalier 17ec872f61 network/stack: There may be no data specified in the header.
This is an odd case, but we must not crash if it does happen.

Fixes #19755.
2025-09-17 17:03:02 -04:00
Augustin Cavalier 1b745b2d9d HaikuBootstrap: tty is now pty. 2025-09-17 15:19:55 -04:00
Augustin Cavalier 39a01464d8 x86_cstates: Log errors indicating why C-states can't be used.
As long as we have MWAIT and invariant TSC, anyway.

Also add a check for VENDOR_INTEL for the C5/C6 state disabling.
2025-09-17 15:19:37 -04:00
Augustin Cavalier 368d09fdac freebsd_network: Clean up attach logic and separate USB logic.
USB code now goes in a separate static library.

This also paves the way for supporting more busses than PCI
and USB in the compat layer.

Tested with realtekwifi, still works.
2025-09-09 19:05:57 -04:00
Augustin Cavalier a1b4eeff4d freebsd_network: Overhaul MII attach code.
* Move ukphy ("unknown phy") code into the compat layer rather
   than duplicating it across many drivers.

 * Move MIIbus related code to a separate static library.

 * Genericize most attach methods that touched the MII bus directly
   to not need the code that's now in the static library.

Tested with rtl81xx, still works.
2025-09-09 16:59:21 -04:00
Augustin Cavalier 2aab5f5f14 FlatControlLook: Pull in color tinting changes.
This partially synchronizes to "upstream" commit 3c144bdfe53c61e2589e209d419f28f94ac77151.
Some of the more functional changes and new features I didn't import,
but mostly just the color tinting changes to match the new control colors.
2025-09-09 13:23:28 -04:00
Augustin Cavalier b9438b95f5 kernel/slab: Alter behavior of the ObjectDepot under PARANOID_KERNEL_FREE.
Instead of reusing objects as fast as possible, use two magazines per
CPU, and allocate and free objects from separate magazines, always
exchanging full and empty ones with the depot. Furthermore, reverse
the ordering of objects in full magazines, to get FIFO rather than
LIFO behavior.

sys time on "git status" and "compile HaikuDepot" benchmarks in
a 4-core VM seems increased by about 5% at most (e.g. 8.2s -> 8.6s.)
This may help with further catching use-after-free and other like
problems, so it seems worth it to leave enabled on KDEBUG.
2025-09-08 17:21:38 -04:00
Augustin Cavalier e3d01e53a2 kernel/slab: Use FIFO queuing for PARANOID_KERNEL_FREE only.
FIFO does seem to be a slight performance hit, and the security benefits
are probably not too large in the end. So just use LIFO otherwise.
2025-09-08 14:06:51 -04:00
Augustin Cavalier cac7959664 openbsd_network: Increment the OPACKETS counter in ifq_dequeue.
Otherwise it's never incremented, and the number of transmitted
packets in ifconfig would stay 0.
2025-09-08 13:12:27 -04:00
Augustin Cavalier 01f5b3146f kernel/fs: Add some missing descriptor open_mode checks. 2025-09-04 12:48:04 -04:00