Re: Error No -14 in Binding by server in Kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jan,

Thanks for your prompt reply. Sorry for giving some what wrong info . I have
written functions corresponding to  sys_* calls . I did not call them.
Ex.
sys_socket    -- my_socket
sys_bind      --  my_bind
and eliminated the file system by removing  sock_fdlookup() and other
functions which deals with filesystem.This is mainly done to avoid the file
system as a kernel module does not have any files_struct as it is associted
with user processes. Now I am maintaining my own array which contains
addresses of
BSD sockets

Pls pass on any advice.

Regards
Rekesh


> I developed on kernel module which provides wrapper functions to all sys_*
> funtions related to sockets. With this i developed one application , and i
> could run TCP server which is communicating with TCP client on the other
> m/c.
>
> Now  Developed one kernel module (instead of application in the earlier
> case)for TCP server (now Kernel module) . when the server is executing the
> bind function
> it has given Error No -14.
>
> I know that It is accessing bad area.  Any suggestions.

First, errno 14 is Bad Address. In kernel, errno values are negative.

Now, I have two suggestions:

1) Don't use syscalls from kernel. Use the sock_* functions directly.

2) If you have to call a syscall, or any other function that does
   copy_to/from_user with data in kernel, do:

    mm_segment_t oldfs = get_fs();
    set_fs(KERNEL_DS);
    <do-the-call-here>
    set_fs(oldfs);

   In fact, even if you avoid calling syscalls, read and write (and send,
   recv etc...) file/socket methods will still need this, because they
   copy_to/from_user.

----------------------------------------------------------------------------
---
       Jan 'Bulb' Hudec <bulb@xxxxxx>

----- Original Message -----
From: "Jan Hudec" <bulb@xxxxxx>
To: "Rakesh Jagota" <j.rakesh@xxxxxxxxxxxxx>
Cc: <kernelnewbies@xxxxxxxxxxxx>
Sent: Thursday, September 30, 2004 7:57 PM
Subject: Re: Error No -14 in Binding by server in Kernel module




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux