mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Fix fops write, printk after copy from user
This commit is contained in:
@@ -56,7 +56,7 @@ To exit, just do a regular:
|
|||||||
|
|
||||||
poweroff
|
poweroff
|
||||||
|
|
||||||
This is particularly useful to get full panic traces when you start making the kernel crashing :-) See also: <https://unix.stackexchange.com/questions/208260/how-to-scroll-up-after-a-kernel-panic>
|
This is particularly useful to get full panic traces when you start making the kernel crash :-) See also: <https://unix.stackexchange.com/questions/208260/how-to-scroll-up-after-a-kernel-panic>
|
||||||
|
|
||||||
If the system crashes, you can't can quit QEMU with `poweroff`, but you can use either:
|
If the system crashes, you can't can quit QEMU with `poweroff`, but you can use either:
|
||||||
|
|
||||||
@@ -205,7 +205,6 @@ ARM TODOs:
|
|||||||
- Ctrl + C kills the emulator, not sent to guest. See:
|
- Ctrl + C kills the emulator, not sent to guest. See:
|
||||||
- <https://github.com/cloudius-systems/osv/issues/49>
|
- <https://github.com/cloudius-systems/osv/issues/49>
|
||||||
- <https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu>
|
- <https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu>
|
||||||
- `fops.ko`, `printf a >fops` crashes with `BUG: recent printk recursion!`
|
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ static ssize_t fop_write(struct file *file, const char __user *buf, size_t len,
|
|||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
printk(KERN_INFO "write\n");
|
printk(KERN_INFO "write\n");
|
||||||
printk(KERN_INFO "buf = %.*s\n", (int)len, buf);
|
|
||||||
printk(KERN_INFO "len = %zu\n", len);
|
printk(KERN_INFO "len = %zu\n", len);
|
||||||
printk(KERN_INFO "off = %lld\n", (long long)*off);
|
printk(KERN_INFO "off = %lld\n", (long long)*off);
|
||||||
if (sizeof(data) <= *off) {
|
if (sizeof(data) <= *off) {
|
||||||
@@ -86,6 +85,7 @@ static ssize_t fop_write(struct file *file, const char __user *buf, size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printk(KERN_INFO "buf = %.*s\n", (int)len, data + *off);
|
||||||
printk(KERN_INFO "ret = %lld\n", (long long)ret);
|
printk(KERN_INFO "ret = %lld\n", (long long)ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user