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
nexedi
linux
Commits
1e20ab23
Commit
1e20ab23
authored
Jan 16, 2003
by
Jeff Dike
Browse files
Options
Browse Files
Download
Plain Diff
Merge jdike.wstearns.org:/home/jdike/linux/linus-2.5
into jdike.wstearns.org:/home/jdike/linux/skas-2.5
parents
eec91b48
44583d38
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
37 deletions
+65
-37
arch/um/drivers/harddog_user.c
arch/um/drivers/harddog_user.c
+4
-1
arch/um/drivers/port_kern.c
arch/um/drivers/port_kern.c
+5
-6
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 @
1e20ab23
...
...
@@ -11,6 +11,8 @@
#include "helper.h"
#include "mconsole.h"
#include "os.h"
#include "choose-mode.h"
#include "mode.h"
struct
dog_data
{
int
stdin
;
...
...
@@ -63,7 +65,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
args
=
mconsole_args
;
}
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
;
}
...
...
arch/um/drivers/port_kern.c
View file @
1e20ab23
...
...
@@ -32,8 +32,8 @@ struct port_list {
struct
port_dev
{
struct
port_list
*
port
;
int
fd
;
int
helper_pid
;
int
telnetd_pid
;
int
helper_pid
;
int
telnetd_pid
;
};
struct
connection
{
...
...
@@ -50,7 +50,7 @@ static void pipe_interrupt(int irq, void *data, struct pt_regs *regs)
struct
connection
*
conn
=
data
;
int
fd
;
fd
=
os_rcv_fd
(
conn
->
socket
[
0
],
&
conn
->
helper_pid
);
fd
=
os_rcv_fd
(
conn
->
socket
[
0
],
&
conn
->
helper_pid
);
if
(
fd
<
0
){
if
(
fd
==
-
EAGAIN
)
return
;
...
...
@@ -99,7 +99,8 @@ static int port_accept(struct port_list *port)
}
list_add
(
&
conn
->
list
,
&
port
->
pending
);
return
(
1
);
ret
=
1
;
goto
out
;
out_free:
kfree
(
conn
);
...
...
@@ -274,8 +275,6 @@ void port_kern_free(void *d)
{
struct
port_dev
*
dev
=
d
;
if
(
dev
->
helper_pid
!=
-
1
)
os_kill_process
(
dev
->
helper_pid
,
0
);
if
(
dev
->
telnetd_pid
!=
-
1
)
os_kill_process
(
dev
->
telnetd_pid
,
0
);
kfree
(
dev
);
}
...
...
arch/um/
kernel/skas/
include/skas_ptrace.h
→
arch/um/include/skas_ptrace.h
View file @
1e20ab23
File moved
arch/um/kernel/tt/tracer.c
View file @
1e20ab23
...
...
@@ -120,16 +120,6 @@ static int signal_tramp(void *arg)
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
)
{
switch
(
sig
){
...
...
@@ -214,9 +204,6 @@ int tracer(int (*init_proc)(void *), void *sp)
signal
(
SIGSEGV
,
(
sighandler_t
)
tracer_segv
);
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
){
printf
(
"Tracing thread pausing to be attached
\n
"
);
stop
();
...
...
arch/um/kernel/um_arch.c
View file @
1e20ab23
...
...
@@ -110,12 +110,14 @@ unsigned long start_vm;
unsigned
long
end_vm
;
int
ncpus
=
1
;
#ifdef CONFIG_MODE_TT
/* 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
* problems.
*/
static
char
*
argv1_begin
=
NULL
;
static
char
*
argv1_end
=
NULL
;
#endif
/* Set in early boot */
static
int
have_root
__initdata
=
0
;
...
...
@@ -123,6 +125,7 @@ long physmem_size = 32 * 1024 * 1024;
void
set_cmdline
(
char
*
cmd
)
{
#ifdef CONFIG_MODE_TT
char
*
umid
,
*
ptr
;
if
(
CHOOSE_MODE
(
honeypot
,
0
))
return
;
...
...
@@ -139,6 +142,7 @@ void set_cmdline(char *cmd)
snprintf
(
ptr
,
(
argv1_end
-
ptr
)
*
sizeof
(
*
ptr
),
" [%s]"
,
cmd
);
memset
(
argv1_begin
+
strlen
(
argv1_begin
),
'\0'
,
argv1_end
-
argv1_begin
-
strlen
(
argv1_begin
));
#endif
}
static
char
*
usage_string
=
...
...
@@ -199,23 +203,28 @@ static int __init mode_tt_setup(char *line, int *add)
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
#ifdef CONFIG_MODE_SKAS
#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
#ifdef CONFIG_MODE_TT
#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
#error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled
...
...
@@ -224,6 +233,13 @@ __uml_setup("mode=tt", mode_tt_setup,
#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
;
static
int
__init
Usage
(
char
*
line
,
int
*
add
)
...
...
@@ -307,8 +323,10 @@ int linux_main(int argc, char **argv)
setup_machinename
(
system_utsname
.
machine
);
#ifdef CONFIG_MODE_TT
argv1_begin
=
argv
[
1
];
argv1_end
=
&
argv
[
1
][
strlen
(
argv
[
1
])];
#endif
set_usable_vm
(
uml_physmem
,
get_kmem_end
());
...
...
arch/um/main.c
View file @
1e20ab23
...
...
@@ -15,10 +15,12 @@
#include "user_util.h"
#include "kern_util.h"
#include "mem_user.h"
#include "signal_user.h"
#include "user.h"
#include "init.h"
#include "mode.h"
#include "choose-mode.h"
#include "uml-config.h"
/* Set in set_stklim, which is called from main and __wrap_malloc.
* __wrap_malloc only calls it if main hasn't started.
...
...
@@ -32,11 +34,6 @@ char *linux_prog;
#define STACKSIZE (8 * 1024 * 1024)
#define THREAD_NAME_LEN (256)
/* Never changed */
static
char
padding
[
THREAD_NAME_LEN
]
=
{
[
0
...
THREAD_NAME_LEN
-
2
]
=
' '
,
'\0'
};
static
void
set_stklim
(
void
)
{
struct
rlimit
lim
;
...
...
@@ -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
;
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
char
**
new_argv
;
sigset_t
mask
;
int
ret
,
i
;
char
**
new_argv
;
/* Enable all signals
- in some environments, we can enter with
* some signals blocked
/* Enable all signals
except SIGIO - in some environments, we can
*
enter with
some signals blocked
*/
sigemptyset
(
&
mask
);
sigaddset
(
&
mask
,
SIGIO
);
if
(
sigprocmask
(
SIG_SETMASK
,
&
mask
,
NULL
)
<
0
){
perror
(
"sigprocmask"
);
exit
(
1
);
}
#ifdef CONFIG_MODE_TT
/* Allocate memory for thread command lines */
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
*
));
if
(
!
new_argv
)
{
perror
(
"Allocating extended argv"
);
...
...
@@ -103,6 +117,7 @@ int main(int argc, char **argv, char **envp)
perror
(
"execing with extended args"
);
exit
(
1
);
}
#endif
linux_prog
=
argv
[
0
];
...
...
@@ -120,6 +135,10 @@ int main(int argc, char **argv, char **envp)
}
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
();
ret
=
linux_main
(
argc
,
argv
);
...
...
@@ -141,8 +160,10 @@ extern void *__real_malloc(int);
void
*
__wrap_malloc
(
int
size
)
{
if
(
CAN_KMALLOC
())
return
(
um_kmalloc
(
size
));
else
return
(
__real_malloc
(
size
));
if
(
CAN_KMALLOC
())
return
(
um_kmalloc
(
size
));
else
return
(
__real_malloc
(
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