Gu.
Gu.

Reputation: 123

Module verification failed when insmod a module

On Ubuntu 14.04, Kernel 3.13.0, When I insert below simple module, I got error message from kernel log: "module verification failed: signature and/or required key missing - tainting kernel"

Did I made any mistake or missed anything? Here is module source code in a file named ts2.c.

#include <linux/module.h>   /* Needed by all modules */
#include <linux/kernel.h>   /* Needed for KERN_INFO */
#include <linux/init.h>


MODULE_LICENSE("GPL");
MODULE_ALIAS("hello2");

static int __init hello1_init(void)
{
    printk(KERN_INFO "Hello world 2.\n");
    return 0;
}

static void __exit hello1_exit(void)
{
    printk(KERN_INFO "Goodbye world 2.\n");
}

module_init(hello1_init);
module_exit(hello1_exit);

Here is the Makefile:

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := ts2.o
else    
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

modules:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) modules
clean:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) clean

endif

depend .depend dep:
    $(CC) $(EXTRA_CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif

Upvotes: 4

Views: 5951

Answers (1)

ASHU
ASHU

Reputation: 214

You have a problem in your make file...

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := ts2.o

Rather it should be as below:

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE),)
obj-m   := hello1.o

Now your issues should be solved

Upvotes: 2

Related Questions