All of lore.kernel.org
 help / color / mirror / Atom feed
* adding a system call
@ 2001-01-09  0:49 Mihai Moise
  2001-01-09 14:56 ` David Woodhouse
  0 siblings, 1 reply; 14+ messages in thread
From: Mihai Moise @ 2001-01-09  0:49 UTC (permalink / raw)
  To: linux-kernel

Hello,

What is the procedure for adding a new system call to the Linux kernel?

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: adding a system call
@ 2001-01-09 14:41 Mihai Moise
  2001-01-09 19:17 ` Doug McNaught
  0 siblings, 1 reply; 14+ messages in thread
From: Mihai Moise @ 2001-01-09 14:41 UTC (permalink / raw)
  To: linux-kernel


> > What is the procedure for adding a new system call to the Linux kernel?
> 
> hack away, the code's free.  don't expect Linus to accept your 
> changes into the "real" kernel without a VERY good argument.

I know. However the Kernel Hacker's Guide writes about sys.h. After a bit of exploring, I found that sys.h has been replaced by something else in later kernels, which leaves me wondering where in the kernel I should insert my code, and where the dispatcher is located for the other system calls, in case my system call would need them.

My system call idea is to allow a superuser process to request a mmap on behalf of an user process. To see how this would be useful, let us consider svgalib.

Until now, there were two ways to allow an application access to the video array. The first was by making it setuid root, but this compromises system security by allowing it too many permissions. The second was by having a helper module which allows user applications access to the video card. However this allows any remote user to set the screen in flames.

With my new system call, a superuser process can set the graphics mode in a safe manner and then ask for an mmap of the video array into the application data segment.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* adding a system call
@ 2011-02-22 15:14 mohit verma
  2011-02-22 15:18 ` mohit verma
  0 siblings, 1 reply; 14+ messages in thread
From: mohit verma @ 2011-02-22 15:14 UTC (permalink / raw)
  To: kernelnewbies

hi all ,
i followed the link and tried to add a system call in kernel-version 2.6.37
here is the code :


#include<linux/linkage.h>
#include<linux/kernel.h>
#include<linux/fs.h>  //for getname
#include<linux/err.h> //for PTR_ERR
asmlinkage int sys_hariohm(const char __user *filename)
{
    char *tmp = getname(filename);
     int fd=PTR_ERR(tmp);
        if (!IS_ERR(tmp))
        {
        printk("filename %s \n",tmp);
        putname(tmp);
        return fd;
        }
        else
        {
        return 2;
        }
}


the compilation process was silent (without any error).
 but when i try to boot into the kernel having this system call , i get the
errors like :

do_exit() ,do_group_exit() , syscall_init() error lines with some addresses.

can someone help me understand what is wrong with this code?

thanks in advance :)

-- 
........................
*MOHIT VERMA*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110222/7eff007d/attachment.html 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-02-22 21:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-09  0:49 adding a system call Mihai Moise
2001-01-09 14:56 ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2001-01-09 14:41 Mihai Moise
2001-01-09 19:17 ` Doug McNaught
2001-01-09 19:34   ` Brian Pomerantz
2011-02-22 15:14 mohit verma
2011-02-22 15:18 ` mohit verma
2011-02-22 17:50   ` Mulyadi Santosa
2011-02-22 18:01     ` mohit verma
2011-02-22 18:10       ` Mulyadi Santosa
2011-02-22 18:19         ` mohit verma
2011-02-22 18:39           ` Mulyadi Santosa
2011-02-22 18:44             ` mohit verma
2011-02-22 21:21               ` Anuz Pratap Singh Tomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.