Skip to contentSkip to conversation

do_mmap_fake question

Linux-ia64 Manfred Spraul 2 participants 2 messages Jul 9, 2000 – Jul 10, 2000

lore
Share & tools
lore
#0 lore raw

do_mmap_fake seems to be buggy:

You use simple memset/memcpy to initialize user memory. AFAICS this can oops on SMP: one thread calls do_mmap_fake, and a second thread calls sys_munmap() for that memory range. memset/memcpy will fail, and you don't have an exception handler installed.

Btw, why do you use llseek?
Is there a hidden problem with read(,,,&off)?

- llseek(,,off);
- r = file->f_op->read(file,(char*)addr, len, &file->f_pos);
+ r = file->f_op->read(file,(char*)addr, len, &off);

--
Manfred

#1 lore raw

Manfred-

Thanks for looking over the code but I don't think there is a problem. do_mmap_fake' is only called from sys32_mmap' which grabs the semaphore current->mm->mmap_sem' (it also grabs the kernel lock but we won't go into that). Any other thread trying to unmap memmory will block until do_mmap_fake' completes.

The call to `llseek' is a hold over from my application programming days, I'll change that in the next release.

Tnx.

Quoted 23 lines · Manfred Spraul

do_mmap_fake seems to be buggy:

You use simple memset/memcpy to initialize user memory. AFAICS this can oops on SMP: one thread calls do_mmap_fake, and a second thread calls sys_munmap() for that memory range. memset/memcpy will fail, and you don't have an exception handler installed.

Btw, why do you use llseek?
Is there a hidden problem with read(,,,&off)?

- llseek(,,off);
- r = file->f_op->read(file,(char*)addr, len, &file->f_pos);
+ r = file->f_op->read(file,(char*)addr, len, &off);

--
Manfred

_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64

Signature · 4 lines
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
[email protected]
Ph: 303/938-9838