Bad Address when adding system call

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Bad Address when adding system call
# 1  
Old 05-14-2011
Bad Address when adding system call

Hi guys.

I have downloaded kernel 2.6.38-5 to add a system call.
I did the following steps:

1. I have added my system call to system call table
Code:
<src folder>/arc/x86/kernel/syscall_table_32.S

.long sys_mycall

2. i have added the system cal number in
Code:
<src folder>/include/asm-generic/unistd.h

#define __NR_mycall 244
__SYSCALL(__NR_mycall, sys_mycall)

3. I have added the prototype to syscalls.h
Code:
<src follder>/include/linux/syscalls.h

asmlinkage long sys_mycall(long input);

4. here is my system call
Code:
asmlinkage long sys_mycall(long input)
{
return (input * 2);
}

5. I have edited the Makfiles
Now after compilation when i use it via syscall() it gives me "BAD ADDRESS" with errno set to 14.

What should i do?

---------- Post updated 2011-05-15 at 04:06 AM ---------- Previous update was 2011-05-14 at 08:39 PM ----------

On x86, system call number 244 is already taken by get_thread_area(), which takes as first argument a pointer to a struct user_desc:
Code:
int get_thread_area(struct user_desc *u_info);

You are passing a number instead of a pointer, the kernel is trying to interpret it as a pointer, it's determining that it points outside of your process, and returning -EFAULT.

According to this file
Code:
/usr/include/asm/unistd_32.h

the only system call number available is 251. so i changed my system call number to 251.
But this time it says: Function not implemented with errno = 38
# 2  
Old 05-15-2011
I'm not sure we have too many kernel hackers on this forum. That being said, I don't see the step were you installed your new kernel. Also, as I understand it, the better way to add system calls is through the module interface, and better yet, not to add them at all.
# 3  
Old 05-15-2011
It is for my Operating System course in university.
I have installed the new kernels like this:
How To Compile A Kernel - The Ubuntu Way | HowtoForge - Linux Howtos and Tutorials
# 4  
Old 05-15-2011
Steps 7 & 8 - you followed those?
# 5  
Old 05-15-2011
All steps except patching the kernel.
# 6  
Old 05-15-2011
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Bad system call (core dumped) Solaris 11.2 (installation of Sybase 12.5.4)

Dear all, I am trying to install Sybase ASE 12.5.4 on a Sun OS Solaris 11.2 (sparcv9) machine but I am getting the following messages when launching the setup file : -bash-4.1$ ./setup InstallShield Wizard Initializing InstallShield Wizard... Searching for Java(tm) Virtual Machine...... (2 Replies)
Discussion started by: clement_te
2 Replies

2. Shell Programming and Scripting

Adding 'from' email address alias in Linux.

Hi Experts, We want to add the 'from' email address to mailx command in all our linux script. After searching this site I am able to find the command '-- -f' to add the from the email address. Bu the problem is our from email address is :- "Proper Support Name <support@company.com>" Now when I... (6 Replies)
Discussion started by: Amey Joshi
6 Replies

3. Red Hat

Adding our system call Fedora 18 -new syscall

Hi, I wanna add my own system call to Fedora 18 kernel 3.8.2. From kernel 3.3 I heard there is a new system to add system calls. So where i can find a guides ? I wanna print this text: "Hello world!" in terminal, not dmesg. (4 Replies)
Discussion started by: googz
4 Replies

4. Programming

Adding custom ("Hello") system call: help

I'm trying to add a custom ("Hello world" :o) system call. In /usr/src/linux/hello/ I put simple hello.c ...#include "linux/linkage.h" // for linking a system call #include "linux/kernel.h" // for "printk" asmlinkage int sys_hello() { printk(KERN_ALERT "Hello!"); return 1; }... and in... (5 Replies)
Discussion started by: courteous
5 Replies

5. IP Networking

ifconfig: ce401001: bad address

HI All, My interface card has failed.If i am giving the command to uplumb it i am getting an error. ce401001: flags=219040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,FAILED,CoS> mtu 1500 index 3 inet 10.188.24.18 netmask ffffffc0 broadcast 10.188.24.63 # ifconfig... (2 Replies)
Discussion started by: sag71155
2 Replies

6. Solaris

File system is bad

Hi all, we have a 280R with Solaris 10 11/06 and Oracle 10 installed. For unknown reason the system become instable and after a reboot (init 6) we got the message to run fsck manually. We did the check many time and now we have this result: # fsck /dev/md/dsk/d0 IS CURRENTLY MOUNTED... (5 Replies)
Discussion started by: Petrucci
5 Replies

7. IP Networking

Bad Address

I am trying to write a C server code that will handle WWW request from client. i am very new to socket programming. i can very well setup the socket...but when an incomin request comes from a browser, the progrom exits with an error message "Bad address". the following is the code. please do help... (1 Reply)
Discussion started by: shankarramv
1 Replies

8. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

9. Solaris

ifconfig bad address

hi all iam trying to set my eri0 interface but with little luck . when i set the ip using ipconfig i always get "bad adress".. moreover when i use ifconfig eri0 i can notice that the inet is 0.0.0.0 and the netmask 0 i am runnig solaris 9 on sparc . any helpis highly appreciated ... ... (2 Replies)
Discussion started by: ppass
2 Replies
Login or Register to Ask a Question