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.)
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.
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.
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.
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.)
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]>
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.
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.
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.
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.
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.
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.
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.
* 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.)
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.
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.
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.
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.
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.
* 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]>
* 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.
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.
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.
* 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.
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.
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.
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.
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]>
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]>
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.
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.
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]>
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]>
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.
* 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.
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.
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.
B_FILE_ERROR == EBADF == "Bad file descriptor". It's used
when there's no valid file descriptor, or when attempting
a read or write operation on a file descriptor not opened
with that mode. All other places should use B_IO_ERROR or
some other like value, instead.
The tty_notify_select_event() at the end of tty_close_cookie()
checked if the other_tty's open_count was > 0 before notifying.
But in the case where the master is closing all children,
it will drop to 0 and leave things still in the select pool.
So we should notify unconditionally here.
Additionally, use B_SELECT_DISCONNECTED (i.e. POLLHUP). This matches
what Linux seems to do.
Fixes#19714.