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
Container Registry
Model registry
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
The Tor Project
Core
Tor
Commits
e7e2efb7
Commit
e7e2efb7
authored
11 years ago
by
Cristian Toader
Browse files
Options
Downloads
Patches
Plain Diff
Added getter for protected parameter
parent
673349c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/sandbox.c
+26
-1
26 additions, 1 deletion
src/common/sandbox.c
src/common/sandbox.h
+1
-0
1 addition, 0 deletions
src/common/sandbox.h
with
27 additions
and
1 deletion
src/common/sandbox.c
+
26
−
1
View file @
e7e2efb7
...
...
@@ -16,6 +16,7 @@
#include
"sandbox.h"
#include
"torlog.h"
#include
"orconfig.h"
#include
"torint.h"
#if defined(HAVE_SECCOMP_H) && defined(__linux__)
#define USE_LIBSECCOMP
...
...
@@ -149,6 +150,30 @@ static int general_filter[] = {
SCMP_SYS
(
unlink
)
};
char
*
get_prot_param
(
char
*
param
)
{
int
i
,
filter_size
;
if
(
param
==
NULL
)
return
NULL
;
if
(
param_filter
==
NULL
)
{
filter_size
=
0
;
}
else
{
filter_size
=
sizeof
(
param_filter
)
/
sizeof
(
param_filter
[
0
]);
}
for
(
i
=
0
;
i
<
filter_size
;
i
++
)
{
if
(
param_filter
[
i
].
prot
&&
!
strncmp
(
param
,
param_filter
[
i
].
param
,
MAX_PARAM_LEN
))
{
return
param_filter
[
i
].
param
;
}
}
return
NULL
;
}
static
int
add_param_filter
(
scmp_filter_ctx
ctx
)
{
...
...
@@ -189,7 +214,7 @@ add_param_filter(scmp_filter_ctx ctx)
}
// if not protected
rc
=
seccomp_rule_add
(
ctx
,
SCMP_ACT_ALLOW
,
param_filter
[
i
].
syscall
,
1
,
param_filter
[
i
].
param
);
SCMP_A0
(
SCMP_CMP_EQ
,
(
intptr_t
)
param_filter
[
i
].
param
)
)
;
if
(
rc
!=
0
)
{
log_err
(
LD_BUG
,
"(Sandbox) failed to add syscall index %d, "
"received libseccomp error %d"
,
i
,
rc
);
...
...
This diff is collapsed.
Click to expand it.
src/common/sandbox.h
+
1
−
0
View file @
e7e2efb7
...
...
@@ -58,6 +58,7 @@ typedef struct {
void
sandbox_set_debugging_fd
(
int
fd
);
int
tor_global_sandbox
(
void
);
char
*
get_prot_param
(
char
*
param
);
#endif
/* SANDBOX_H_ */
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