Commit graph

4822 commits

Author SHA1 Message Date
Jesse Buhagiar
82b48d867d Userland: Implement pls, a sudo clone 2021-05-29 22:33:12 +04:30
Gunnar Beutner
ea33e9647b LibC: Don't leak memory for realloc(p, 0)
Previously we'd leak memory when the user called realloc(p, 0). Instead
this call should behave as if the user had called free(p).
2021-05-29 19:40:23 +02:00
Jelle Raaijmakers
80a84f726e LibGUI/TreeView: Implement Home/End/PageUp/PageDn navigation
This adds an implementation for the Home, End, Page Up and Page Down
cursor movements for TreeView.

Also, the Up and Down movement implementations are replaced by a more
efficient traversal mechanism: whereas the old code would walk over all
visible nodes every time, the new code only evaluates relevant sibling
and parent indices.
2021-05-29 21:58:51 +04:30
brapru
3cf835af6d LibCore: Do not write disabled spwd values in generate_shadow_file
When LibC/shadow.cpp parses shadow entries in getspent, it sets the
spwd member value to disabled (-1) if the value is empty. When
Core::Account::sync calls getspent to generate a new shadow file, it
would recieve the -1 values and write them in the shadow file. This
would cause the /etc/shadow file to be cluttered with disabled values
after any password change.

This patch checks if the spwd member value is disabled, and prints the
appropriate value to the shadow file.
2021-05-29 18:23:10 +01:00
Stephan Unverwerth
92339b7fe5 LibGL: Rewrite error handling according to spec
Following https://www.khronos.org/registry/OpenGL/specs/gl/glspec15.pdf
errors are now only recorded if m_error is GL_NO_ERROR
m_error is reset to GL_NO_ERROR after a successful call to glGetError()
2021-05-29 18:17:24 +01:00
Stephan Unverwerth
9334697c59 LibGL: Update rasterizer options in glDisable()
This bug must have been introduced by copy-pasting.
2021-05-29 18:17:24 +01:00
Stephan Unverwerth
9b4edacd8e LibGL: Add macro for error checking
This adds a macro `RETURN_WITH_ERROR_IF` to SoftwareGLContext
to remove a lot of noise from the interface implementation.
2021-05-29 18:17:24 +01:00
Idan Horowitz
e6b88de6a0 LibGfx: Switch to modern dbgln logging in ICOLoader 2021-05-29 21:46:16 +04:30
Idan Horowitz
7572a355fd LibGfx: Reject ICOs with height == NumericLimits<i32>::min()
Bitmap files use negative height values to signify that the image
should be rendered top down, but if the height value equals to the
minimum value, negating it to get the actual height results in UB.
2021-05-29 21:46:16 +04:30
Andrew Kaster
6aba64b60f LibJS: Instrument HeapBlock cell allocation for ASAN
Mark the entirety of a heap block's storage poisoned at construction.
Unpoison all of a Cell's memory before allocating it, and re-poison as
much as possible on deallocation. Unfortunately, the entirety of the
FreelistEntry must be kept unpoisoned in order for reallocation to work
correctly.

Decreasing the size of FreelistEntry or adding a larger redzone to Cells
would make the instrumentation even better.
2021-05-29 17:47:29 +01:00
Andrew Kaster
81a5dcde84 LibJS: Expose minimum possible cell size of JS::Heap
Use this to avoid creating a 16 byte cell allocator on x86_64, where the
size of FreelistEntry is 24 bytes. Every JS::Cell must be at least the
size of the FreelistEntry or things start crashing, so the 16 byte
allocator was wasted on that platform.
2021-05-29 17:47:29 +01:00
Andrew Kaster
07c62f9f42 LibJS: Remove unused HeapBlock private member function
FreelistEntries are constructed manually in deallocate() instead of
using this helper.
2021-05-29 17:47:29 +01:00
Gunnar Beutner
42d667645d Kernel: Make sure we free the thread stack on thread exit
This adds two new arguments to the thread_exit system call which let
a thread unmap an arbitrary VM range on thread exit. LibPthread
uses this functionality to unmap the thread stack.

Fixes #7267.
2021-05-29 15:53:08 +02:00
Gunnar Beutner
f63f471b87 LibPthread: Make some variables static 2021-05-29 15:53:08 +02:00
Daniel Bertalan
4cf6963a1c LibVT: Add missing cursor movement escape sequences
This commit adds support for the following ANSI escape sequences:
- `CNL` - Cursor Next Line
- `CPL` - Cursor Previous Line
- `VPR` - Line Position Relative
- `HPA` - Character Position Absolute
- `HPR` - Character Position Relative
2021-05-29 15:50:24 +02:00
Mart G
07e3934f01 LibGUI: Distribute remaining pixels in BoxLayout to fill the entire area
Previously, the layout algorithm preferred to give every item an equally
sized slice of the remaining space. This meant that not the entire area
was used when the remaining size did not divide evenly by the number of
items. This caused, for example, the ResizeCorner in HexEditor to be a
couple of pixels left of the actual corner for some sizes of the window.

Now, the remaining pixels are distributed on a first come, first served
basis. However, only one pixel is distributed at a time. This means
items towards the left might me a pixel larger than their siblings
towards the right.
2021-05-29 15:50:04 +02:00
Jesse Buhagiar
e2989424c7 DisplaySettings: Set monitor widget color if no image is selected
The monitor widget now displays the selected colour if no background
image has been selected.

Resolves #7491
2021-05-29 13:30:19 +01:00
Brendan Coles
90e9d1a0a1 HexEditor: Add find_all_strings() function 2021-05-29 16:26:12 +04:30
Stephan Unverwerth
10ceeb092f Everywhere: Use s.unverwerth@serenityos.org :^) 2021-05-29 12:30:08 +01:00
Marcus Nilsson
0aa0e00dd5 Browser: Add title to go back/forward context menu
Adds page title to the context menu for go back/forward.
2021-05-29 12:03:41 +01:00
Ali Mohammad Pur
3f5eb6446b LibGUI: Make HeaderView act only on the visible sections
i.e. Drawing them, or handling mouse events on them.
Fixes #7505.
2021-05-29 13:31:41 +04:30
DexesTTP
4bbf954ad0 LibTLS: Allow using other hash algorithms for HMAC
The standard allows for ciphers to define which hash to use.
Fixes #7348
2021-05-29 13:29:46 +04:30
DexesTTP
cb4a0dec8a LibTLS: Use a more precise KeyExchangeAlgorithm enum
The old enumeration didn't allow discriminating the key exchange
algorithms used, but only allowed the handshake with the server. With
this new enumeration, we can know which key exchange algorithm we are
actually supposed to use :^)
2021-05-29 13:29:46 +04:30
DexesTTP
dd35aa7725 LibTLS: Add IANA Hex codes for all recommended cipher suites
Also sort the existing cipher suites, and remove the unsupported ones.
We don't support any of these recommended ciphers, but at least we now
know which ones we should focus on :^)
2021-05-29 13:29:46 +04:30
Linus Groh
d947253c51 LibWeb: Also call page_did_start_loading() for FrameLoader::Type::Reload
Surprisingly this is not used by the browser's page reload functionality
but only JS's location.reload() - that's probably why this hasn't been
noticed yet. Make sure we notify the page client about the load start in
that case as well. :^)
2021-05-29 01:27:06 +01:00
Linus Groh
56e69c4f2e LibWeb: Call page_did_start_loading() before load_resource()
Otherwise we would sometimes (dependent on the load time, I believe) end
up setting the document and eventually calling title change callbacks
before communicating that the page started loading.
2021-05-29 01:17:36 +01:00
Linus Groh
94a56c3aee Browser: Pass Tab::on_title_change title argument as const reference 2021-05-29 01:14:04 +01:00
Linus Groh
507c5b6248 Browser: Remove redundant parameter names from Tab::on_{g,s}et_cookie 2021-05-29 01:12:24 +01:00
Tobias Christiansen
301eb998c6 LibWeb: Improve performance of CSS custom property resolution
By memoizing already resolved custom properties in the DOM::Element,
we achieve a notable speed increase when loading SerenityOS on GitHub.
2021-05-29 00:58:07 +04:30
Tobias Christiansen
3ede1d08f5 LibWeb: Avoid unnecessary String copy in parsing CSS custom properties 2021-05-29 00:58:07 +04:30
Marcus Nilsson
b06d01f040 SystemMonitor: Disable menu items for inaccessible process
Disable the context menu items if user cannot access the process.

Fixes #7486
2021-05-28 18:45:57 +01:00
Jesse Buhagiar
2753505962 SystemMonitor: Use u64 for disk sizes
This fixes #7288, which was being caused by unsigned 32-bit integer
overflow
2021-05-28 16:37:25 +01:00
Jesse Buhagiar
786275feb8 LibGUI: Add u64 type to LibGUI::Variant
`uint` has also been more appropriately renamed to
u32.
2021-05-28 16:37:25 +01:00
Tobias Christiansen
fd6b04055c LibWeb: Resolve custom properties
The way to get the custom properties is pretty weird and this code is
as far from optimized as it gets but somehow it works :^)
2021-05-28 10:45:38 +01:00
Tobias Christiansen
bf9c5ffb3f LibWeb: StyleResolver: Keep track of specificity of matched selector
This way it gets easier to compare matches.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
c4588a2cde LibWeb: Add parsing for custom properties
This parses 'some-property: var(--some-name)' and stores its findings
in a CustomStyleValue.
It also parses the custom properties like '--some-name: some-value' and
puts them into the StyleProperty.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
0d7169b91a LibWeb: Store custom properties in CSSStyleDeclaration
Keep them around when parsing and store them in the CSSStyleDeclaration
when done.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
f0c6160362 LibWeb: Add CustomStyleValue
This extends StyleValue and can hold the identifier of the custom
property.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
8396099e0e LibWeb: Add PropertyID::Custom to code generator 2021-05-28 10:45:38 +01:00
Gunnar Beutner
547eb4973a Profiler: Use a more reasonable default event mask
Previously Profiler (e.g. when started via the context menu in
SystemMonitor) would request logging _all_ event types. While this
might be useful at a later point in time the lack of event type
filtering in the profile viewer makes this less useful because
showing different event types in the same timeline shows an inaccurate
picture of what was really going on.

Some event types (like kmalloc) happen more frequently than others
(e.g. CPU samples) and while they don't carry the same weight they
would still dominate the samples graph.

This changes the Profiler app to just do CPU sampling for now.
2021-05-28 08:00:14 +02:00
Andrew Kaster
1ecf2dad4b LibJS: Poison unused heap blocks until they are re-allocated
This is the coarsest grained ASAN instrumentation possible for the LibJS
heap. Future instrumentation could add red-zones to heap block
allocations, and poison the entire heap block and only un-poison used
cells at the CellAllocator level.
2021-05-28 07:59:41 +02:00
Gunnar Beutner
5e1c1eb840 LibGfx: Make sure we use unique class names
Previously there were different definitions for classes with the
same name. This is a violation of the C++ ODR.
2021-05-28 07:59:05 +02:00
Gunnar Beutner
1f57cc5957 UE: Make sure signal_trampoline_dummy is not optimized away with -flto
This adds __attribute__((used)) to the function declaration so the
compiler doesn't discard it. It also makes the function NEVER_INLINE
so that we don't end up with multiple copies of the function. This
is necessary because the function uses inline assembly to define some
unique labels.
2021-05-28 07:59:05 +02:00
Idan Horowitz
ffaf27e4b6 LibJS: Add inline capacity to BlockAllocator's blocks Vector
There's no need to dynamically allocate a constant sized vector :^)
2021-05-28 00:07:24 +01:00
Brendan Coles
6aa766f8ca HexEditor: Add 'Find All' option to Find Dialog to find all matches 2021-05-27 22:57:17 +02:00
Tim Schumacher
d7797c8bf8 Userland: Treat inet_pton returning 0 as an error
The POSIX man-page states that inet_pton returns 0 if the input is not a
valid IPv4 dotted-decimal string or a valid IPv6 address string. This is
also how it is implemented in SerenityOS.

This means that we should treat a return value of 0 as an error to avoid
using an invalid address (or 0.0.0.0).
2021-05-27 22:56:21 +02:00
Marcus Nilsson
f7667901ed Solitaire: Start timer when first card is moved
Starts the game timer when the first card is clicked or moved instead of
when a new game is started.

Fixes #7489
2021-05-27 22:55:37 +02:00
Andreas Kling
b8fd845885 LibJS: Update mmap name after recycling a HeapBlock :^)
Fixes #7507.
2021-05-27 21:24:58 +02:00
Gunnar Beutner
97d0ebba20 LibJS: Make sure aligned_alloc() doesn't return a null pointer
The previous VERIFY() call checked that aligned_alloc() didn't return
MAP_FAILED. When out of memory aligned_alloc() returns a null pointer
so let's check for that instead.
2021-05-27 21:13:57 +02:00
Andreas Kling
14585a9cba LibJS: Remove unused HeapBlock::operator delete() 2021-05-27 20:07:34 +02:00