This should make use-after-frees more likely to be caught by the
standard paranoia facilities (and make them less likely to be
exploitable as memory will take longer to be reused.)
As this is part of POSIX since 2024, WCOREDUMP is the new default name.
WIFCORED is retained under _DEFAULT_SOURCE.
Fixes#19735.
Change-Id: Ic3f65e47b436bae92fe82ef73c3094be6bc9f29d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9622
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
These instructions are only available on more recent CPUs (MWAITX
on AMD since around 2015 or so, TPAUSE on Intel since around 2020.)
They allow idly waiting on the TSC even when interrupts are
disabled.
Most hypervisors do not have these available (KVM does provide
them, though not on all configurations), but on bare metal this
should make a nice difference to KDL power consumption: I tested
with a Ryzen 3700X, according to my UPS (so including monitor
and peripherals) the system used ~106 W at idle, 160 W in KDL
before this patch, and 125 W in KDL after it.
Change-Id: Id7a22ecd33f3fc005b2c312f945dc3cd364e96fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9604
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
The idea is to add a facility that will use less CPU than
the loops we currently use. The default implementation just
calls spin(), which is rdtsc+pause. This already may save
some power compared to what we previously did, which was to
re-check serial ports, PS/2, etc. every single loop in
the debugger, broken up only by "pause".
Change-Id: Ie421adae5c25ad6ae0c266d1d28c2ea7b81ae465
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9603
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This massively cuts down on lock contention in Add(), since insertions
only acquire a write-lock in the case where a generation rolls over,
same as Lookup() does.
"git status" in buildtools, cold disk cache in a 4-core VM, seems about
the same, maybe slightly slower (~0.5s seemed typical, out of 20-21s),
while with a hot disk cache it's much faster: ~9.8s -> ~2.4s. Compile
performance seemed about the same.
Change-Id: Ia73f35fbbad3b3ac9ed783ea38cb8e2cb9818b5b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9580
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
* Correct code that only works when sector size is 512 bytes.
* For devices with 4096-byte sectors, use 4096 as the size of blocks
in the block cache, and as the unit of IO requests in FAT
operations.
* Some values continue to be stored in 512-byte units, regardless of
sector size, in keeping with the original BSD driver.
* Fixes#19686.
Change-Id: I8fa77aeab1bc93a5465134018c3113afb2a80b8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9542
Reviewed-by: waddlesplash <[email protected]>
Fix bug that allocating/freeing a lot of BHandler cause token wraparound
and overwriting existing assigned tokens.
Change-Id: I12527126644bca1793a8475dc487f131e6f83437
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9533
Reviewed-by: waddlesplash <[email protected]>
Use new DraggableContainerIcon name when invalidating icon.
Create a ShouldHaveDraggableFolderIcon() method on BContainerWindow
to consolidate the gating logic to a method.
We alert if you try and copy, move or create link to any of these
directories, however you may drag the icon in some instances such as
to change the directory in a file panel or to open the directory up
in FileTypes. You may create a link to the printers directory.
Set the Printer icon on the printers directory.
Fixes#3385
Tracker: Disks menu in CountView
* Open Disks directory on click.
* Skip volumes with no capacity (e.g. system, config) from
Root and Desktop menus (still shown in Home and volumes though).
* No Trash on volumes, add only to Desktop.
* Declare some variables outside loop.
* Rename originatingWindow to source.
Fixes#3549
Change-Id: I66318d2485a5a8405f5459c355a467f34e19ecc5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9499
Reviewed-by: John Scipione <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Add the following:
- CS and SS registers
- For 32bit: DS, ES, FS, GS registers (on 64 bit these are not part of
the iframe structure)
- CR2 register (fault address)
- Hardware interrupt number
- Hardware error code
The hardware error code, interrupt number and fault address are not
modifiable by the signal handlers. The other registers can be modified.
This is used for example in dosemu to intercept errors from JIT generated
code and resume execution. Wine can also make use of it.
In order to not change the size of struct mcontext, these are inserted
in a region of the FXSAVE structure that is available for the OS to
store some data (as documented by Intel) and that we didn't use before.
Fixes#7867
Change-Id: Ia3c27a2c728e32995196c646c1d78adf40e793ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9456
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
The RTLD_GROUP flag to dlopen comes from Solaris. It makes the symbol
resolution for dlopen not use the global symbols from the current team
(anything that's already loaded). The loaded object must be explicitly
linked against any symbol it needs to use (or it can use dlsym to search
symbols in the global scope explicitly).
This is also how symbol resolution worked in BeOS, meaning we already
have the code to do this, and just need to enable it.
This can be used in dosemu, where DOS-like executable are linked against
their own C library and should not use symbols from libroot.
Fixes#19674.
Change-Id: I8d127c7812a31e231edb1e44edf70b868c2670e7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9450
Reviewed-by: waddlesplash <[email protected]>
Like check_access_permissions() but for write_stat() hook instead
of access().
Basic logic copied from BFS, but with the UID/GID logic rewritten
to better conform to behavior on other OSes: notably, we allow
chown() requests that keep the UID the same to go through, same
as Linux seems to, which should fix#19666. We now also validate
that the GID is one of the current team's groups.
That is, just add the supertype if it does not exist. Leave getting it
to the callers that need it.
Fixes: #19653
Change-Id: I79d804161d28684e16a0d84ec3a2fb6788c0b506
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9436
Reviewed-by: waddlesplash <[email protected]>
x86_64 already does this and it seems to work fine. Since stack areas
grow downwards and should always have a guard page, overruns shouldn't
be too much of a concern (for that matter, randomization still makes
a difference here also, it seems.)
This allows us to regain another ~256 MB or so of contiguous address
space (areas smaller than that could still be inserted in the 0x6.. to
0x7.. block, but if you had 10MB of free address space below 0x6..,
and 246MB above it, you couldn't allocate a 256MB block.)
Part of #19592.
Remove shared message handling from ColorListView,
you are expected to implement this yourself and these
message constants were not actually being used by
the message target.
Do color drop handling in Appearance and Terminal.
Handle all color drops in WasDropped().
Allow current selection to remain, only update color.
TODO Changing selection on external drops should be
fixed in BListView. Work-around in BColorListView.
Fixes#19562
Change-Id: Ic99bbb1288fd736778eac831d38e453122815abc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9296
Reviewed-by: John Scipione <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
To allow consumers to cause the "don't fragment" bit to be set in
all IPv4 packet headers.
There is no standard way of doing this, and different OSes expose
this option in different ways. Linux has "IP_MTU_DISCOVER", but it
takes an enum, not a boolean. NetBSD and OpenBSD appear to have
no socket option, instead they have "IP_MTUDISC", an option for
the "ip_output()" kernel-level network stack method.
"IP_DONTFRAG" sockopt originates on FreeBSD, and it seems macOS now
also supports it in version 11+. Windows has "IP_DONTFRAGMENT",
which, at a glance, appears to do the same thing. So this looks
like the one that makes the most sense to adopt.
This doesn't add any code to process MTU changes yet, though.
Change-Id: I492d22dbd0ee5f4ab35c600396ad3d3ec9f4f200
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9401
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Same structure as used for error_reply, to contain information
(like path MTU or redirect gateway) from the original error packet,
so that upper layers don't have to re-parse it.
Nothing uses or passes it around at present, but it will be used
in the next commits.
Change-Id: I38a3dec5506bdcb77a7850294082db7be74dd80f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9399
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
* POSIX also specifies in6 availability in in.h, not just RFCs.
* Drop IPPORT_USERRESERVED. It's in RFC 1700, but FreeBSD and musl
do not define it, and OpenBSD and NetBSD disagree on its value
(the RFC says 5000, while OpenBSD used this "49151" starting
in 1998.)
* Organize the remainder with clear indications of what RFC defined them
(if indeed they were specified in an RFC.)
* Drop "helpful macros"; they're guarded by _KERNEL on OpenBSD.
Change-Id: Ia20be56398130ee22d70b38ee25a3f609b567c3b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9398
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
checked against the output of the test sortix/os-test/udp/connect-send-error-send
* icmp: add more error codes
Change-Id: I7b1695d37cf5eae8cd09132047404b990f8791dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9394
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
BView-related code removed or disabled, of course, but this now uses
the ColorConversions class, and adds some more ImportBits APIs from that.
Change-Id: I805cef159bac52173ef16030eae69e83db6f061b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9391
Reviewed-by: waddlesplash <[email protected]>
Previously it used "contrast" and "brightness" values that were
computed in strange ways. Now it behaves more like the other
color computation functions and deals with the "flags" directly.
Comparing many controls, colors on button frames in all states appear
to be the same (or nearly the same, within 1-2 RGB values) before
and after this change.
Change-Id: Ia6d696c29fc76c73c88cc97af97ea45e1ff089ff
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9321
Reviewed-by: waddlesplash <[email protected]>
The openboot mmu code does not like addresses above 4GB, so load the
kernel to a lower address. It doesn't really matter anyway, because on
sparc the kernel normally lives in a separate address space and uses
special instructions to access userland memory.
See #19597 for details, further changes will be needed here.
Change-Id: Iac6901f275667efef5e64d059daf4c96032a7baf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3573
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
The content of a BUrl should always be in encoded form, to simplify
handling and validation.
Deprecate the UrlEncode member function and make it private. Instead aadd a new
way to handle URL encoding:
- All ways to set an URL (constructors, SetUrlString, and all setters)
now take an extra boolean parameter indicating if the string is already
encoded. The default value is to encode strings automatically.
- The static version of UrlEncode and UrlDecode, which operate on a
string, are preserved and used by other parts of the API.
All unit tests adjusted to handle this, and still passing.
Fixes#12983
Change-Id: I06f06978d0d35e56d7c92b67f001856bb7dcafc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1193
Reviewed-by: nephele nephele <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
* Introduce notify_query_entry_moved to the fs_interface API.
axeld added a hook to the query parser (then in BFS) in hrev34317
to directly handle moves/renames, but just sent notifications for
it as B_ENTRY_REMOVED + B_ENTRY_CREATED (which is in fact the same
exact thing BeOS R5 did, I tested). We need to preserve that ABI/API,
unless flags that didn't exist on BeOS R5 are set.
* Rework notify_query_attr_changed to notify_query_attribute_changed.
This method is Haiku-specific (it was added in hrev39131), but it
wasn't very useful: it only sent the name of the file, not the name
of the attribute that changed.
It now sends the name of the attribute along with an "int32 cause",
same as notify_attribute_changed does.
* Rename the private flag B_ATTR_CHANGE_NOTIFICATION to B_QUERY_WATCH_ALL.
This better describes what it does (it's analogous to the B_WATCH_ALL
node_monitor flag). Probably we should make it public at some point...
(although probably at a lower value.)
* Overhaul QueryParser notifications logic to implement WATCH_ALL
properly, make use of the new and improved notification methods,
and to deduplify some logic.
This makes it possible to use queries with B_QUERY_WATCH_ALL
in a similar fashion to watching a directory node with B_WATCH_CHILDREN,
avoiding the need to watch every single node individually.
This way, they are available by default when not using a strict
language standard version.
The change is applied to all architectures (except m68k, which doesn't
define them at all).
Fixes#19534
Change-Id: I71238919e50518abaa65fa20365c912a577e3455
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9196
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Add support for using `RTLD_NOLOAD` with `dlopen` on Haiku.
While not specified in POSIX, this option is widely available (both
GNU/Linux and BSD) and is the only way to atomically check if a shared
object has been loaded.
Change-Id: I061332307d76c84f6a2abb6f92c4ed964bd90a1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9161
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>