mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Merge remote-tracking branch 'public/bug4650_nm_squashed'
This commit is contained in:
commit
5e9d349979
4 changed files with 41 additions and 12 deletions
7
changes/bug4650
Normal file
7
changes/bug4650
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
o Minor features:
|
||||||
|
- Log more useful messages when we fail to disable debugger attachment.
|
||||||
|
|
||||||
|
o Minor bugfixes:
|
||||||
|
- Reject attempts to disable DisableDebuggerAttachment while Tor is
|
||||||
|
running. Fixes bug 4650; bugfix on 0.2.3.9-alpha.
|
||||||
|
|
|
@ -282,8 +282,8 @@ Other options can be specified either on the command-line (--option
|
||||||
to alter the system wide ptrace scope as it may not even exist. If you wish
|
to alter the system wide ptrace scope as it may not even exist. If you wish
|
||||||
to attach to Tor with a debugger such as gdb or strace you will want to set
|
to attach to Tor with a debugger such as gdb or strace you will want to set
|
||||||
this to 0 for the duration of your debugging. Normal users should leave it
|
this to 0 for the duration of your debugging. Normal users should leave it
|
||||||
on. (Default: 1)
|
on. Disabling this option while Tor is running is prohibited. (Default: 1)
|
||||||
|
|
||||||
**FetchDirInfoEarly** **0**|**1**::
|
**FetchDirInfoEarly** **0**|**1**::
|
||||||
If set to 1, Tor will always fetch directory information like other
|
If set to 1, Tor will always fetch directory information like other
|
||||||
directory caches, even if you don't meet the normal criteria for fetching
|
directory caches, even if you don't meet the normal criteria for fetching
|
||||||
|
|
|
@ -1542,8 +1542,8 @@ switch_id(const char *user)
|
||||||
* CAP_SYS_PTRACE and so it is very likely that root will still be able to
|
* CAP_SYS_PTRACE and so it is very likely that root will still be able to
|
||||||
* attach to the Tor process.
|
* attach to the Tor process.
|
||||||
*/
|
*/
|
||||||
/** Attempt to disable debugger attachment: return 0 on success, -1 on
|
/** Attempt to disable debugger attachment: return 1 on success, -1 on
|
||||||
* failure. */
|
* failure, and 0 if we don't know how to try on this platform. */
|
||||||
int
|
int
|
||||||
tor_disable_debugger_attach(void)
|
tor_disable_debugger_attach(void)
|
||||||
{
|
{
|
||||||
|
@ -1568,11 +1568,12 @@ tor_disable_debugger_attach(void)
|
||||||
|
|
||||||
// XXX: TODO - Mac OS X has dtrace and this may be disabled.
|
// XXX: TODO - Mac OS X has dtrace and this may be disabled.
|
||||||
// XXX: TODO - Windows probably has something similar
|
// XXX: TODO - Windows probably has something similar
|
||||||
if (r == 0) {
|
if (r == 0 && attempted) {
|
||||||
log_debug(LD_CONFIG,"Debugger attachment disabled for "
|
log_debug(LD_CONFIG,"Debugger attachment disabled for "
|
||||||
"unprivileged users.");
|
"unprivileged users.");
|
||||||
|
return 1;
|
||||||
} else if (attempted) {
|
} else if (attempted) {
|
||||||
log_warn(LD_CONFIG, "Unable to disable ptrace attach: %s",
|
log_warn(LD_CONFIG, "Unable to disable debugger attaching: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -1326,12 +1326,26 @@ options_act(const or_options_t *old_options)
|
||||||
const int transition_affects_workers =
|
const int transition_affects_workers =
|
||||||
old_options && options_transition_affects_workers(old_options, options);
|
old_options && options_transition_affects_workers(old_options, options);
|
||||||
|
|
||||||
/* disable ptrace and later, other basic debugging techniques */
|
/* disable ptrace and later, other basic debugging techniques */
|
||||||
if (options->DisableDebuggerAttachment) {
|
{
|
||||||
tor_disable_debugger_attach();
|
/* Remember if we already disabled debugger attachment */
|
||||||
} else {
|
static int disabled_debugger_attach = 0;
|
||||||
log_notice(LD_CONFIG,"Debugger attachment enabled "
|
/* Remember if we already warned about being configured not to disable
|
||||||
"for unprivileged users.");
|
* debugger attachment */
|
||||||
|
static int warned_debugger_attach = 0;
|
||||||
|
if (options->DisableDebuggerAttachment && !disabled_debugger_attach) {
|
||||||
|
int ok = tor_disable_debugger_attach();
|
||||||
|
if (warned_debugger_attach && ok == 1) {
|
||||||
|
log_notice(LD_CONFIG, "Disabled attaching debuggers for unprivileged "
|
||||||
|
"users.");
|
||||||
|
}
|
||||||
|
disabled_debugger_attach = (ok == 1);
|
||||||
|
} else if (!options->DisableDebuggerAttachment &&
|
||||||
|
!warned_debugger_attach) {
|
||||||
|
log_notice(LD_CONFIG, "Not disabling debugger attaching for "
|
||||||
|
"unprivileged users.");
|
||||||
|
warned_debugger_attach = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (running_tor && !have_lockfile()) {
|
if (running_tor && !have_lockfile()) {
|
||||||
|
@ -4170,6 +4184,13 @@ options_transition_allowed(const or_options_t *old,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old->DisableDebuggerAttachment &&
|
||||||
|
!new_val->DisableDebuggerAttachment) {
|
||||||
|
*msg = tor_strdup("While Tor is running, disabling "
|
||||||
|
"DisableDebuggerAttachment is not allowed.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue