Commit graph

19525 commits

Author SHA1 Message Date
Brian Gianforcaro
f05086a5d2 Kernel: Harden Ext2FileSystem Vector usage against OOM. 2021-05-01 09:10:30 +02:00
Brian Gianforcaro
2ee1731966 Kernel: Harden Process Vector usage against OOM. 2021-05-01 09:10:30 +02:00
Brian Gianforcaro
ee84b8a845 Kernel: Harden DevFS Vector usage against OOM.
The dance here is not complicated, but it is something that should
be taken note of. Since we append to both lists, we don't want to
orphan the new Inode in the m_links/m_subfolders Vector in the event
that the append to m_parent_fs.m_nodes fails.
2021-05-01 09:10:30 +02:00
Brian Gianforcaro
a678851b41 Kernel: Harden sys$setgroups Vector usage against OOM 2021-05-01 09:10:30 +02:00
Brian Gianforcaro
f0568bff9b Kernel: Harden Socket Vector usage against OOM 2021-05-01 09:10:30 +02:00
Brian Gianforcaro
e8d6d478c4 Kernel: Harden LocalSocket Vector usage against OOM. 2021-05-01 09:10:30 +02:00
Gunnar Beutner
a9f488c55b LibC: Make EWOULDBLOCK an alias for EAGAIN
According to POSIX.1 all error codes have to be distinct - with
the exception for EAGAIN and EWOULDBLOCK. Other libcs including
eglibc and newlib define EWOULDBLOCK as an alias for EAGAIN and
some software including OpenTTD expect this behavior.
2021-05-01 09:02:57 +02:00
Gunnar Beutner
03f4c48de1 Ports: Disable GetPerformanceTimer() for OpenTTD
OpenTTD calls gettimeofday() so many times per second that the
game becomes unusable after joining a reasonably active network
game.
2021-05-01 09:02:57 +02:00
Hendiadyoin1
f6aad70541 LibX86+UserspaceEmulator: Add MMX insns prototypes 2021-05-01 08:56:52 +02:00
Brian Gianforcaro
38fe67abb4 Base: Add a man page for the 'bt' command. 2021-05-01 08:44:33 +02:00
Brian Gianforcaro
ca213ab374 bt: Enumerate all threads when symbolizing stacks in the bt utility.
Enumerate tid's from /proc/{pid}/stacks/ and use it to print the
backtrace for all active threads in the specified process.
2021-05-01 08:44:33 +02:00
Brian Gianforcaro
f1c98dc5ea bt: Fix generation of click-able links for source files.
When the default build location was moved from /Build to the new
architecture specific directory, /Build/i686, this code broke.
All file names are now path relative one additional level up.

So continue the hack, and introduce another dummy directory to
make the relative paths resolve correctly.
2021-05-01 08:44:33 +02:00
Carlos César Neves Enumo
69e2431c64 Lagom/CMake: Add -fconstexpr-steps for AppleClang 2021-05-01 07:38:43 +02:00
Tobias Christiansen
22d6fbeb12 LibWeb: Use new way of generating list-style-type: *-alpha
Removed the local conversion from number to alphabet and used the one
offered in AK/String instead.
2021-05-01 01:19:40 +02:00
Tobias Christiansen
ef8f97635e Spreadsheet: Use String::bijective_base_from for column name resolution
Updated Spreadsheet to use the new way of converting a number to a
String represenation using the alphabet.
The code responsible for this conversion now lives in AK/String, so it
gets deleted from Spreadsheet.cpp.
2021-05-01 01:19:40 +02:00
Tobias Christiansen
4016e04061 AK: Move bijective-base-conversion into AK/String
This allows everybody to create a String version of their number
in a arbitrary bijective base. Bijective base meaning that the mapping
doesn't have a 0. In the usual mapping to the alphabet the follower
after 'Z' is 'AA'.
The mapping using the (uppercase) alphabet is used as a standard but
can be overridden specifying 'base' and 'map'.

The code was directly yanked from the Spreadsheet.
2021-05-01 01:19:40 +02:00
inalone
4dbf40399b Demos: Added Alt+F4 funtionality to demos that lacked it
The Fire, LibGfxDemo and LibGfxScaleDemo demos did not have Alt+F4
functionality as they lacked menubars - I just added basic menubars with
Quit entries to allow this shortcut with the demos that didn't have it.
2021-05-01 01:11:35 +02:00
Andreas Kling
51f88cb00d Kernel/IPv4: Unbreak raw socket (port allocation failing is OK)
Raw sockets don't need a local port, so we shouldn't fail operations
if allocation yields an ENOPROTOOPT.

I'm not in love with the factoring here, just patching up the bug.
2021-05-01 00:03:33 +02:00
Valtteri Koskivuori
8fac7a1d5d
LibGUI: Bump up common locations width from 90 to 95
The Documents directory shows up properly now when selected.
Previously the bold text would not fit horizontally, causing an
ellipsis at the end.
2021-04-30 23:27:29 +02:00
Gunnar Beutner
e0ac611a08 Kernel: Tear down connections when we receive an RST packet 2021-04-30 23:11:56 +02:00
Gunnar Beutner
c03cbf83ab Kernel: Record MAC addresses for incoming IPv4 packets
This way we don't have to do ARP just to send packets back to
an address which just sent us a packet.
2021-04-30 23:11:56 +02:00
Gunnar Beutner
fb2ad94195 Kernel: Remove socket from the listener's accept list when it is closed
Without this patch we end up with sockets in the listener's accept
queue with state 'closed' when doing stealth SYN scans:

Client -> Server: SYN for port 22
Server -> Client: SYN/ACK
Client -> Server: RST (i.e. don't complete the TCP handshake)
2021-04-30 23:11:56 +02:00
Gunnar Beutner
866e577f1d Kernel: Don't put closed/listener sockets into the closing_sockets list 2021-04-30 23:11:56 +02:00
Gunnar Beutner
d8f92bdf96 Kernel: Avoid deadlock when trying to send packets from the NetworkTask
fixes #6758
2021-04-30 23:11:56 +02:00
Linus Groh
4d697855ea Meta: Use author username for pull request IRC notifications
Just 'github.actor' may or may not be the actual PR author, but
especially since action runs have to be approved for first-time
contributors, it's been giving us a lot of incorrect results.
2021-04-30 23:11:12 +02:00
Gunnar Beutner
488ee56cf7 Kernel: chmod()/chown() for PTYs should return EROFS
All the other methods already do this and this is also what OpenSSH
expects when trying to change modes/ownership for devpts files.
2021-04-30 23:10:22 +02:00
Gunnar Beutner
71f90695c2 Kernel: Implement support for PTY flags ICRNL, OPOST and ONLCR
These are used by OpenSSH. Without those flags new-lines are
all jumbled in the output.
2021-04-30 23:10:22 +02:00
Gunnar Beutner
f48f26f52d LibC: Implement openpty(), forkpty() and login_tty()
These are used by OpenSSH.
2021-04-30 23:10:22 +02:00
Ali Mohammad Pur
6783f65d5a LibLine: Fix writing to temporary file in ^X^E handler
I have no idea how this _ever_ worked, and I also have no idea why past
me didn't use FileStream to begin with.
Fixes the issue where lots of junk data would be written to the temp
file, causing the external editor to crash.
2021-04-30 21:57:28 +02:00
Brian Gianforcaro
f91bfe8009 Meta: pre-commit should run lint-ports.py only when Ports change
Most of the existing lint-ing shell scripts have the ability
to only run on the files which have actually changed.
The new port lint-ing script doesn't have this functionality
unfortunately. This forces us to lint ALL the ports on every
single change to any other file in the system if you have
the pre-commit hook setup for your git clone locally.

Instead we can use pre-commit's feature to only run a hook
if certain files have changed to reduce the situations in
which we would run the Meta/lint-ports.py script.
2021-04-30 21:24:22 +02:00
Itamar
7bd796b7e3 LibELF: Perform verification of TLS data in dlopen
When loading a library at runtime with dlopen(), we now check that:
1. The library's TLS size does not overflow the size of the allocated
TLS block.
2. The Library's TLS data is all zeroed.

We check for both of these cases because we currently do not support
them correctly. When we do add support for them, we can remove these
checks.
2021-04-30 18:47:39 +02:00
Itamar
101ac45c1a LibELF: Change TLS offset calculation
This changes the TLS offset calculation logic to be based on the
symbol's size instead of the total size of the TLS.

Because of this change, we no longer need to pipe "m_tls_size" to so
many functions.

Also, After this patch, the TLS data of the main program exists at the
"end" of the TLS block (Highest addresses).

This fixes a part of #6609.
2021-04-30 18:47:39 +02:00
Itamar
6bbd2ebf83 Kernel+LibELF: Support initializing values of TLS data
Previously, TLS data was always zero-initialized.

To support initializing the values of TLS data, sys$allocate_tls now
receives a buffer with the desired initial data, and copies it to the
master TLS region of the process.

The DynamicLinker gathers the initial TLS image and passes it to
sys$allocate_tls.

We also now require the size passed to sys$allocate_tls to be
page-aligned, to make things easier. Note that this doesn't waste memory
as the TLS data has to be allocated in separate pages anyway.
2021-04-30 18:47:39 +02:00
Itamar
db76702d71 LibELF: Rename tls_size to tls_size_of_current_object 2021-04-30 18:47:39 +02:00
Itamar
1c24388d74 LibELF: Extract TLS offset calculation logic to separate function 2021-04-30 18:47:39 +02:00
Itamar
373e8bcbc7 Kernel: Give a name to the Master TLS region allocation 2021-04-30 18:47:39 +02:00
Itamar
2c9541315d LibELF: Fix TLS offset calculation for libraries
This fixes a regression that was introduced in f40ee1b and caused the
tls_offset of all objects other than the main program to be 0.

After this fix map_library's is_program argument is no longer used, so
it was removed.
2021-04-30 18:47:39 +02:00
Maciej Zygmanowski
6a12420d9d Browser: Add FrogFind search engine
FrogFind is a search engine for very old computers and can be
loaded and rendered correctly by Serenity Browser :^)
2021-04-30 17:57:22 +02:00
Andreas Kling
cd9be1733c Kernel: Make Inode::set_{a,c,m}time return KResult
This exposed some missing error propagation, which this patch also
takes care of.
2021-04-30 15:51:06 +02:00
Andreas Kling
a5f385f052 Kernel: Fix bogus error codes from raw socket protocol_{send,receive}
Since these return KResultOr, we should not negate the error code.
2021-04-30 15:27:41 +02:00
Andreas Kling
71a10eb8e7 Kernel/IPv4: Propagate errors from local port allocation
Remove hacks and assumptions and make the EADDRINUSE propagate all
the way from the point of failure to the syscall layer.
2021-04-30 15:27:41 +02:00
Egor Ananyin
8f8fbf3487 LibWeb: Position absolute boxes relative to the containing block
In the absolute positioning model, a box is explicitly offset with
respect to its containing block (CSS 2.1 section 9.6).
2021-04-30 15:25:35 +02:00
Egor Ananyin
3ca6d7dd36 LibWeb: Use min-height in calculating block box height
Now we use min-height for calculating the height of block boxes.
Besides, now we check if min-height/max-height are percentage values
and don't use them if parent's height isn't explicitly set (CSS 2.1
section 10.7).
2021-04-30 15:25:35 +02:00
Egor Ananyin
5ae2774018 LibWeb: Fix floating box position calculation
Now we set margins, borders and paddings for floating boxes and include
them into calculating floating box positions by using margin_box() and
margin_box_as_relative_rect().
2021-04-30 15:25:35 +02:00
Gunnar Beutner
3c0355a398 Kernel: Accepted socket file descriptors should not inherit flags
For example Linux accepts an additional argument for flags in accept4()
that let the user specify what flags they want. However, by default
accept() should not inherit those flags from the listener socket.
2021-04-30 11:43:19 +02:00
Gunnar Beutner
7a1d09ef1a Kernel: Closing a file descriptor should not always close the file
When there is more than one file descriptor for a file closing
one of them should not close the underlying file.

Previously this relied on the file's ref_count() but at least
for sockets this didn't work reliably.
2021-04-30 11:42:35 +02:00
Jesse Buhagiar
cae33305b0 Ports: QuakeII port 2021-04-30 11:35:17 +02:00
Jesse Buhagiar
60cdbc9397 Kernel/LibC: Implement setreuid 2021-04-30 11:35:17 +02:00
jakewestrip
81eab1a9d1 Ports: Remove SDL Timer replacement in MilkyTracker 2021-04-30 09:26:12 +02:00
jakewestrip
1ce70bb418 Ports: Fix MilkyTracker install script 2021-04-30 09:26:12 +02:00