aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process
AgeCommit message (Collapse)Author
2022-11-01Remove `BUG()` in Windows process read callback.Alexander Færøy
This BUG() was added when the code was written to see if this callback was ever executed after we marked the handle as EOF. It turns out, it does, but we handle it gracefully. We can therefore remove the BUG(). Fixes tpo/core/tor#40596.
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-07-29Remove the connection_t.outbuf_flushlen fieldNick Mathewson
This was once used for rate-limiting, but now it's only for accounting. It hasn't served a useful purpose in a long time. Closes ticket 33097.
2020-07-13Bug 31812: Change http URL's to httpsJeremyRand
2020-03-26Add a SUBSYS_DECLARE_LOCATION() to every subsystem.Nick Mathewson
2020-03-05Merge branch 'clang_format_prep_3'Nick Mathewson
2020-02-24Move process subsystem after evloop.Nick Mathewson
Process uses evloop, and so should be initialized after it.
2020-02-24Move winprocess_sys into a new low-level hardening moduleNick Mathewson
This code was in our process module, but it doesn't belong there: process is for launching and monitoring subprocesses, not for hardening the current process. This change lets us have our subsystem init order more closely match our dependency order.
2020-02-10Use semicolons after HT_PROTOTYPE and HT_GENERATE.Nick Mathewson
2020-01-09Merge branch 'pre_formatter_cleanups_squashed'Nick Mathewson
2020-01-09process.h: include stdbool.hNick Mathewson
We use bool, so we should include stdbool.
2020-01-09process.h: add a struct declaration for buf_t.Nick Mathewson
This lets us avoid a dependency on include order.
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-12-20Code Style: Delete headers that are included twiceteor
These changes were created using the "make autostyle" from 32522, and then split into commits.
2019-11-26If statements to getresuid() and getresgid() in setuid.c shouldn't have an ↵Neel Chauhan
extra space
2019-11-15Doxygen: rename all .dox files to end with .mdNick Mathewson
Using a standard ending here will let other tools that expect markdown understand our output here. This commit was automatically generated with: for fn in $(find src -name '*.dox'); do \ git mv "$fn" "${fn%.dox}.md"; \ done
2019-11-15Doxygen: remove /** and **/ from all .dox filesNick Mathewson
This is an automatically generated commit, made with: find src -name '*.dox' | \ xargs perl -i -ne 'print unless (m#^\s*/?\*\*/?\s*$#);'
2019-11-04Doxygen: document the rest of the directories in lib.Nick Mathewson
(This copies documentation from doc/HACKING/design, and edits for concisensess and clarity.)
2019-11-04Doxygen: Avoid ambiguity in @dir directivesNick Mathewson
This commit was automatically generated with: find src -name '*.dox' |xargs perl -i -pe 's{\@dir ([^/])}{\@dir /$1};'
2019-11-04Add stub directory-level documentation for most source directoriesNick Mathewson
This includes app, core, feature, lib, and tools, but excludes ext, test, and trunnel. This was generated by the following shell script: cd src for dname in $(find lib core feature app tools -type d |grep -v \\.deps$); do keyword="$(echo "$dname" |sed -e "s/\//_/" )" target="${dname}/${keyword}.dox" echo "$target" cat <<EOF >"$target" /** @dir ${dname} @brief ${dname} **/ EOF git add "$target" done
2019-10-22Merge remote-tracking branch 'tor-github/pr/1417'Nick Mathewson
2019-10-18Merge branch 'maint-0.4.2'Nick Mathewson
2019-10-17Ensure that the exit callback is called if CreateProcessA() fails on Windows.Alexander Færøy
This patch fixes an issue where the exit handler is not called for the given process_t in case CreateProcessA() fails. This could, for example, happen if the user tries to execute a binary that does not exist. See: https://bugs.torproject.org/31810
2019-10-17Handle errors from execve() in the Unix process backend more gracefully.Alexander Færøy
This patch removes a call to tor_assert_unreached() after execve() failed. This assertion leads to the child process emitting a stack trace on its standard output, which makes the error harder for the user to demystify, since they think it is an internal error in Tor instead of "just" being a "no such file or directory" error. The process will now instead output "Error from child process: X" where X is the stringified version of the errno value. See: https://bugs.torproject.org/31810
2019-10-16Check tor_vasprintf for error return values.Tobias Stoeckmann
In case of error, a negative value will be returned or NULL written into first supplied argument. This patch uses both cases to comply with style in the specific files. A tor_vasprintf error in process_vprintf would lead to a NULL dereference later on in buf_add, because the return value -1 casted to size_t would pass an assertion check inside of buf_add. On the other hand, common systems will fail on such an operation, so it is not a huge difference to a simple assertion. Yet it is better to properly fail instead of relying on such behaviour on all systems. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-10-16Doxygen: fix unrecognized commands.Nick Mathewson
Doxygen seems to interpret anything starting with \ as a command, even when we don't mean it that way.
2019-09-30Re-run "make autostyle" with improved annotate_ifdef_directivesNick Mathewson
2019-09-26Run "make autostyle" with new "annotate_ifdef_directives"Nick Mathewson
2019-09-10Merge branch 'bug31615_040' into bug31615_041teor
Merged modified lines from bug31615_040, and unmodified lines from maint-0.4.1.
2019-09-06subsys: Make the subsystem init order match the module dependenciesteor
Fix levels for subsystems that depend on log/err * winprocess (security) doesn't use err: * call windows process security APIs as early as possible * init err after winprocess * move wallclock so it's still after err * network and time depend on log: * make sure that network and time can use logging. * init network and time after log Add comments explaining the module init order. Fixes bug 31615; bugfix on 0.4.0.1-alpha.
2019-06-05Run "make autostyle."Nick Mathewson
2019-05-02Add comments to include.am files to note where new sources goNick Mathewson
This mechanism isn't perfect, and sometimes it will guess wrong, but it will help our automation.
2019-03-25Pass NULL to lpApplicationName in CreateProcessA().Alexander Færøy
When NULL is given to lpApplicationName we enable Windows' "magical" path interpretation logic, which makes Tor 0.4.x behave in the same way as previous Tor versions did when it comes to executing binaries in different system paths. For more information about this have a look at the CreateProcessA() documentation on MSDN -- especially the string interpretation example is useful to understand this issue. This bug was introduced in commit bfb94dd2ca8. See: https://bugs.torproject.org/29874
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-11Actually close the stdout pipe on error in process_unix_execKris Katterjohn
When cleaning up after an error in process_unix_exec, the stdin pipe was being double closed instead of closing both the stdin and stdout pipes. This occurred in two places. Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2018-12-21Fix priority on process subsystem level: it uses "net"Nick Mathewson
2018-12-21Merge branch 'ticket28847'Nick Mathewson
2018-12-21Use the subsystem list to initialize and shutdown process module.Alexander Færøy
This patch makes the process module use the subsystem list for initializing and shutting down. See: https://bugs.torproject.org/28847
2018-12-20Forward declare smartlist_t in process.hAlexander Færøy
This allows other libraries to include process.h without including the smartlist_t headers first. See: https://bugs.torproject.org/28847
2018-12-20No need to log ordinary EOF conditions as LOG_WARN.Alexander Færøy
Let's not use log_warn() when a pipe is closed under what should be considered normal conditions. See: https://bugs.torproject.org/28179
2018-12-20Make example CancelIoEx() code use CancelIo().Alexander Færøy
This patch changes the CancelIoEx() example code to use CancelIo(), which is available for older versions of Windows too. I still think the kernel handles this nicely by sending broken pipes if either side closes the pipe while I/O operations are pending. See: https://bugs.torproject.org/28179
2018-12-20Handle ERROR_BROKEN_PIPE in completion routines.Alexander Færøy
Handle `ERROR_BROKEN_PIPE` from ReadFileEx() and WriteFileEx() in process_win32_stdin_write_done() and process_win32_handle_read_completion() instead of in the early handler. This most importantmly makes sure that `reached_eof` is set to true when these errors appears. See: https://bugs.torproject.org/28179
2018-12-20Remember to set `reached_eof` when our handles are reporting errors.Alexander Færøy
This patch adds some missing calls to set `reached_eof` of our handles when various error conditions happens or when we close our handle (which happens at `process_terminate()`. See: https://bugs.torproject.org/28179
2018-12-20Handle errors even after success from ReadFileEx() and WriteFileEx().Alexander Færøy
This patch adds some additional error checking after calls to ReadFileEx() and WriteFileEx(). I have not managed to get this code to reach the branch where `error_code` is NOT `ERROR_SUCCESS`, but MSDN says one should check for this condition so we do so just to be safe. See: https://bugs.torproject.org/28179
2018-12-20Delay checking process for termination until both stdout and stderr are closed.Alexander Færøy
This patch makes us delay checking for whether we have an exit code value (via GetExitCodeProcess()) until both stdout and stderr have been closed by the operating system either by the process itself or by process cleanup after termination. See: https://bugs.torproject.org/28179
2018-12-20Remember to close the child process' ends of the pipes.Alexander Færøy
This prevents us from leaking the HANDLE for stdout, stderr, and stdin. See: https://bugs.torproject.org/28179
2018-12-18Avoid breaking the event loop prematurely.Alexander Færøy
This patch makes sure that we terminate the event loop from the event loop timer instead of directly in the process' exit handler. This allows us to run the event loop an additional time to ensure that the SleepEx() call on Windows is called and the data from stdout/stderr is delivered to us. Additionally we ensure that we don't try to read or write data from a Unix process that have been terminated in the main loop, since its file descriptors are closed at that time. See: https://bugs.torproject.org/28179
2018-12-17lib/process may include lib/buf.Nick Mathewson
2018-12-17Update location of buffers.hNick Mathewson