[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] Bug report for RT-Linux (Release9J)




Good spotting. Thanks.


On Mon, Jan 18, 1999 at 10:22:22AM +0900, saida24@mech.kyoto-u.ac.jp wrote:
>  Hello.
> 
>  I'm using RT-Linux Release9J.
>  And, I found some bugs(?) in this distribution.
> 
>  At first:
> 
>  In x86_init_stack in schedulers/x86/switch.h, (taks->stack) must be assigned
>  more than sizeof(int)*4 bytes memory.
>  But in rt_task_init in schedulers/rtl_sched.c, there is no guarantee that
>  (task->stack) has more than sizeof(int)*4 bytes.
>  I think it is better to add this code.
> 
>    --- in rt_task_init
>    int *st;
>    long interrupt_state;
> 
>    if( (task->magic == RT_TASK_MAGIC) || (stack_size <= 0) ){
>                                       ^^^^^^^^^^^^^^^^^^^^
>      return -EINVAL;
>    }
> 
>    stack_size += sizeof(int)*4;  /* for x86_init_stack */
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    st = (int*)kmalloc(stack_size, GFP_KERNEL);
> 
>    ... omit :-)
> 
>  Ordinaly old code will run successfully, but if (stack_size) is smaller than
>  sizeof(int)*4 then it makes a (segmentation fault) error.
> 
> 
>  Second:
> 
>  In rtf_put in fifos/rtl_fifo.c & rtl_nfifo.c, (count) value is not returned
>  correctly. Because at the end of those functions,
> 
>  --> return count;
>             ^^^^^
>  But, (count) is zero if this process is done successfully.
>  Because there is such a code in rtf_put.
> 
>     count -= chars;
>     ^^^^^^^^^^^^^^
>  I think this code is more suitable here ....
> 
>  --> return written;
>             ^^^^^^^
> 
>  Third:
> 
>  In rt_task_ipc_delete in semaphores/rt_ipc.c
> 
>   -- rt_taks_ipc_delete
>   int ret = 0;
>   if( task->magic != RT_TASK_IPC_MAGIC )
>     ret = EINVAL;
>           ^^^^^^
>   ... omit :-)
> 
>  I feel that (ret = EINVAL) is (ret = -EINVAL).
>                                       ^^^^^^^
> 
>  Fourth:
> 
>  In rt_task_delay in semaphores/rt_ipc.h, (rt_schedule) is called but now it is
>  (rtl_schedule).
> 
> 
>  That's all.
> 
>  good-bye.
> 
> //----------------------------------------
> //   Saida Takao (Kyoto Univ. in Japan)
> //   e-mail: saida24@mech.kyoto-u.ac.jp
> //----------------------------------------
> --- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
> ----
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/~rtlinux/

-- 

---------------------------------
Victor Yodaiken
Department of Computer Science
New Mexico Institute of Mining and Technology
Socorro NM 87801
Homepage		http://www.cs.nmt.edu/~yodaiken
PowerPC Linux page	http://linuxppc.cs.nmt.edu
Real-Time Page		http://rtlinux.org

--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/