Messages in this thread | | | Date | Tue, 29 Jun 1999 12:49:42 -0500 | From | Christopher Boyd <> | Subject | [BUG] current->mm NULL in SMP version of 2.2.x |
| |
Hi,
This is my first time posting to the list, so please excuse any silly errors I make.
I believe I have discovered a bug in the 2.2.x series of kernels, when SMP support is compiled in. I have tested this with 2.2.0 (patched with the RT linux patches), 2.2.5 (standard) and 2.2.9 (standard), with both SMP enabled and SMP disabled. I have not been able to track down this bug, but have been working on it. Maybe current->mm is getting NULL'd somewhere in the load and execute thread ... it seems to be fine throughout do_execve, meaning it is not NULL. Is it getting messed up in the demand loading page fault? I don't have enough knowledge to debug this. Oh, BTW, this problem doesn't occur in 2.0.37 when compiled with SMP support.
My tests were as follows: I create a module that registers itself as a character device. From within the write procedure, I write current->mm out using printk. On non-SMP kernels, this is a nonzero value and on SMP 2.2.x kernels, I get a 'um_write: current->mm = 0x00000000'.
BTW, I also just printed the value of current->mm from within 'init_module', and the open operations. Still NULL on an SMP machine.
Thanks in advance for any help with this or advice. I wouldn't mind looking for this, if I knew where to look for it, so any hints would be nice too. The main parts of the test code follow.
Regards, Christopher Boyd
-------8<--------8<---[ usermap.c ]--8<-------8<-------------
/* some irrelevant code removed for brevity */
#define USERMAP_MAJOR 31
static char *usermap_name = "usermap";
struct file_operations fops = { open: um_open, release: um_release, read: um_read, write: um_write, ioctl: um_ioctl, mmap: um_mmap, };
int init_module() { if ( register_chrdev(USERMAP_MAJOR, usermap_name, &fops) ) { printk("usermap: cannot register character device on major 31\n"); return -ENODEV; }
return 0; }
void cleanup_module() { unregister_chrdev(USERMAP_MAJOR, usermap_name); }
ssize_t um_write(struct file *filp, const char *buffer, size_t len, loff_t *off) { printk("um_write: enter\n"); printk("um_write: buffer is at 0x%8.8X\n", buffer); printk("um_write: len is '%i' bytes\n", len); printk("um_write: current is 0x%8.8X\n", current); printk("um_write: current->mm = 0x%8.8X\n", current->mm); printk("um_write: caller pid = %i\n", current->pid); return len; }
-------8<--------8<---[ umwrite.c ]---8<-------8<-------------
/* some irrelevant code removed for brevity */
int main(int argc, char **argv) { int fd; char buffer[1024]; int retval;
printf("umwrite: start\n\n");
/* /dev/usermap created via mknod /dev/usermap c 31 0 */ printf("umwrite: about to open /dev/usermap\n"); fd = open("/dev/usermap", O_RDWR); if (fd < 0) { printf("umwrite: error %i when opening /dev/usermap\n", -fd); return -fd; } printf("umwrite: /dev/usermap is now open\n");
printf("umwrite: about to call write\n"); retval = write(fd, buffer, 1024); printf("umwrite: write returns '%i'\n", retval);
printf("umwrite: about to close /dev/usermap\n"); close(fd); printf("umwrite: /dev/usermap is now closed\n");
return 0; }
------------- [ END of code ] -----------------------
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |