Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
8bf1412a
Commit
8bf1412a
authored
Dec 29, 2002
by
Jeff Dike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forwarded ported a number of skas-related fixes from 2.4.
parent
6cc944b6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
31 deletions
+60
-31
arch/um/drivers/harddog_user.c
arch/um/drivers/harddog_user.c
+4
-1
arch/um/include/skas_ptrace.h
arch/um/include/skas_ptrace.h
+0
-0
arch/um/kernel/tt/tracer.c
arch/um/kernel/tt/tracer.c
+0
-13
arch/um/kernel/um_arch.c
arch/um/kernel/um_arch.c
+25
-7
arch/um/main.c
arch/um/main.c
+31
-10
No files found.
arch/um/drivers/harddog_user.c
View file @
8bf1412a
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include "helper.h"
#include "helper.h"
#include "mconsole.h"
#include "mconsole.h"
#include "os.h"
#include "os.h"
#include "choose-mode.h"
#include "mode.h"
struct
dog_data
{
struct
dog_data
{
int
stdin
;
int
stdin
;
...
@@ -63,7 +65,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
...
@@ -63,7 +65,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
args
=
mconsole_args
;
args
=
mconsole_args
;
}
}
else
{
else
{
sprintf
(
pid_buf
,
"%d"
,
tracing_pid
);
/* XXX The os_getpid() is not SMP correct */
sprintf
(
pid_buf
,
"%d"
,
CHOOSE_MODE
(
tracing_pid
,
os_getpid
()));
args
=
pid_args
;
args
=
pid_args
;
}
}
...
...
arch/um/
kernel/skas/
include/skas_ptrace.h
→
arch/um/include/skas_ptrace.h
View file @
8bf1412a
File moved
arch/um/kernel/tt/tracer.c
View file @
8bf1412a
...
@@ -120,16 +120,6 @@ static int signal_tramp(void *arg)
...
@@ -120,16 +120,6 @@ static int signal_tramp(void *arg)
return
((
*
proc
)(
NULL
));
return
((
*
proc
)(
NULL
));
}
}
static
void
last_ditch_exit
(
int
sig
)
{
kmalloc_ok
=
0
;
signal
(
SIGINT
,
SIG_DFL
);
signal
(
SIGTERM
,
SIG_DFL
);
signal
(
SIGHUP
,
SIG_DFL
);
uml_cleanup
();
exit
(
1
);
}
static
void
sleeping_process_signal
(
int
pid
,
int
sig
)
static
void
sleeping_process_signal
(
int
pid
,
int
sig
)
{
{
switch
(
sig
){
switch
(
sig
){
...
@@ -214,9 +204,6 @@ int tracer(int (*init_proc)(void *), void *sp)
...
@@ -214,9 +204,6 @@ int tracer(int (*init_proc)(void *), void *sp)
signal
(
SIGSEGV
,
(
sighandler_t
)
tracer_segv
);
signal
(
SIGSEGV
,
(
sighandler_t
)
tracer_segv
);
signal
(
SIGUSR1
,
signal_usr1
);
signal
(
SIGUSR1
,
signal_usr1
);
set_handler
(
SIGINT
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
set_handler
(
SIGTERM
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
set_handler
(
SIGHUP
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
if
(
debug_trace
){
if
(
debug_trace
){
printf
(
"Tracing thread pausing to be attached
\n
"
);
printf
(
"Tracing thread pausing to be attached
\n
"
);
stop
();
stop
();
...
...
arch/um/kernel/um_arch.c
View file @
8bf1412a
...
@@ -110,12 +110,14 @@ unsigned long start_vm;
...
@@ -110,12 +110,14 @@ unsigned long start_vm;
unsigned
long
end_vm
;
unsigned
long
end_vm
;
int
ncpus
=
1
;
int
ncpus
=
1
;
#ifdef CONFIG_MODE_TT
/* Pointer set in linux_main, the array itself is private to each thread,
/* Pointer set in linux_main, the array itself is private to each thread,
* and changed at address space creation time so this poses no concurrency
* and changed at address space creation time so this poses no concurrency
* problems.
* problems.
*/
*/
static
char
*
argv1_begin
=
NULL
;
static
char
*
argv1_begin
=
NULL
;
static
char
*
argv1_end
=
NULL
;
static
char
*
argv1_end
=
NULL
;
#endif
/* Set in early boot */
/* Set in early boot */
static
int
have_root
__initdata
=
0
;
static
int
have_root
__initdata
=
0
;
...
@@ -123,6 +125,7 @@ long physmem_size = 32 * 1024 * 1024;
...
@@ -123,6 +125,7 @@ long physmem_size = 32 * 1024 * 1024;
void
set_cmdline
(
char
*
cmd
)
void
set_cmdline
(
char
*
cmd
)
{
{
#ifdef CONFIG_MODE_TT
char
*
umid
,
*
ptr
;
char
*
umid
,
*
ptr
;
if
(
CHOOSE_MODE
(
honeypot
,
0
))
return
;
if
(
CHOOSE_MODE
(
honeypot
,
0
))
return
;
...
@@ -139,6 +142,7 @@ void set_cmdline(char *cmd)
...
@@ -139,6 +142,7 @@ void set_cmdline(char *cmd)
snprintf
(
ptr
,
(
argv1_end
-
ptr
)
*
sizeof
(
*
ptr
),
" [%s]"
,
cmd
);
snprintf
(
ptr
,
(
argv1_end
-
ptr
)
*
sizeof
(
*
ptr
),
" [%s]"
,
cmd
);
memset
(
argv1_begin
+
strlen
(
argv1_begin
),
'\0'
,
memset
(
argv1_begin
+
strlen
(
argv1_begin
),
'\0'
,
argv1_end
-
argv1_begin
-
strlen
(
argv1_begin
));
argv1_end
-
argv1_begin
-
strlen
(
argv1_begin
));
#endif
}
}
static
char
*
usage_string
=
static
char
*
usage_string
=
...
@@ -199,23 +203,28 @@ static int __init mode_tt_setup(char *line, int *add)
...
@@ -199,23 +203,28 @@ static int __init mode_tt_setup(char *line, int *add)
return
(
0
);
return
(
0
);
}
}
__uml_setup
(
"mode=tt"
,
mode_tt_setup
,
"mode=tt
\n
"
" When both CONFIG_MODE_TT and CONFIG_MODE_SKAS are enabled, this option
\n
"
" forces UML to run in tt (tracing thread) mode. It is not the default
\n
"
" because it's slower and less secure than skas mode.
\n\n
"
);
#else
#else
#ifdef CONFIG_MODE_SKAS
#ifdef CONFIG_MODE_SKAS
#define DEFAULT_TT 0
#define DEFAULT_TT 0
static
int
__init
mode_tt_setup
(
char
*
line
,
int
*
add
)
{
printk
(
"CONFIG_MODE_TT disabled - 'mode=tt' ignored
\n
"
);
return
(
0
);
}
#else
#else
#ifdef CONFIG_MODE_TT
#ifdef CONFIG_MODE_TT
#define DEFAULT_TT 1
#define DEFAULT_TT 1
static
int
__init
mode_tt_setup
(
char
*
line
,
int
*
add
)
{
printk
(
"CONFIG_MODE_SKAS disabled - 'mode=tt' redundant
\n
"
);
return
(
0
);
}
#else
#else
#error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled
#error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled
...
@@ -224,6 +233,13 @@ __uml_setup("mode=tt", mode_tt_setup,
...
@@ -224,6 +233,13 @@ __uml_setup("mode=tt", mode_tt_setup,
#endif
#endif
#endif
#endif
__uml_setup
(
"mode=tt"
,
mode_tt_setup
,
"mode=tt
\n
"
" When both CONFIG_MODE_TT and CONFIG_MODE_SKAS are enabled, this option
\n
"
" forces UML to run in tt (tracing thread) mode. It is not the default
\n
"
" because it's slower and less secure than skas mode.
\n\n
"
);
int
mode_tt
=
DEFAULT_TT
;
int
mode_tt
=
DEFAULT_TT
;
static
int
__init
Usage
(
char
*
line
,
int
*
add
)
static
int
__init
Usage
(
char
*
line
,
int
*
add
)
...
@@ -307,8 +323,10 @@ int linux_main(int argc, char **argv)
...
@@ -307,8 +323,10 @@ int linux_main(int argc, char **argv)
setup_machinename
(
system_utsname
.
machine
);
setup_machinename
(
system_utsname
.
machine
);
#ifdef CONFIG_MODE_TT
argv1_begin
=
argv
[
1
];
argv1_begin
=
argv
[
1
];
argv1_end
=
&
argv
[
1
][
strlen
(
argv
[
1
])];
argv1_end
=
&
argv
[
1
][
strlen
(
argv
[
1
])];
#endif
set_usable_vm
(
uml_physmem
,
get_kmem_end
());
set_usable_vm
(
uml_physmem
,
get_kmem_end
());
...
...
arch/um/main.c
View file @
8bf1412a
...
@@ -15,10 +15,12 @@
...
@@ -15,10 +15,12 @@
#include "user_util.h"
#include "user_util.h"
#include "kern_util.h"
#include "kern_util.h"
#include "mem_user.h"
#include "mem_user.h"
#include "signal_user.h"
#include "user.h"
#include "user.h"
#include "init.h"
#include "init.h"
#include "mode.h"
#include "mode.h"
#include "choose-mode.h"
#include "choose-mode.h"
#include "uml-config.h"
/* Set in set_stklim, which is called from main and __wrap_malloc.
/* Set in set_stklim, which is called from main and __wrap_malloc.
* __wrap_malloc only calls it if main hasn't started.
* __wrap_malloc only calls it if main hasn't started.
...
@@ -32,11 +34,6 @@ char *linux_prog;
...
@@ -32,11 +34,6 @@ char *linux_prog;
#define STACKSIZE (8 * 1024 * 1024)
#define STACKSIZE (8 * 1024 * 1024)
#define THREAD_NAME_LEN (256)
#define THREAD_NAME_LEN (256)
/* Never changed */
static
char
padding
[
THREAD_NAME_LEN
]
=
{
[
0
...
THREAD_NAME_LEN
-
2
]
=
' '
,
'\0'
};
static
void
set_stklim
(
void
)
static
void
set_stklim
(
void
)
{
{
struct
rlimit
lim
;
struct
rlimit
lim
;
...
@@ -66,26 +63,43 @@ static __init void do_uml_initcalls(void)
...
@@ -66,26 +63,43 @@ static __init void do_uml_initcalls(void)
}
}
}
}
static
void
last_ditch_exit
(
int
sig
)
{
CHOOSE_MODE
(
kmalloc_ok
=
0
,
(
void
)
0
);
signal
(
SIGINT
,
SIG_DFL
);
signal
(
SIGTERM
,
SIG_DFL
);
signal
(
SIGHUP
,
SIG_DFL
);
uml_cleanup
();
exit
(
1
);
}
extern
int
uml_exitcode
;
extern
int
uml_exitcode
;
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
{
char
**
new_argv
;
sigset_t
mask
;
sigset_t
mask
;
int
ret
,
i
;
int
ret
,
i
;
char
**
new_argv
;
/* Enable all signals
- in some environments, we can enter with
/* Enable all signals
except SIGIO - in some environments, we can
* some signals blocked
*
enter with
some signals blocked
*/
*/
sigemptyset
(
&
mask
);
sigemptyset
(
&
mask
);
sigaddset
(
&
mask
,
SIGIO
);
if
(
sigprocmask
(
SIG_SETMASK
,
&
mask
,
NULL
)
<
0
){
if
(
sigprocmask
(
SIG_SETMASK
,
&
mask
,
NULL
)
<
0
){
perror
(
"sigprocmask"
);
perror
(
"sigprocmask"
);
exit
(
1
);
exit
(
1
);
}
}
#ifdef CONFIG_MODE_TT
/* Allocate memory for thread command lines */
/* Allocate memory for thread command lines */
if
(
argc
<
2
||
strlen
(
argv
[
1
])
<
THREAD_NAME_LEN
-
1
){
if
(
argc
<
2
||
strlen
(
argv
[
1
])
<
THREAD_NAME_LEN
-
1
){
char
padding
[
THREAD_NAME_LEN
]
=
{
[
0
...
THREAD_NAME_LEN
-
2
]
=
' '
,
'\0'
};
new_argv
=
malloc
((
argc
+
2
)
*
sizeof
(
char
*
));
new_argv
=
malloc
((
argc
+
2
)
*
sizeof
(
char
*
));
if
(
!
new_argv
)
{
if
(
!
new_argv
)
{
perror
(
"Allocating extended argv"
);
perror
(
"Allocating extended argv"
);
...
@@ -103,6 +117,7 @@ int main(int argc, char **argv, char **envp)
...
@@ -103,6 +117,7 @@ int main(int argc, char **argv, char **envp)
perror
(
"execing with extended args"
);
perror
(
"execing with extended args"
);
exit
(
1
);
exit
(
1
);
}
}
#endif
linux_prog
=
argv
[
0
];
linux_prog
=
argv
[
0
];
...
@@ -120,6 +135,10 @@ int main(int argc, char **argv, char **envp)
...
@@ -120,6 +135,10 @@ int main(int argc, char **argv, char **envp)
}
}
new_argv
[
argc
]
=
NULL
;
new_argv
[
argc
]
=
NULL
;
set_handler
(
SIGINT
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
set_handler
(
SIGTERM
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
set_handler
(
SIGHUP
,
last_ditch_exit
,
SA_ONESHOT
|
SA_NODEFER
,
-
1
);
do_uml_initcalls
();
do_uml_initcalls
();
ret
=
linux_main
(
argc
,
argv
);
ret
=
linux_main
(
argc
,
argv
);
...
@@ -141,8 +160,10 @@ extern void *__real_malloc(int);
...
@@ -141,8 +160,10 @@ extern void *__real_malloc(int);
void
*
__wrap_malloc
(
int
size
)
void
*
__wrap_malloc
(
int
size
)
{
{
if
(
CAN_KMALLOC
())
return
(
um_kmalloc
(
size
));
if
(
CAN_KMALLOC
())
else
return
(
__real_malloc
(
size
));
return
(
um_kmalloc
(
size
));
else
return
(
__real_malloc
(
size
));
}
}
void
*
__wrap_calloc
(
int
n
,
int
size
)
void
*
__wrap_calloc
(
int
n
,
int
size
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment