kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Error message not relevant
@ 2013-11-20 16:43 Nav Kamal
  2013-11-20 16:51 ` Santosh Sivaraj
  2013-11-21  6:45 ` Mulyadi Santosa
  0 siblings, 2 replies; 3+ messages in thread
From: Nav Kamal @ 2013-11-20 16:43 UTC (permalink / raw)
  To: kernelnewbies

Am learning to write LKMs and wrote this program :

#include<linux/init.h>
#include<linux/module.h>
static int module_entry(void){
        printk(KERN_ALERT "Hello World !!\n");
        return 0;
}
static void exit_module(void){
        printk(KERN_ALERT "Bye World .... \n");
}
module_init(module_entry);
module_exit(exit_module);

In this program if I change return value of function module_entry from 0 to
something negative, the module fails to load. The error message is :

"insmod: ERROR: could not insert module test.ko: Operation not permitted"

Failing to load module with negative return value is understandable but I
can't understand why it says "Operation not permitted". Its not about user
permissions, its about return value. Can somebody please guide me about
this ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131120/fe5b5236/attachment.html 

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

* Error message not relevant
  2013-11-20 16:43 Error message not relevant Nav Kamal
@ 2013-11-20 16:51 ` Santosh Sivaraj
  2013-11-21  6:45 ` Mulyadi Santosa
  1 sibling, 0 replies; 3+ messages in thread
From: Santosh Sivaraj @ 2013-11-20 16:51 UTC (permalink / raw)
  To: kernelnewbies

* Nav Kamal <navkamal90@gmail.com> wrote (on 2013-11-20 16:43:26 +0000):

> Am learning to write LKMs and wrote this program :
> 
> #include<linux/init.h>
> #include<linux/module.h>
> static int module_entry(void){
>         printk(KERN_ALERT "Hello World !!\n");
>         return 0;
> }
> static void exit_module(void){
>         printk(KERN_ALERT "Bye World .... \n");
> }
> module_init(module_entry);
> module_exit(exit_module);
> 
> In this program if I change return value of function module_entry from 0 to
> something negative, the module fails to load. The error message is :

What was the exact value? Must be you returned -1, as an example try to pass
some other lower negative numbers. It converts to error string using err or
perror. So you get that permission denied for the value you passed.


> 
> "insmod: ERROR: could not insert module test.ko: Operation not permitted"
> 
> Failing to load module with negative return value is understandable but I
> can't understand why it says "Operation not permitted". Its not about user
> permissions, its about return value. Can somebody please guide me about
> this ?

Santosh
-- 
When you really want something (and take the first steps in that direction), the
entire universe will conspire to fulfill your desire. -- P. Coelho

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

* Error message not relevant
  2013-11-20 16:43 Error message not relevant Nav Kamal
  2013-11-20 16:51 ` Santosh Sivaraj
@ 2013-11-21  6:45 ` Mulyadi Santosa
  1 sibling, 0 replies; 3+ messages in thread
From: Mulyadi Santosa @ 2013-11-21  6:45 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Nov 20, 2013 at 11:43 PM, Nav Kamal <navkamal90@gmail.com> wrote:
> Am learning to write LKMs and wrote this program :
>
> #include<linux/init.h>
> #include<linux/module.h>
> static int module_entry(void){
>         printk(KERN_ALERT "Hello World !!\n");
>         return 0;
> }
> static void exit_module(void){
>         printk(KERN_ALERT "Bye World .... \n");
> }
> module_init(module_entry);
> module_exit(exit_module);
>
> In this program if I change return value of function module_entry from 0 to
> something negative, the module fails to load. The error message is :
>
> "insmod: ERROR: could not insert module test.ko: Operation not permitted"
>
> Failing to load module with negative return value is understandable but I
> can't understand why it says "Operation not permitted". Its not about user
> permissions, its about return value. Can somebody please guide me about this
> ?

AFAIK, insmod/modprobe translate any errors during module load as "not
permitted". This doesn't mean you can not read the .ko files, it just
means you can't load it.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

end of thread, other threads:[~2013-11-21  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 16:43 Error message not relevant Nav Kamal
2013-11-20 16:51 ` Santosh Sivaraj
2013-11-21  6:45 ` Mulyadi Santosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).