Re: Kernel panic after insmod

2016-06-26 Thread Aruna Hewapathirane
> What exactly was the crash?  And where did you find this kernel module
> source from?

Greg,

A little digging around using Google threw this up :
http://superuser.com/questions/1092083/how-to-disable-kill-command-on-linux

If you scroll down you will see the exact same code :)

And completely off-topic what are the options for some of us who very much
wish to attend the Linux conference North America (
http://events.linuxfoundation.org/events/linuxcon-north-america ) but
simply cannot afford the standard registration fee of US$950 ?

And I notice Microsoft is a Diamond sponsor ? Interesting !

Aruna
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel panic after insmod

2016-06-26 Thread Greg KH
On Sun, Jun 26, 2016 at 09:35:55AM +, Manavendra Nath Manav wrote:
> Can someone explain the following kernel module code. I'm not familiar with 
> x86
> assembly so have problem understanding this part. Also it seems this code is
> able to modify the kernel stack.
> 
> /**start/
> 
> #include 
> 
> MODULE_LICENSE("GPL");
> 
> int __init init(void) __attribute__((noreturn))
> {
> unsigned long long cr0 = read_cr0();
> write_cr0(cr0 & ~(1 << 4)); /* Clear Extension Type (ET) bit */
> *(unsigned char *)sys_kill = 0xc3; /* opcode for "ret" */
> write_cr0(cr0);
> 
> /* Optional code ahead to hide traces of this module. */
> __this_module.refcnt = 1;
> __this_module.state = MODULE_STATE_LIVE;
> 
> asm
> (
> "mov %0, %%rsp\n\t"
> "mov %1, %%rdi\n\t" /* name = __this_module.name */
> "xor %%rsi, %%rsi\n\t" /* flags = 0 */
> "jmp sys_delete_module\n\t" /* call delete_module(name, flags) */
> :: "r"(current->stack + THREAD_SIZE - sizeof(struct pt_regs) - 8), "r"(__
> this_module.name) :
> );
> }
> 
> void __exit exit(void)
> {
> return;
> }
> 
> /***end*/

What exactly was the crash?  And where did you find this kernel module
source from?

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Kernel panic after insmod

2016-06-26 Thread Manavendra Nath Manav
Can someone explain the following kernel module code. I'm not familiar with
x86 assembly so have problem understanding this part. Also it seems this
code is able to modify the kernel stack.

/**start/

#include 

MODULE_LICENSE("GPL");

int __init init(void) __attribute__((noreturn))
{
unsigned long long cr0 = read_cr0();
write_cr0(cr0 & ~(1 << 4)); /* Clear Extension Type (ET) bit */
*(unsigned char *)sys_kill = 0xc3; /* opcode for "ret" */
write_cr0(cr0);

/* Optional code ahead to hide traces of this module. */
__this_module.refcnt = 1;
__this_module.state = MODULE_STATE_LIVE;

asm
(
"mov %0, %%rsp\n\t"
"mov %1, %%rdi\n\t" /* name = __this_module.name */
"xor %%rsi, %%rsi\n\t" /* flags = 0 */
"jmp sys_delete_module\n\t" /* call delete_module(name, flags) */
:: "r"(current->stack + THREAD_SIZE - sizeof(struct pt_regs) - 8), "r"(__
this_module.name) :
);
}

void __exit exit(void)
{
return;
}

/***end*/
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


spidev on davinci

2016-06-26 Thread Denis Obrezkov
Hello, I am trying to use spidev to send messages via spi on OMAP-L137 EVM
board.
I have an spidev entry in /dev, but when I try to send data, I have the
following message:

spidev spi1.0: SPI transfer failed: -22
spi_master spi1: failed to transfer one message from queue

Debugging using printk, I found out that a probe function is called, and
after this transfer_one_message is called. In transfer_one_message
master->transfer_one() function is called and returned with the error.
But I can't find the implementation of transfer_one function for
davinci_spi.

So, I have two questions:
What implementation is used by default when transfer_one implementation
isn't provided?
Should I write my own implementation of transfer_one function&



-- 
Regards, Denis Obrezkov
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies