[Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
Hi, In the xenomai-forge psos library, t_start() does not allow a NULL args pointer, while I think this is allowed in PSOS. The below code changes fix the problem. (Note that I realize this mail is not formatted as a proper patch; if you prefer patches for these small changes, let me know). Best regards, Thomas diff --git a/lib/psos/task.c b/lib/psos/task.c --- a/lib/psos/task.c +++ b/lib/psos/task.c @@ -335,10 +335,17 @@ u_long t_start(u_long tid, return ret; task->args.entry = entry; - task->args.arg0 = args[0]; - task->args.arg1 = args[1]; - task->args.arg2 = args[2]; - task->args.arg3 = args[3]; + if (args) { + task->args.arg0 = args[0]; + task->args.arg1 = args[1]; + task->args.arg2 = args[2]; + task->args.arg3 = args[3]; + } else { + task->args.arg0 = 0; + task->args.arg1 = 0; + task->args.arg2 = 0; + task->args.arg3 = 0; + } task->mode = mode; threadobj_start(&task->thobj); put_psos_task(task); ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
On Tue, 2011-10-04 at 11:42 +0200, Thomas De Schampheleire wrote: > Hi, > > In the xenomai-forge psos library, t_start() does not allow a NULL > args pointer, while I think this is allowed in PSOS. Yes, I think so as well. Good catch. > The below code changes fix the problem. > (Note that I realize this mail is not formatted as a proper patch; if > you prefer patches for these small changes, let me know). I can deal with the patch below. However, git-generated patches are preferred. > > Best regards, > Thomas > > diff --git a/lib/psos/task.c b/lib/psos/task.c > --- a/lib/psos/task.c > +++ b/lib/psos/task.c > @@ -335,10 +335,17 @@ u_long t_start(u_long tid, > return ret; > > task->args.entry = entry; > - task->args.arg0 = args[0]; > - task->args.arg1 = args[1]; > - task->args.arg2 = args[2]; > - task->args.arg3 = args[3]; > + if (args) { > + task->args.arg0 = args[0]; > + task->args.arg1 = args[1]; > + task->args.arg2 = args[2]; > + task->args.arg3 = args[3]; > + } else { > + task->args.arg0 = 0; > + task->args.arg1 = 0; > + task->args.arg2 = 0; > + task->args.arg3 = 0; > + } > task->mode = mode; > threadobj_start(&task->thobj); > put_psos_task(task); > > ___ > Xenomai-help mailing list > Xenomai-help@gna.org > https://mail.gna.org/listinfo/xenomai-help -- Philippe. ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
> -Original Message- > On Behalf Of Thomas De Schampheleire > Sent: Tuesday, October 04, 2011 11:42 AM > ... > In the xenomai-forge psos library, t_start() does not allow a NULL > args pointer, while I think this is allowed in PSOS. The "pSOSystem System Calls" manual doesn't state the permissibility of a NULL args pointer, as far as I can see: unsigned long t_start( unsigned long tid, /* task identifier */ unsigned long mode, /* initial task attributes */ void (*start_addr)(), /* task address */ unsigned long targs[4] /* startup task arguments */ ) ... targs Specifies four startup values passed to the task (see Startup Values under Target). Target Startup Values ... A new task can receive up to four long words of input arguments. To facilitate retrieval of these arguments, they are passed to the task as if it is invoked as a highlevel language procedure or function. For example, if a C task nice has three input arguments, it can be declared as follows: nice (unsigned long a, unsigned long b, unsigned long c); where targs[0] is passed to a, targs[1] to b, and targs[2] to c. In this case, targs[3] is irrelevant and does not need the calling task to load it. -- Regards, Dietmar manroland AG Vorsitzender des Aufsichtsrates: Hanno C. Fiedler Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592 USt-Ident-Nr. DE 250200933 ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
On Tue, 2011-10-04 at 10:42 +, dietmar.schind...@manroland.com wrote: > > -Original Message- > > On Behalf Of Thomas De Schampheleire > > Sent: Tuesday, October 04, 2011 11:42 AM > > ... > > In the xenomai-forge psos library, t_start() does not allow a NULL > > args pointer, while I think this is allowed in PSOS. > > The "pSOSystem System Calls" manual doesn't state the permissibility of a > NULL args pointer, as far as I can see: > > unsigned long t_start( >unsigned long tid, /* task identifier */ >unsigned long mode, /* initial task attributes */ >void (*start_addr)(), /* task address */ >unsigned long targs[4] /* startup task arguments */ >) > ... > targs Specifies four startup values passed to the task (see Startup > Values under Target). > > Target > Startup Values > ... > A new task can receive up to four long words of input arguments. To > facilitate retrieval of these arguments, they are passed to the task as if it > is invoked as a highlevel language procedure or function. For example, if a C > task nice has three input arguments, it can be declared as follows: > > nice (unsigned long a, unsigned long b, unsigned long c); > > where targs[0] is passed to a, targs[1] to b, and targs[2] to c. In this > case, targs[3] is irrelevant and does not need the calling task to load it. > Accepting NULL was a Xenomai-specific convenience introduced in Xenomai 2.x IIRC, then I changed my mind for 3.x. Granted NULL args would not work when back on real pSOS, but that does not look like a hot issue. So we should probably just accept it anew, and be happy. > -- > Regards, > Dietmar > manroland AG Vorsitzender des > Aufsichtsrates: Hanno C. Fiedler Vorstand: Gerd Finkbeiner (Vorsitzender), > Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der Gesellschaft: Offenbach > am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592 USt-Ident-Nr. > DE 250200933 > > > ___ > Xenomai-help mailing list > Xenomai-help@gna.org > https://mail.gna.org/listinfo/xenomai-help -- Philippe. ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
On Tue, Oct 4, 2011 at 2:00 PM, Philippe Gerum wrote: > On Tue, 2011-10-04 at 10:42 +, dietmar.schind...@manroland.com > wrote: >> > -Original Message- >> > On Behalf Of Thomas De Schampheleire >> > Sent: Tuesday, October 04, 2011 11:42 AM >> > ... >> > In the xenomai-forge psos library, t_start() does not allow a NULL >> > args pointer, while I think this is allowed in PSOS. >> >> The "pSOSystem System Calls" manual doesn't state the permissibility of a >> NULL args pointer, as far as I can see: >> >> unsigned long t_start( >> unsigned long tid, /* task identifier */ >> unsigned long mode, /* initial task attributes */ >> void (*start_addr)(), /* task address */ >> unsigned long targs[4] /* startup task arguments */ >> ) >> ... >> targs Specifies four startup values passed to the task (see Startup >> Values under Target). >> >> Target >> Startup Values >> ... >> A new task can receive up to four long words of input arguments. To >> facilitate retrieval of these arguments, they are passed to the task as if >> it is invoked as a highlevel language procedure or function. For example, if >> a C task nice has three input arguments, it can be declared as follows: >> >> nice (unsigned long a, unsigned long b, unsigned long c); >> >> where targs[0] is passed to a, targs[1] to b, and targs[2] to c. In this >> case, targs[3] is irrelevant and does not need the calling task to load it. >> > > Accepting NULL was a Xenomai-specific convenience introduced in Xenomai > 2.x IIRC, then I changed my mind for 3.x. Granted NULL args would not > work when back on real pSOS, but that does not look like a hot issue. So > we should probably just accept it anew, and be happy. > >> -- >> Regards, >> Dietmar >> manroland AG Vorsitzender des >> Aufsichtsrates: Hanno C. Fiedler Vorstand: Gerd Finkbeiner (Vorsitzender), >> Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der Gesellschaft: >> Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592 >> USt-Ident-Nr. DE 250200933 >> >> >> ___ >> Xenomai-help mailing list >> Xenomai-help@gna.org >> https://mail.gna.org/listinfo/xenomai-help > > -- > Philippe. > > > > ___ > Xenomai-help mailing list > Xenomai-help@gna.org > https://mail.gna.org/listinfo/xenomai-help > Hello I think that it is supported since our application does pass a NULL pointer as args argument. The application is originally created in a real pSOS environment 12 years ago. Anyhow thanks for changing it. Ronny ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
On Tue, 2011-10-04 at 23:11 +0200, Ronny Meeus wrote: > On Tue, Oct 4, 2011 at 2:00 PM, Philippe Gerum wrote: > > On Tue, 2011-10-04 at 10:42 +, dietmar.schind...@manroland.com > > wrote: > >> > -Original Message- > >> > On Behalf Of Thomas De Schampheleire > >> > Sent: Tuesday, October 04, 2011 11:42 AM > >> > ... > >> > In the xenomai-forge psos library, t_start() does not allow a NULL > >> > args pointer, while I think this is allowed in PSOS. > >> > >> The "pSOSystem System Calls" manual doesn't state the permissibility of a > >> NULL args pointer, as far as I can see: > >> > >> unsigned long t_start( > >>unsigned long tid, /* task identifier */ > >>unsigned long mode, /* initial task attributes */ > >>void (*start_addr)(), /* task address */ > >>unsigned long targs[4] /* startup task arguments */ > >>) > >> ... > >> targs Specifies four startup values passed to the task (see Startup > >> Values under Target). > >> > >> Target > >> Startup Values > >> ... > >> A new task can receive up to four long words of input arguments. To > >> facilitate retrieval of these arguments, they are passed to the task as if > >> it is invoked as a highlevel language procedure or function. For example, > >> if a C task nice has three input arguments, it can be declared as follows: > >> > >> nice (unsigned long a, unsigned long b, unsigned long c); > >> > >> where targs[0] is passed to a, targs[1] to b, and targs[2] to c. In this > >> case, targs[3] is irrelevant and does not need the calling task to load it. > >> > > > > Accepting NULL was a Xenomai-specific convenience introduced in Xenomai > > 2.x IIRC, then I changed my mind for 3.x. Granted NULL args would not > > work when back on real pSOS, but that does not look like a hot issue. So > > we should probably just accept it anew, and be happy. > > > >> -- > >> Regards, > >> Dietmar > >> manroland AG Vorsitzender des > >> Aufsichtsrates: Hanno C. Fiedler Vorstand: Gerd Finkbeiner (Vorsitzender), > >> Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der Gesellschaft: > >> Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592 > >> USt-Ident-Nr. DE 250200933 > >> > >> > >> ___ > >> Xenomai-help mailing list > >> Xenomai-help@gna.org > >> https://mail.gna.org/listinfo/xenomai-help > > > > -- > > Philippe. > > > > > > > > ___ > > Xenomai-help mailing list > > Xenomai-help@gna.org > > https://mail.gna.org/listinfo/xenomai-help > > > > Hello > > I think that it is supported since our application does pass a NULL > pointer as args argument. > The application is originally created in a real pSOS environment 12 years ago. Ok. Was this running on MMU-enabled hw? > > Anyhow thanks for changing it. > > Ronny -- Philippe. ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] xenomai-forge [psos] t_start segmentation fault when args == NULL
On Tue, Oct 4, 2011 at 11:15 PM, Philippe Gerum wrote: > On Tue, 2011-10-04 at 23:11 +0200, Ronny Meeus wrote: >> On Tue, Oct 4, 2011 at 2:00 PM, Philippe Gerum wrote: >> > On Tue, 2011-10-04 at 10:42 +, dietmar.schind...@manroland.com >> > wrote: >> >> > -Original Message- >> >> > On Behalf Of Thomas De Schampheleire >> >> > Sent: Tuesday, October 04, 2011 11:42 AM >> >> > ... >> >> > In the xenomai-forge psos library, t_start() does not allow a NULL >> >> > args pointer, while I think this is allowed in PSOS. >> >> >> >> The "pSOSystem System Calls" manual doesn't state the permissibility of a >> >> NULL args pointer, as far as I can see: >> >> >> >> unsigned long t_start( >> >> unsigned long tid, /* task identifier */ >> >> unsigned long mode, /* initial task attributes */ >> >> void (*start_addr)(), /* task address */ >> >> unsigned long targs[4] /* startup task arguments */ >> >> ) >> >> ... >> >> targs Specifies four startup values passed to the task (see Startup >> >> Values under Target). >> >> >> >> Target >> >> Startup Values >> >> ... >> >> A new task can receive up to four long words of input arguments. To >> >> facilitate retrieval of these arguments, they are passed to the task as >> >> if it is invoked as a highlevel language procedure or function. For >> >> example, if a C task nice has three input arguments, it can be declared >> >> as follows: >> >> >> >> nice (unsigned long a, unsigned long b, unsigned long c); >> >> >> >> where targs[0] is passed to a, targs[1] to b, and targs[2] to c. In this >> >> case, targs[3] is irrelevant and does not need the calling task to load >> >> it. >> >> >> > >> > Accepting NULL was a Xenomai-specific convenience introduced in Xenomai >> > 2.x IIRC, then I changed my mind for 3.x. Granted NULL args would not >> > work when back on real pSOS, but that does not look like a hot issue. So >> > we should probably just accept it anew, and be happy. >> > >> >> -- >> >> Regards, >> >> Dietmar >> >> manroland AG Vorsitzender des >> >> Aufsichtsrates: Hanno C. Fiedler Vorstand: Gerd Finkbeiner >> >> (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle Sitz der >> >> Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach >> >> HRB-Nr. 42592 USt-Ident-Nr. DE 250200933 >> >> >> >> >> >> ___ >> >> Xenomai-help mailing list >> >> Xenomai-help@gna.org >> >> https://mail.gna.org/listinfo/xenomai-help >> > >> > -- >> > Philippe. >> > >> > >> > >> > ___ >> > Xenomai-help mailing list >> > Xenomai-help@gna.org >> > https://mail.gna.org/listinfo/xenomai-help >> > >> >> Hello >> >> I think that it is supported since our application does pass a NULL >> pointer as args argument. >> The application is originally created in a real pSOS environment 12 years >> ago. > > Ok. Was this running on MMU-enabled hw? > >> >> Anyhow thanks for changing it. >> >> Ronny > > -- > Philippe. > > > I do not think the MMU was enabled at that time but we did have an access breakpoint on 0. We were running that SW on a i960 that has support for monitoring the access to 2 addresses. Ronny ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help