Hi, During my play with 'run' application (./l4/pkg/loader/examples/run) I've discovered two issues. They both applies to the chain 'run'<->'loader'<->'simple_ts'. 1. First issue: I start 'con_demo1' application using 'run' utility 'l' command, then try to kill it. Kill process fails with following output (here F.02 is 'run' thread, 10.00 is 'con_demo1' task): A.00:simplets| task_kill(): Kill 10.00 from E.02 but owner is F.02 E.02:loader | l4ts_kill_task(): failed (dest=10.00 server=A.00, ret=-11, exc 0) E.02:loader | con_demo1,#10: Error -11 (not owner) killing task (ignored) It looks like inconsistency in loader's behavior. 'run' uses l4loader_app_open_call() and l4loader_app_kill_call() l4loader's methods to start and kill application, but l4loader_app_kill_call() invocation always fails as 'loader' explicitly set 'run' as owner: /* set client as owner so that client is able to kill that task */ if ((error = l4ts_owner(app->tid, app->owner))) { app_msg(app, "Error %d (%s) setting ownership", error, l4env_errstr(error)); return error; } But 'l4loader' implicitly passes itself as caller when he makes call to l4ts_kill_task() in app_cleanup_extern() function. So I think inconsistency is quite obvious. A straightforward solution here is just to remove l4ts_owner() invocation from l4loader's code. Do I miss something? 2. Second issue Scenario is the same as before: 'con_demo1' is started by 'run' and then killed by using run's 'kill' command. In this case: - 'run' calls l4loader_app_kill_call() - 'l4loader' calles app_cleanup_extern() - app_cleanup_extern() calles l4ts_kill_task(app->tid, 0) As a result simple_ts will not free allocated TaskNo for 'con_demo1' (use run's 'A' command for TS state after task has been killed). I think last argument for l4ts_kill_task() function is wrong. It should look like that: l4ts_kill_task(app->tid, L4TS_KILL_FREE) here is a path for the last issue: Index: app.c =================================================================== --- app.c (revision 439) +++ app.c (working copy) @@ -1488,7 +1488,7 @@ if (!l4_is_invalid_id(app->tid)) { killing = app->tid; - if ((error = l4ts_kill_task(app->tid, 0))) + if ((error = l4ts_kill_task(app->tid, L4TS_KILL_FREE))) app_msg(app, "Error %d (%s) killing task (ignored)", error, l4env_errstr(error)); else Any objections? Best regards, Alexander Valitov -- View this message in context: http://www.nabble.com/difficulties-with-Loader-tp22660946p22660946.html Sent from the L4 mailing list archive at Nabble.com.
Hi, Alexander Valitov wrote:
Hi,
During my play with 'run' application (./l4/pkg/loader/examples/run) I've discovered two issues. They both applies to the chain 'run'<->'loader'<->'simple_ts'.
please find attached a patch, which should fix your problems you discovered. Your patches by skipping transferring ownership will break L4Linux when using simple_ts. The issues you discovered are due to some incompatibilities of simple_ts and tasklib. The 'run' application wasn't adapted carefully (by me) to run with both, tasklib and simple_ts. The changes will be in public svn in the next days. Thanks for pointing to the issue. Alex B.
1. First issue:
I start 'con_demo1' application using 'run' utility 'l' command, then try to kill it. Kill process fails with following output (here F.02 is 'run' thread, 10.00 is 'con_demo1' task):
A.00:simplets| task_kill(): Kill 10.00 from E.02 but owner is F.02 E.02:loader | l4ts_kill_task(): failed (dest=10.00 server=A.00, ret=-11, exc 0) E.02:loader | con_demo1,#10: Error -11 (not owner) killing task (ignored)
It looks like inconsistency in loader's behavior. 'run' uses l4loader_app_open_call() and l4loader_app_kill_call() l4loader's methods to start and kill application, but l4loader_app_kill_call() invocation always fails as 'loader' explicitly set 'run' as owner:
/* set client as owner so that client is able to kill that task */ if ((error = l4ts_owner(app->tid, app->owner))) { app_msg(app, "Error %d (%s) setting ownership", error, l4env_errstr(error)); return error; }
But 'l4loader' implicitly passes itself as caller when he makes call to l4ts_kill_task() in app_cleanup_extern() function. So I think inconsistency is quite obvious. A straightforward solution here is just to remove l4ts_owner() invocation from l4loader's code.
Do I miss something?
2. Second issue
Scenario is the same as before: 'con_demo1' is started by 'run' and then killed by using run's 'kill' command.
In this case: - 'run' calls l4loader_app_kill_call() - 'l4loader' calles app_cleanup_extern() - app_cleanup_extern() calles l4ts_kill_task(app->tid, 0)
As a result simple_ts will not free allocated TaskNo for 'con_demo1' (use run's 'A' command for TS state after task has been killed). I think last argument for l4ts_kill_task() function is wrong. It should look like that:
l4ts_kill_task(app->tid, L4TS_KILL_FREE)
here is a path for the last issue:
Index: app.c =================================================================== --- app.c (revision 439) +++ app.c (working copy) @@ -1488,7 +1488,7 @@ if (!l4_is_invalid_id(app->tid)) { killing = app->tid; - if ((error = l4ts_kill_task(app->tid, 0))) + if ((error = l4ts_kill_task(app->tid, L4TS_KILL_FREE))) app_msg(app, "Error %d (%s) killing task (ignored)", error, l4env_errstr(error)); else
Any objections?
Best regards, Alexander Valitov
-- boettcher@os.inf.tu-dresden.de key finger print: 5E79 31F6 F571 5FBA CF75 33FB AA34 4AF4 A633 25B3 Index: l4/pkg/loader/examples/run/main.c =================================================================== --- l4/pkg/loader/examples/run/main.c (revision 441) +++ l4/pkg/loader/examples/run/main.c (working copy) @@ -469,12 +469,17 @@ if ((error = l4ts_taskno_to_taskid(nr, &taskid))) printf("There seems to be no corresponding task ID\n"); else - { + { +#ifdef USE_TASKLIB error = l4loader_app_kill_call(&loader_id, &taskid, 0, &env); if (DICE_HAS_EXCEPTION(&env) || error) -// if ((error = l4ts_kill_task_recursive(taskid))) printf("Error %d (%s) killing task #%02lX (exc %d)\n", error, l4env_strerror(-error), nr, DICE_EXCEPTION_MAJOR(&env)); +#else + if ((error = l4ts_kill_task_recursive(taskid))) + printf("Error %d (%s) killing task #%02lX\n", + error, l4env_strerror(-error), nr); +#endif else printf(" successfully killed.\n"); }
participants (2)
-
Alexander Boettcher -
Alexander Valitov