summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-14LibJS: Handle HTML-style commentsStephan Unverwerth
2020-04-14Kernel: Remove SmapDisablers in {peek,poke}_user_data()Andreas Kling
2020-04-14Kernel: Remove SmapDisablers in sys$ptrace() implementationAndreas Kling
Instead, use copy_from_user() or copy_to_user() which does additional verification and will panic the kernel on attempted kernel access.
2020-04-14Kernel: Fix little mistakes in ptrace(PT_PEEK)Andreas Kling
Output address validation should be done for the tracer's address space and not the tracee's. Also use copy_to_user() instead of copy_from_user(). The two are really identical at the moment, but maybe we can add some assertions to make sure we're doing what we think we're doing. Thanks to Sergey for spotting these!
2020-04-13Shell: Suggest local executables and directoriesStephan Unverwerth
...when no matching executable could be found in $PATH
2020-04-13Debugger: Repeat previous command when an empty command is enteredItamar
2020-04-13Debugger: Add single step commandItamar
Also, this commit does some refactoring to the debugging loop logic.
2020-04-13Debugger: Breakpoints now persist after being trippedItamar
Previously, a breakpoint was removed after it was tripped. After a breakpoint trips, we have to undo the 'int3' patch from the instruction in order to continue the exceution. To make a breakpoint persist, we switch to "single step" mode, which stops the execution after a single instruction, and then we insert the breakpoint at the previous instruction. There is also some code that deals with an edge case where there are breakpoints in two consecutive instructions.
2020-04-13CPU: Handle Debug exceptionItamar
We currently only care about debug exceptions that are triggered by the single-step execution mode. The debug exception is translated to a SIGTRAP, which can be caught and handled by the tracing thread.
2020-04-13Debugger: Print where we're stopped atItamar
For some reaason, some magic is required to convince gcc to give us the implementation for "__cxa_demangle" Thanks @predmond for finding this simpler form of magic :)
2020-04-13LibELF: Add find_demangled_functionItamar
Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
2020-04-13Meta: Add Lagom CMake dir to .gitignoreBrian Gianforcaro
Meta/Lagom/build seems to be the expected cmake output directory. (It's hardcoded in Libraries/LibJS/Tests/run-tests.) Add it to the project .gitignore
2020-04-13Build: Use c++ as default HOST_CXXJean-Baptiste Boric
2020-04-13js: Output text using printf() and return undefined in help()Linus Groh
2020-04-13Kernel: Don't ignore validation result in ptrace(PT_PEEK)Andreas Kling
Also mark all of the address validation functions [[nodiscard]] to turn this kind of bug into a compile error in the future.
2020-04-13Kernel: Use copy_from_user() in ptrace(PT_PEEK)Andreas Kling
2020-04-13Kernel: Switch the first-8MB-of-upper-3GB pseudo mappings to 4KB pagesAndreas Kling
This memory range was set up using 2MB pages by the code in boot.S. Because of that, the kernel image protection code didn't work, since it assumed 4KB pages. We now switch to 4KB pages during MemoryManager initialization. This makes the kernel image protection code work correctly again. :^)
2020-04-13Meta: Add Arch Linux (and derivatives) build instructionsAndres Vieira
This patch adds a one liner to install all the dependency packages needed to compile and run Serenity on Arch Linux, Manjaro, etc
2020-04-13LibJS: Use HashMap::ensure_capacity() in enter_scope()Andreas Kling
Preallocate some space in the scope variable map. This avoids a bunch of incremental rehashing in the common case.
2020-04-13LibJS: Add more number test cases for #1680Stephan Unverwerth
2020-04-13LibJS: Remove Interpreter::declare_variable()Andreas Kling
Since declarations are now hoisted and handled on scope entry, the job of a VariableDeclaration becomes to actually initialize variables. As such, we can remove the part where we insert variables into the nearest relevant scope. Less work == more speed! :^)
2020-04-13LibJS: Hoist variable declarations to the nearest relevant scopeAndreas Kling
"var" declarations are hoisted to the nearest function scope, while "let" and "const" are hoisted to the nearest block scope. This is done by the parser, which keeps two scope stacks, one stack for the current var scope and one for the current let/const scope. When the interpreter enters a scope, we walk all of the declarations and insert them into the variable environment. We don't support the temporal dead zone for let/const yet.
2020-04-13LibJS: Use assertNotReached() in testsLinus Groh
2020-04-13LibJS: Fix test files indentation (4 spaces)Linus Groh
2020-04-13js: Add assertNotReached() function in test modeLinus Groh
2020-04-13LibThread: Simplify the userspace Lock to remove CAS on unlock()Andreas Kling
Instead of using a separate synchronization variable, just use the lock holder TID for synchronization. This way, we only need to CAS when first acquiring a lock.
2020-04-13AK: Let FlyString::hash() assume that the string was already hashedAndreas Kling
Since the FlyString deduplication mechanism uses a HashTable, we know that any StringImpl inside a non-null FlyString will already have its lazily computed hash.
2020-04-13LibC: Fix truncated strncpy() in getlogin()Andreas Kling
2020-04-13LibC: Fix truncated strncpy() in /etc/group parsingAndreas Kling
2020-04-13LibC: Fix strncpy() overflow in /etc/passwd parsingAndreas Kling
2020-04-13LibC: Fix strncpy() overflow in gethostbyname()Andreas Kling
2020-04-13LibC: Simplify ASSERT() to reduce code sizeAndreas Kling
Instead of pushing the message, file name, line# and function name separately, we now mash the message, file name and line# into a string constant and pass that. This means that the failure path only has to push a single address onto the stack, reducing the code size and causing the compiler to inline many more functions containing an assertions (e.g RefPtr::operator*()) Obviously if you wanted minimal size, you could turn assertions off entirely, but I really like running with assertions, so let's make a little effort to reduce their impact. :^)
2020-04-13LibLine: Update display when deleting forwardAnotherTest
2020-04-13LibJS: Implement Error.prototype.name setter (#1776)Brian Gianforcaro
The MDN example for creating a custom error type in javascript uses: function CustomError(foo, message, fileName, lineNumber) { var instance = new Error(message, fileName, lineNumber); instance.name = 'CustomError'; instance.foo = foo; Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); return instance; } The name property on the Error prototype needs to be settable for this to work properly.
2020-04-13LibJS: Do not execute scripts with parse errorsStephan Unverwerth
This adds missing checks in several LibJS consumers.
2020-04-13js: Make load() available when running with --test-modeBrian Gianforcaro
The work I did to add assert as a native function in js was a step in the wrong direction. Now that js supports load() it makes sense to just move assert and anything we want to add to the test harness into pure javascript.
2020-04-13LibC: Simplify the gettid() cache by just clearing the cache in fork()Andreas Kling
It's hilarious how much better this is. Thanks to Sergey for suggesting it! :^)
2020-04-13LibJS: Tweak FunctionPrototype::to_string and constructorsStephan Unverwerth
The output of FunctionPrototype::to_string is now more in line with the output in Firefox. The builtin constructors have been extended to include their function name in the output.
2020-04-13LibJS: Throw on assignment of an const variableBrian Gianforcaro
Was stubbed out as an assert, should be handled with a runtime exception.
2020-04-13strace: Update ptrace() usageItamar
ptrace with PT_TRACEME was updated to also stop the traced thread on exit from execve.
2020-04-13Debugger: Add pledgesItamar
2020-04-13Debugger: Add DebugSessionItamar
The DebugSession class wraps the usage of Ptrace. It is intended to be used by cli & gui debugger programs. Also, call objdump for disassemly
2020-04-13ptrace: Report error in PT_PEEK via errnoItamar
The syscall wrapper for ptrace needs to return the peeked value when using PT_PEEK. Because of this, the user has to check errno to detect an error in PT_PEEK. This commit changes the actual syscall's interface (only for PT_PEEK) to allow the syscall wrapper to detect an error and change errno.
2020-04-13Process: Fix siginfo for code CLD_STOPPEDItamar
si_code, si_status where swapped
2020-04-13ptrace: Add PT_SETREGSItamar
PT_SETTREGS sets the regsiters of the traced thread. It can only be used when the tracee is stopped. Also, refactor ptrace. The implementation was getting long and cluttered the alraedy large Process.cpp file. This commit moves the bulk of the implementation to Kernel/Ptrace.cpp, and factors out peek & poke to separate methods of the Process class.
2020-04-13ptrace: Stop a traced thread when it exists from execveItamar
This was a missing feature in the PT_TRACEME command. This feature allows the tracer to interact with the tracee before the tracee has started executing its program. It will be useful for automatically inserting a breakpoint at a debugged program's entry point.
2020-04-13Thread: Set m_blocker to null in Thread::unblock()Itamar
Before this commit, m_blocker was only set to null in Thread::block, after the thread has been unblocked. Starting with this commit, m_blocker is also set to null in Thread::unblock. This change will allow us to implement a missing feature of the PT_TRACE command of the ptrace syscall - stopping the traced thread when it exits the execve syscall. That feature will be implemented by sending a blocking SIGSTOP to the traced thread after it has executed the execve logic and before it starts executing the new program in userspace. However, since Process::exec arranges the tss to return to userspace (the so-called "yield-teleport"), the code in Thread::block that should be run after the thread unblocks, and sets m_blocker to null, never actually runs. Setting m_blocker to null in Thread::unblock allows us to avoid an incorrect state where the thread is in a Running state but conatins a pointer to a Blocker.
2020-04-13ptrace: Add PT_POKEItamar
PT_POKE writes a single word to the tracee's address space. Some caveats: - If the user requests to write to an address in a read-only region, we temporarily change the page's protections to allow it. - If the user requests to write to a region that's backed by a SharedInodeVMObject, we replace the vmobject with a PrivateIndoeVMObject.
2020-04-13Debugger: Get entry point of debugged processItamar
Also, start debugging only after execve is done
2020-04-13ptrace: Add PT_PEEKItamar
PT_PEEK reads a single word from the tracee's address space and returns it to the tracer.