Commit Graph

11963 Commits

Author SHA1 Message Date
Ben Wiederhake
7bdf54c837 Kernel: PID/PGID typing
This compiles, and fixes two bugs:
- setpgid() confusion (see previous commit)
- tcsetpgrp() now allows to set a non-empty process group even if
  the group leader has already died. This makes Serenity slightly
  more POSIX-compatible.
2020-08-10 11:51:45 +02:00
Ben Wiederhake
f5744a6f2f Kernel: PID/TID typing
This compiles, and contains exactly the same bugs as before.
The regex 'FIXME: PID/' should reveal all markers that I left behind, including:
- Incomplete conversion
- Issues or things that look fishy
- Actual bugs that will go wrong during runtime
2020-08-10 11:51:45 +02:00
Ben Wiederhake
f225321184 Kernel: Demonstrate kill's pid/tid confusion bug 2020-08-10 11:51:45 +02:00
Ben Wiederhake
7ab90e1a13 Kernel: Demonstrate setpgid confusion bug
Technically, this can be 'exploited' to set the pgid of an exploiting process
to a near-arbitrary new pgid. This can cause conflicts when assigning future pgids,
destroys the session-boundary, and might confuse future pgid-to-session lookups.

In practice, I can't come up with a way that this causes actual harm.
2020-08-10 11:51:45 +02:00
Ben Wiederhake
cc6d5242d1 AK: Implement and test DistinctNumeric class
This template class allows for easy generation of incompatible numeric types.
This is useful whenever code has to handle heterogenous data (like meters and
seconds) but the underlying data types are compatible (like int and int).

The motivation comes from the Kernel's inconsistent use of pid_t for process and
thread IDs even though the ID spaces are incompatible, and translating forth/back
is nontrivial.

Other uses could be units (as described above), or incompatible index systems.
A popular use in real life is image manipulation, when there are multiple
coordinate systems.
2020-08-10 11:51:45 +02:00
Ben Wiederhake
54c6886108 AK: TestSuite's main should return 0 2020-08-10 11:51:45 +02:00
Sarah
9714e61d62 ClassicWindowTheme: Fix titlebar redraw issues
This fixes titlebar rects being overly large and leaving smeary
undrawn areas when using a theme with a titlebar height
different to 19px.
2020-08-10 11:48:47 +02:00
Nico Weber
6613a4cb8c disasm: Insert symbol names in disassembly stream
The symbol name insertion scheme is different from objdump -d's.
Compare the output on Build/Userland/id:

* disasm:

        ...
        _start (08048305-0804836b):
        08048305  push ebp
        ...
        08048366  call 0x0000df56

        0804836b  o16 nop
        0804836d  o16 nop
        0804836f  nop

        (deregister_tm_clones (08048370-08048370))

        08048370  mov eax, 0x080643e0
        ...
        _ZN2AK8Utf8ViewC1ERKNS_6StringE (0805d9b2-0805d9b7):
        _ZN2AK8Utf8ViewC2ERKNS_6StringE (0805d9b2-0805d9b7):
        0805d9b2  jmp 0x00014ff2

        0805d9b7  nop

* objdump -d:

        08048305 <_start>:
         8048305:	55                   	push   %ebp
        ...
         8048366:	e8 9b dc 00 00       	call   8056006 <exit>
         804836b:	66 90                	xchg   %ax,%ax
         804836d:	66 90                	xchg   %ax,%ax
         804836f:	90                   	nop

        08048370 <deregister_tm_clones>:
         8048370:	b8 e0 43 06 08       	mov    $0x80643e0,%eax
        ...
        0805d9b2 <_ZN2AK8Utf8ViewC1ERKNS_6StringE>:
         805d9b2:	e9 eb f6 ff ff       	jmp    805d0a2 <_ZN2AK10StringViewC1ERKNS_6StringE>
         805d9b7:	90                   	nop

Differences:

1. disasm can show multiple symbols that cover the same instructions.
   I've only seen this happen for C1/C2 (and D1/D2) ctor/dtor pairs,
   but it could conceivably happen with ICF as well.

2. disasm separates instructions that do not belong to a symbol with
   a newline, so that nop padding isn't shown as part of a function
   when it technically isn't.

3. disasm shows symbols that are skipped (due to having size 0)
   in parenthesis, separated from preceding and following instructions.
2020-08-10 11:48:10 +02:00
Brian Gianforcaro
2eae70b097 Kernel: Mark MSIHandler as final 2020-08-10 09:57:50 +02:00
Linus Groh
fb29bc8b50 Base: Replace downscaled 2048 16x16 app icon with a hand-drawn one
Downscaling icons to 16x16 pretty much never works...
2020-08-09 22:18:08 +02:00
AnotherTest
9fde92db38 Shell: Make redirections without commands apply to all future commands
This restirects redirection-only commands' scope, and keeps their
usefulness too!
2020-08-09 21:50:33 +02:00
AnotherTest
4409cb88c9 LibLine: Only write to the standard error
This fixes `> asdf` and allows for all sorts of stdout redirections.
2020-08-09 21:50:33 +02:00
Luke
5724ac8e72 LibWeb: Add HTML elements to factories, add missing tags and attributes
This is mostly to get the grunt work of the way. This is split up into
multiple commits to hopefully make it more manageable to review.

Note that these are not full implementations, and the bindings mostly
get the low hanging fruit.

Also implements some attributes that I kept out because they had
dashes in them. Therefore, this closes #2905.
2020-08-09 21:14:51 +02:00
Luke
be5a62d5d7 LibWeb: Add all HTML elements between S and V 2020-08-09 21:14:51 +02:00
Luke
1fbe4b2a2f LibWeb: Add all HTML elements between L and Q 2020-08-09 21:14:51 +02:00
Luke
b90a91da4a LibWeb: Add all HTML elements between A and F 2020-08-09 21:14:51 +02:00
Luke
a86ce7eaca LibWeb: Make all existing HTML elements "final" 2020-08-09 21:14:51 +02:00
Nico Weber
700f5cfc90 Lagom: Pass -Wno-deprecated-copy to clang too
Due to Serenity's use of concepts, it now requires clang 10 or newer,
and clang 10 or newer both understands and requires
-Wno-deprecated-copy.
2020-08-09 21:13:06 +02:00
Nico Weber
9c136be08b disasm: For ELF files, disassemble .text section
Since disasm is built in lagom, this requires adding LibELF to lagom.
2020-08-09 21:12:54 +02:00
Nico Weber
44a7765676 LibELF+Lagom: Use FlatPtr instead of u32 in DynamicLoader to get LibELF to build in Lagom 2020-08-09 21:12:54 +02:00
Nico Weber
0586924bbd LibELF+Lagom: Work towards getting LibELF in Lagom
Mostly -Wformat fixes, some of which pointed out real (if benign) bugs.
2020-08-09 21:12:54 +02:00
AnotherTest
872834320a Games: Add a 2048 game 2020-08-09 21:11:50 +02:00
Muhammad Zahalqa
043d548b39 LibCore: fix UDP Server receive to trim buffer to actuall bytes receiveed 2020-08-09 21:10:01 +02:00
Muhammad Zahalqa
d9470bdae7 LibCore: close socket on LocalServer dtor 2020-08-09 21:10:01 +02:00
Muhammad Zahalqa
9150f3c266 LibCore: close socket on TCPServer dtor 2020-08-09 21:10:01 +02:00
Muhammad Zahalqa
0246e2ae6c LibCore: close socket on UDPServer dtor 2020-08-09 21:10:01 +02:00
AnotherTest
5ae2f6e9ec Shell: Stop a for loop upon receiving two consecutive interruptions
This does not work perfectly (just like every other shell...), if the
running program handles the signal (SIGINT in this case) and quits
cleanly, the shell cannot detect the interruption.
This is the case with our `sleep(1)`.
2020-08-09 21:08:07 +02:00
Andreas Kling
c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling
e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Andreas Kling
a94be95e27 LibGfx: Add a basic abstract WindowTheme class
This class will provide painting and metrics for window themes. :^)
2020-08-09 19:28:36 +02:00
Andreas Kling
72347205c4 LibWeb: Always add line boxes through LayoutBlock::add_line_box()
Let's not append directly to the line box vector all over the place.
2020-08-09 15:21:09 +02:00
Benoît Lormeau
7b356c33cb
AK: Add a GenericLexer and extend the JsonParser with it (#2696) 2020-08-09 11:34:26 +02:00
AnotherTest
1222be7e3a HackStudio: Set the pgrp of the pseudoterminal to the child pid
This fixes #3046.
2020-08-09 11:33:15 +02:00
Brian Gianforcaro
34dd8edcb3 Kernel: Decorate KResult and KResultOr<T> methods with [[nodiscard]]
This would have found my error propagation bug.
2020-08-09 00:13:39 +02:00
Brian Gianforcaro
fe64d97001 Kernel: Fix my result propagation bug @BenWiederhake spotted
In #3001 I was trying to fix result propagation issues, and
I actually just introduced another one. Luckily Ben spotted
it in the diff after it was in the tree, thanks Ben!
2020-08-09 00:13:39 +02:00
AnotherTest
7ebba7bf3c open: Resolve the realpath before passing it to URL()
...which runs it through LexicalPath.
Fixes #3016.
2020-08-08 11:58:57 +02:00
Andreas Kling
62ec42c112 LibWeb: Remove some unnecessary throwaway strings in the CSS parser
We've had StringView::ends_with(..., CaseSensitivity) for a while,
so let's use it to avoid creating a bunch of unnecessary strings here.
2020-08-07 20:35:05 +02:00
Andreas Kling
498845ea2f LibWeb: Handle CSS "ex" lengths (relative to font x-height)
These are pretty rare, but they do come up in some places and it's not
hard to support. The Gfx::Font information is approximate (and bad)
but we can fix that separately.
2020-08-07 20:30:59 +02:00
Andreas Kling
0bbced444b LibGfx: Add dummy Font::x_height() getter
Right now we just guess that the x-height is glyph_height/2, which is
obviously not accurate. We currently don't store the x-height in fonts,
so that's something we'll need to fix.
2020-08-07 20:29:32 +02:00
Andreas Kling
fae9c9f81f UserspaceEmulator: Add the dup2 syscall 2020-08-07 18:46:56 +02:00
Andreas Kling
5dce5fa7c2 UserspaceEmulator: Add the chdir syscall 2020-08-07 18:44:51 +02:00
Andreas Kling
ee5e8081da UserspaceEmulator: Pass full path to new UE instance in virt$execve()
Don't just pass argv[0] to the new UE, pass the full program path.
2020-08-07 17:28:00 +02:00
Muhammad Zahalqa
91d259ef1c
LibThread: Remove redundant --m_level in Lock::unlock() (#3040) 2020-08-07 17:24:49 +02:00
Andreas Kling
5a5b687014 UserspaceEmulator: Add the getpgid() and waitid() syscalls
With this, you can now kinda sorta run the shell in UserspaceEmulator!
2020-08-07 16:51:08 +02:00
Andreas Kling
93b1e54237 UserspaceEmulator: Add the setpgid syscall 2020-08-07 16:34:50 +02:00
Andreas Kling
2b3b83801b UserspaceEmulator: Make the "unimplemented syscall" output look nicer 2020-08-07 16:34:50 +02:00
Brian Gianforcaro
35c745ca54 Kernel: Use Userspace<T> for the realpath syscall 2020-08-07 16:18:36 +02:00
Brian Gianforcaro
30b2c0dc85 Kernel: Use Userspace<T> for the getsockopt syscall and Socket interface
The way getsockopt is implemented for socket types requires us to push
down Userspace<T> using into those interfaces. This change does so, and
utilizes proper copy implementations instead of the kind of haphazard
pointer dereferencing that was occurring there before.
2020-08-07 16:18:36 +02:00
Brian Gianforcaro
6920d5f423 Kernel: Use Userspace<T> for the setsockopt syscall 2020-08-07 16:18:36 +02:00
Brian Gianforcaro
9f685ac30a AK: Add static_ptr_cast support for the Userspace<T> pointer type
When using Userspace<T> there are certain syscalls where being able
to cast between types is needed. You should be able to easily cast
away the Userspace<T> wrapper, but it's perfectly safe to be able to
cast the internal type that is being wrapped.
2020-08-07 16:18:36 +02:00