Commit graph

15716 commits

Author SHA1 Message Date
Andreas Kling 9a842ec419 LibC: Add explicit_bzero()
This is a variant of bzero() that is guaranteed to not get optimized
away by the compiler. Useful for clearing out sensitive data.
2021-01-09 20:04:18 +01:00
Andreas Kling 4a83a37f79 AK: Add release_value() and release_error() to AK::Result
These are nice when you want to move something out of the result,
and match the API we already have for Optional.
2021-01-09 19:57:50 +01:00
Andreas Kling b4918bbe2f LibC: Move bzero() and bcopy() per Dr. POSIX 2021-01-09 19:56:59 +01:00
Andreas Kling 9766f61f7b su+passwd: Don't copy Core::Account unnecessarily 2021-01-09 19:41:28 +01:00
Andreas Kling 2ba9e6c866 su: Use pledge() :^)
Not sure why we hadn't done this one sooner, seems like a high-value
program to pledge.
2021-01-09 19:41:24 +01:00
Andreas Kling 71d23bb262 passwd: Drop privileges after opening files for writing
Once we have /etc/passwd and /etc/shadow open for writing, there's no
need for passwd to continue running as root.

We can also drop a bunch of pledge promises, further tightening things.
2021-01-09 19:41:17 +01:00
Andreas Kling 9a688af4b1 LibCore+passwd+su+Base: Add /etc/shadow to hide hashes from users :^)
This patch moves the user account password hashes from /etc/passwd,
where they were world-readable, to /etc/shadow, where only root can
access them.

The Core::Account class is extended to support both authentication
against, and modification of /etc/shadow.

The default password for "anon" as of this commit is "foo" :^)
2021-01-09 19:41:12 +01:00
Andrew Kaster c17056cf09 Meta: Unify build-and-test jobs using a matrix build
This will make it easier to keep macos tests and non-mac tests in
lockstep. Also, make sure flake8 and python are installed. This also
makes it easier to add other OS targets if we want.
2021-01-09 19:22:23 +01:00
Andrew Kaster f79215b062 Meta: Use /usr/bin/env for python3 in newline checker script 2021-01-09 19:22:23 +01:00
Andrew Kaster b5078530d5 Meta: Add flake8 to lint python files 2021-01-09 19:22:23 +01:00
Linus Groh 7b2fdd08ce LibJS: Add tests for bitwise NOT operator 2021-01-09 19:09:02 +01:00
Linus Groh 9fca86109b LibJS: Make bitwise NOT work correctly with NaN and Infinity
This was missing a "toInt32()" which returns 0 for NaN and Infinity.
From the spec:

    6.1.6.1.2 Number::bitwiseNOT ( x )

    The abstract operation Number::bitwiseNOT takes argument x (a Number).
    It performs the following steps when called:

        Let oldValue be ! ToInt32(x).
        Return the result of applying bitwise complement to oldValue.
        The mathematical value of the result is exactly representable as
        a 32-bit two's complement bit string.

Fixes #4868.
2021-01-09 19:09:02 +01:00
Linus Groh c55cb7843a LibJS: Use INVALID some more in abstract operations 2021-01-09 19:09:02 +01:00
Andreas Kling 8ff0afd829 Kernel: Defer switching the paging scope in ptrace(PT_POKE) a little
If we can fail with EFAULT early, might as well avoid switching the
paging scope.
2021-01-09 15:42:03 +01:00
Andreas Kling e08e1a89d9 LibWeb: No need to report that we encountered <svg> or <math>
These things happen, and it's not particularly noteworthy.
2021-01-09 15:22:23 +01:00
Andreas Kling 1d75e82101 LibWeb: Coalesce layouts that happen in response to style changes
Instead of doing a forced layout synchronously whenever an element's
style is changed, use a zero-timer to do the forced relayout on next
event loop iteration.

This effectively coalesces a lot of layouts and makes many pages such
as GitHub spend way less time doing redundant layout work.
2021-01-09 15:22:23 +01:00
Andreas Kling d56f4f635a LibDebug: Convert a bunch of dbg() to dbgln() 2021-01-09 15:22:23 +01:00
Mart G 08190dd0ce WindowServer: Don't enter invalid state when using resize corner. 2021-01-09 15:12:03 +01:00
Andreas Kling cf750b5d3f Chess: Fix button size in the piece promotion dialog
Fixes #4865.
2021-01-09 15:05:31 +01:00
Andreas Kling 0a3b834346 LibWeb: Convert a bunch of dbg() to dbgln() 2021-01-09 14:03:06 +01:00
Andreas Kling 4714b04d32 Kernel: Don't put gratuitous cursing in kernel log 2021-01-09 14:03:06 +01:00
Andreas Kling 6a19542715 LibVT+Terminal: Resize terminal when font changes
When the font is changed in the Terminal application, we now resize the
terminal window to accomodate the new font.
2021-01-09 14:03:06 +01:00
Andreas Kling 9d6198b683 Everywhere: Colour => Color
The system language is US English. :^)
2021-01-09 14:03:06 +01:00
TheMorc 30ef10a5b9 SpaceAnalyzer: use "Proper Noun" name style 2021-01-09 13:59:23 +01:00
Jesse Buhagiar 6df15aca7e Kernel/USB: Implement test transfer
We can now test a _very_ basic transaction via `do_debug_transfer()`.
This function merely attaches some TDs to the LSCTRL queue head
and points some input and output buffers. We then sense an interrupt
with USBSTS value of 1, meaning Interrupt On Completion
(of the transaction). At this point, the input buffer is filled with
some data.
2021-01-09 13:48:15 +01:00
Jesse Buhagiar 3fb7e98e42 Kernel/USB: Simplify schedule
It seems like Haiku and Grub do this, so let's not bother
with any fancy timing stuff for now (to at least get
_something_ working...)
2021-01-09 13:48:15 +01:00
Jesse Buhagiar ff4afe17be Kernel/USB: Ignore shared IRQs
According the USB spec/UHCI datasheet (as well as the Linux and
BSD source code), if we receive an IRQ and USBSTS is 0, then
the IRQ does not belong to us and we should immediately jump
out of the handler.
2021-01-09 13:48:15 +01:00
Jesse Buhagiar 770a729e59 Kernel/USB: Add basic root port detection/management
We can now read/write to the two root ports exposed to the
UHCI controller, and detect when a device is plugged in or
out via a kernel process that constantly scans the port
for any changes. This is very basic, but is a bit of fun to see
the kernel detecting hardware on the fly :^)
2021-01-09 13:48:15 +01:00
Jesse Buhagiar a5f895d251 Kernel/USB: Implement UHCI Data structures
Implemented both Queue Heads and Transfer Descriptors. These
are required to actually perform USB transactions. The UHCI
driver sets up a pool of these that can be allocated when we
need them. It seems some drivers have these statically
allocated, so it might be worth looking into that, but
for now, the simple way seems to be to allocate them on
the fly as we need them, and then release them.
2021-01-09 13:48:15 +01:00
Jesse Buhagiar 375d269b21 Kernel/USB: Prevent system crash via correct UHCI inititilisation
It seems that not setting the framelist address register
was causing the entire system to lock up as it generated an insane
interrupt storm in the IRQ handler for the UHCI controller.
We now allocate a 4KiB aligned page via
`MemoryManager::allocate_supervisor_physical_page()` and set every
value to 1. In effect, this creates a framelist with each entry
being a "TERMINATE" entry in which the controller stalls until its'
1mS time slice is up.

Some more registers have also been set for consistency, though it
seems like this don't need to be set explicitly in software.
2021-01-09 13:48:15 +01:00
Jesse Buhagiar 33d73c600c Kernel/USB: Move USB classes into USB namespace
The entire USB spec involves more than just UHCI, so
let's put everything into it's own nice namespace :^)
2021-01-09 13:48:15 +01:00
Jesse Buhagiar 0dbb9361b8 Kernel/USB: Move USB related files to into specific directory
As the USB/UHCI driver grows in size, it'll be much cleaner to have
all of the USB related files in one folder where they can be easily
accessed :^)
2021-01-09 13:48:15 +01:00
TheMorc 8b6db78aa7 MenuApplets: Open the correct tab in SystemMonitor on applet click
ResourceGraph and Network applets now open their SystemMonitor tab
2021-01-09 13:27:23 +01:00
TheMorc 124518a14a SystemMonitor: Add args parsing for opening a specific tab
This allows SystemMonitor to parse -t or -open-tab argument
to open a specific tab. (ex. network, interrupts etc.)
2021-01-09 13:27:23 +01:00
TheMorc d0adaf4465 LibGUI: Add set_tab_index method
This method sets the current tab index to the value specified.
2021-01-09 13:27:23 +01:00
Andreas Kling 5f364f5dc1 LibGUI: Clear the application's drag-hovered widget on drop event
When we drop something on any window, there's no longer an ongoing drag
so let's forget the drag-hovered widget.
2021-01-09 12:02:07 +01:00
Andreas Kling 9e60fc5006 LibGUI: Add visual indicators for accepted drags to view classes
All the view classes used in FileManager now indicate when they are
ready to accept a drop by showing a rounded rectangle around the item.
2021-01-09 12:02:07 +01:00
Andreas Kling 607c01fad1 LibGUI: Add visual indicator for accepted drags to BreadcrumbBar
BreadcrumbBar segments will now indicate drag acceptance with a rounded
rectangle around the accepting segment.
2021-01-09 12:02:07 +01:00
Andreas Kling b08ed1b560 LibGUI: Make AbstractView accept drags (and delegate to model) 2021-01-09 12:02:07 +01:00
Andreas Kling 7baaa34490 LibGUI: Make SortingProxyModel proxy accepts_drag() 2021-01-09 12:02:07 +01:00
Andreas Kling 12d0d12a78 FileManager+LibGUI: Make the breadcrumb bar accept text/uri-list drags 2021-01-09 12:02:07 +01:00
Andreas Kling 67b91d51a7 WindowServer+LibGUI: Pass the set of mime types being dragged to client
Previously the client would only learn the mime type of what was being
dropped on it once the drop occurred. To enable more sophisticated
filtering of drag & drop, we now pass along the list of mime types being
dragged to the client with each MouseMove event.

(Note that MouseMove is translated to the various Drag* events in LibGUI
on the client side.)
2021-01-09 12:02:07 +01:00
Andreas Kling 3b94af2c07 LibGUI: Have widgets signal willingness to accept drops
If a widget accept()'s a "drag enter" event, that widget now becomes
the application-wide "pending drop" widget. That state is cleared if
the drag moves over another widget (or leaves the window entirely.)
2021-01-09 12:02:07 +01:00
Andreas Kling dbd090fd95 LibCore: Don't auto-accept events that hit bubbling limit
We were using the "accept" flag on the event to break out of the
bubbling loop, but this had lasting consequences since all events that
bubbled too far came out looking as if someone had accepted them.

If an event is ignored by everyone, it should appear ignored.
2021-01-09 12:02:07 +01:00
Andreas Kling 094b47971b LibGUI: Make Widget::HitTestResult::widget a WeakPtr 2021-01-09 12:02:07 +01:00
Andreas Kling c17fa67f51 WindowServer+LibGUI: Notify hovered window when drag&drop is cancelled
The hovered window may want to react to a drag being cancelled, even
if the drag originated in some other window.
2021-01-09 12:02:07 +01:00
Andreas Kling 9acb72e804 LibGUI: Add "drag enter" and "drag leave" events
These events allow widgets to react when a drag enters/leaves their
rectangle. The enter event carries position + mime type, while the
leave event has no information.
2021-01-09 12:02:07 +01:00
Itamar 4728d0dd6a Profiler: Fix disassembly view to work with shared libraries
Also, update path to kernel image from "boot/kernel" to "boot/Kernel".

Fixes #4555
2021-01-09 10:56:04 +01:00
Itamar 1af2f65df5 Profiler: Use CoreDumpReader::library_containing 2021-01-09 10:56:04 +01:00
Itamar 65ffd8de69 LibCoreDump: Add 'library_containing' API to CoreDump::Reader
This API returns info about the library whose range in memory contains
a given address (similar to 'region_containing', but for libraries).
2021-01-09 10:56:04 +01:00