Commit 13806b03 authored by Paolo \'Blaisorblade\' Giarrusso's avatar Paolo \'Blaisorblade\' Giarrusso Committed by Linus Torvalds

[PATCH] uml: refuse to run without skas if no tt mode in

Return an early error message when no TT support is compiled in and no SKAS
support is detected.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 85a5bd8e
...@@ -371,9 +371,9 @@ void forward_pending_sigio(int target) ...@@ -371,9 +371,9 @@ void forward_pending_sigio(int target)
kill(target, SIGIO); kill(target, SIGIO);
} }
int can_do_skas(void)
{
#ifdef UML_CONFIG_MODE_SKAS #ifdef UML_CONFIG_MODE_SKAS
static inline int check_skas3_ptrace_support(void)
{
struct ptrace_faultinfo fi; struct ptrace_faultinfo fi;
void *stack; void *stack;
int pid, n, ret = 1; int pid, n, ret = 1;
...@@ -382,29 +382,46 @@ int can_do_skas(void) ...@@ -382,29 +382,46 @@ int can_do_skas(void)
pid = start_ptraced_child(&stack); pid = start_ptraced_child(&stack);
n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
if(n < 0){ if (n < 0) {
if(errno == EIO) if(errno == EIO)
printf("not found\n"); printf("not found\n");
else printf("No (unexpected errno - %d)\n", errno); else {
perror("not found");
}
ret = 0; ret = 0;
} else {
printf("found\n");
} }
else printf("found\n");
init_registers(pid); init_registers(pid);
stop_ptraced_child(pid, stack, 1, 1); stop_ptraced_child(pid, stack, 1, 1);
return(ret);
}
int can_do_skas(void)
{
int ret = 1;
printf("Checking for /proc/mm..."); printf("Checking for /proc/mm...");
if(os_access("/proc/mm", OS_ACC_W_OK) < 0){ if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
printf("not found\n"); printf("not found\n");
ret = 0; ret = 0;
goto out;
} else {
printf("found\n");
} }
else printf("found\n");
return(ret); ret = check_skas3_ptrace_support();
out:
return ret;
}
#else #else
int can_do_skas(void)
{
return(0); return(0);
#endif
} }
#endif
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
......
...@@ -198,7 +198,7 @@ __uml_setup("ncpus=", uml_ncpus_setup, ...@@ -198,7 +198,7 @@ __uml_setup("ncpus=", uml_ncpus_setup,
); );
#endif #endif
int force_tt = 0; static int force_tt = 0;
#if defined(CONFIG_MODE_TT) && defined(CONFIG_MODE_SKAS) #if defined(CONFIG_MODE_TT) && defined(CONFIG_MODE_SKAS)
#define DEFAULT_TT 0 #define DEFAULT_TT 0
...@@ -319,6 +319,14 @@ int linux_main(int argc, char **argv) ...@@ -319,6 +319,14 @@ int linux_main(int argc, char **argv)
if(have_root == 0) add_arg(saved_command_line, DEFAULT_COMMAND_LINE); if(have_root == 0) add_arg(saved_command_line, DEFAULT_COMMAND_LINE);
mode_tt = force_tt ? 1 : !can_do_skas(); mode_tt = force_tt ? 1 : !can_do_skas();
#ifndef CONFIG_MODE_TT
if (mode_tt) {
/*Since CONFIG_MODE_TT is #undef'ed, force_tt cannot be 1. So,
* can_do_skas() returned 0, and the message is correct. */
printf("Support for TT mode is disabled, and no SKAS support is present on the host.\n");
exit(1);
}
#endif
uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
&host_task_size, &task_size); &host_task_size, &task_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment