Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sergi
Tor
Commits
318753f5
Commit
318753f5
authored
4 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'ticket34382' into maint-0.4.4
parents
52323151
1e98d566
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/ticket34382
+6
-0
6 additions, 0 deletions
changes/ticket34382
src/lib/sandbox/sandbox.c
+29
-2
29 additions, 2 deletions
src/lib/sandbox/sandbox.c
with
35 additions
and
2 deletions
changes/ticket34382
0 → 100644
+
6
−
0
View file @
318753f5
o Minor features (Linux seccomp2 sandbox, compilation):
- Allow Tor to build on platforms where it doesn't know how to
report which syscall had caused the linux seccomp2 sandbox
to fail. This change should make the sandbox code more portable
to less common Linux architectures.
Closes ticket 34382.
This diff is collapsed.
Click to expand it.
src/lib/sandbox/sandbox.c
+
29
−
2
View file @
318753f5
...
...
@@ -117,6 +117,10 @@
#endif
/* defined(__i386__) || ... */
#ifdef M_SYSCALL
#define SYSCALL_NAME_DEBUGGING
#endif
/**Determines if at least one sandbox is active.*/
static
int
sandbox_active
=
0
;
/** Holds the parameter list configuration for the sandbox.*/
...
...
@@ -1545,8 +1549,10 @@ install_syscall_filter(sandbox_cfg_t* cfg)
return
(
rc
<
0
?
-
rc
:
rc
);
}
#ifdef SYSCALL_NAME_DEBUGGING
#include
"lib/sandbox/linux_syscalls.inc"
/** Return a string containing the name of a given syscall (if we know it) */
static
const
char
*
get_syscall_name
(
int
syscall_num
)
{
...
...
@@ -1564,6 +1570,28 @@ get_syscall_name(int syscall_num)
}
}
/** Return the syscall number from a ucontext_t that we got in a signal
* handler (if we know how to do that). */
static
int
get_syscall_from_ucontext
(
const
ucontext_t
*
ctx
)
{
return
(
int
)
ctx
->
uc_mcontext
.
M_SYSCALL
;
}
#else
static
const
char
*
get_syscall_name
(
int
syscall_num
)
{
(
void
)
syscall_num
;
return
"unknown"
;
}
static
int
get_syscall_from_ucontext
(
const
ucontext_t
*
ctx
)
{
(
void
)
ctx
;
return
-
1
;
}
#endif
#ifdef USE_BACKTRACE
#define MAX_DEPTH 256
static
void
*
syscall_cb_buf
[
MAX_DEPTH
];
...
...
@@ -1579,7 +1607,6 @@ sigsys_debugging(int nr, siginfo_t *info, void *void_context)
{
ucontext_t
*
ctx
=
(
ucontext_t
*
)
(
void_context
);
const
char
*
syscall_name
;
int
syscall
;
#ifdef USE_BACKTRACE
size_t
depth
;
int
n_fds
,
i
;
...
...
@@ -1594,7 +1621,7 @@ sigsys_debugging(int nr, siginfo_t *info, void *void_context)
if
(
!
ctx
)
return
;
syscall
=
(
int
)
ctx
->
uc_mcontext
.
M_SYSCALL
;
int
syscall
=
get_syscall_from_ucontext
(
ctx
)
;
#ifdef USE_BACKTRACE
depth
=
backtrace
(
syscall_cb_buf
,
MAX_DEPTH
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment