lkml.org 
[lkml]   [2000]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: access_ok problem through system_call
From
Date
niloufer@utdallas.edu (Niloufer Vajifdar) writes:

> hi,
>
> i'm new to linux kernel programming and i'm having the following problem:
>
> When trying to use the sys_read and sys_write calls from within another
> system call the return value is -14 (bad address EFAULT). This seems to be
> happening because the 'access_ok' function is not allowing the access to
> the buffer being used to read or write.
>
> Could someone explain why this is happening? Is it wrong to use
> sys_read/sys_write through another system call?

You have to do

mm_segment_t oldfs = get_fs(); set_fs(KERNEL_DS);
/* call system call with kernel pointers */
set_fs(oldfs):

Otherwise it would be possible for every user to access kernel memory
by passing pointers to it to system calls.

-Andi

--
This is like TV. I don't like TV.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.090 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site