aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/os-Linux/start_up.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 997d01944f91..b4b36e0f2e89 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -23,6 +23,7 @@
23#include "mem_user.h" 23#include "mem_user.h"
24#include "ptrace_user.h" 24#include "ptrace_user.h"
25#include "registers.h" 25#include "registers.h"
26#include "skas.h"
26#include "skas_ptrace.h" 27#include "skas_ptrace.h"
27 28
28static void ptrace_child(void) 29static void ptrace_child(void)
@@ -140,14 +141,27 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
140} 141}
141 142
142/* Changed only during early boot */ 143/* Changed only during early boot */
143int ptrace_faultinfo = 1; 144int ptrace_faultinfo;
144int ptrace_ldt = 1; 145static int disable_ptrace_faultinfo;
145int proc_mm = 1; 146
146int skas_needs_stub = 0; 147int ptrace_ldt;
148static int disable_ptrace_ldt;
149
150int proc_mm;
151static int disable_proc_mm;
152
153int have_switch_mm;
154static int disable_switch_mm;
155
156int skas_needs_stub;
147 157
148static int __init skas0_cmd_param(char *str, int* add) 158static int __init skas0_cmd_param(char *str, int* add)
149{ 159{
150 ptrace_faultinfo = proc_mm = 0; 160 disable_ptrace_faultinfo = 1;
161 disable_ptrace_ldt = 1;
162 disable_proc_mm = 1;
163 disable_switch_mm = 1;
164
151 return 0; 165 return 0;
152} 166}
153 167
@@ -157,15 +171,12 @@ static int __init mode_skas0_cmd_param(char *str, int* add)
157 __attribute__((alias("skas0_cmd_param"))); 171 __attribute__((alias("skas0_cmd_param")));
158 172
159__uml_setup("skas0", skas0_cmd_param, 173__uml_setup("skas0", skas0_cmd_param,
160 "skas0\n" 174"skas0\n"
161 " Disables SKAS3 usage, so that SKAS0 is used, unless \n" 175" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used\n\n");
162 " you specify mode=tt.\n\n");
163 176
164__uml_setup("mode=skas0", mode_skas0_cmd_param, 177__uml_setup("mode=skas0", mode_skas0_cmd_param,
165 "mode=skas0\n" 178"mode=skas0\n"
166 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n" 179" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used.\n\n");
167 " specify mode=tt. Note that this was recently added - on \n"
168 " older kernels you must use simply \"skas0\".\n\n");
169 180
170/* Changed only during early boot */ 181/* Changed only during early boot */
171static int force_sysemu_disabled = 0; 182static int force_sysemu_disabled = 0;
@@ -360,7 +371,7 @@ void __init os_early_checks(void)
360 371
361static int __init noprocmm_cmd_param(char *str, int* add) 372static int __init noprocmm_cmd_param(char *str, int* add)
362{ 373{
363 proc_mm = 0; 374 disable_proc_mm = 1;
364 return 0; 375 return 0;
365} 376}
366 377
@@ -372,7 +383,7 @@ __uml_setup("noprocmm", noprocmm_cmd_param,
372 383
373static int __init noptracefaultinfo_cmd_param(char *str, int* add) 384static int __init noptracefaultinfo_cmd_param(char *str, int* add)
374{ 385{
375 ptrace_faultinfo = 0; 386 disable_ptrace_faultinfo = 1;
376 return 0; 387 return 0;
377} 388}
378 389
@@ -384,7 +395,7 @@ __uml_setup("noptracefaultinfo", noptracefaultinfo_cmd_param,
384 395
385static int __init noptraceldt_cmd_param(char *str, int* add) 396static int __init noptraceldt_cmd_param(char *str, int* add)
386{ 397{
387 ptrace_ldt = 0; 398 disable_ptrace_ldt = 1;
388 return 0; 399 return 0;
389} 400}
390 401
@@ -404,17 +415,15 @@ static inline void check_skas3_ptrace_faultinfo(void)
404 415
405 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 416 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
406 if (n < 0) { 417 if (n < 0) {
407 ptrace_faultinfo = 0;
408 if (errno == EIO) 418 if (errno == EIO)
409 non_fatal("not found\n"); 419 non_fatal("not found\n");
410 else 420 else
411 perror("not found"); 421 perror("not found");
412 } 422 } else if (disable_ptrace_faultinfo)
423 non_fatal("found but disabled on command line\n");
413 else { 424 else {
414 if (!ptrace_faultinfo) 425 ptrace_faultinfo = 1;
415 non_fatal("found but disabled on command line\n"); 426 non_fatal("found\n");
416 else
417 non_fatal("found\n");
418 } 427 }
419 428
420 stop_ptraced_child(pid, 1, 1); 429 stop_ptraced_child(pid, 1, 1);
@@ -437,38 +446,30 @@ static inline void check_skas3_ptrace_ldt(void)
437 if (n < 0) { 446 if (n < 0) {
438 if (errno == EIO) 447 if (errno == EIO)
439 non_fatal("not found\n"); 448 non_fatal("not found\n");
440 else { 449 else
441 perror("not found"); 450 perror("not found");
442 } 451 } else if (disable_ptrace_ldt)
443 ptrace_ldt = 0; 452 non_fatal("found, but use is disabled\n");
444 }
445 else { 453 else {
446 if (ptrace_ldt) 454 ptrace_ldt = 1;
447 non_fatal("found\n"); 455 non_fatal("found\n");
448 else
449 non_fatal("found, but use is disabled\n");
450 } 456 }
451 457
452 stop_ptraced_child(pid, 1, 1); 458 stop_ptraced_child(pid, 1, 1);
453#else
454 /* PTRACE_LDT might be disabled via cmdline option.
455 * We want to override this, else we might use the stub
456 * without real need
457 */
458 ptrace_ldt = 1;
459#endif 459#endif
460} 460}
461 461
462static inline void check_skas3_proc_mm(void) 462static inline void check_skas3_proc_mm(void)
463{ 463{
464 non_fatal(" - /proc/mm..."); 464 non_fatal(" - /proc/mm...");
465 if (access("/proc/mm", W_OK) < 0) { 465 if (access("/proc/mm", W_OK) < 0)
466 proc_mm = 0;
467 perror("not found"); 466 perror("not found");
468 } 467 else if (disable_proc_mm)
469 else if (!proc_mm)
470 non_fatal("found but disabled on command line\n"); 468 non_fatal("found but disabled on command line\n");
471 else non_fatal("found\n"); 469 else {
470 proc_mm = 1;
471 non_fatal("found\n");
472 }
472} 473}
473 474
474void can_do_skas(void) 475void can_do_skas(void)