Re: Interrupt and spin_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm really sorry, but just when all seems to work well, the problem 
re-occurred.

LIST_HEAD(vm_write_protected);

static struct mtpmc_wrprotected_pages *mk_page(unsigned long 
addr)
{
    struct mtpmc_wrprotected_pages *wr_page;

    wr_page = (...) kmalloc(.......);

    wr_page->address = addr;
    return wr_page;
}

struct mtpmc_vm_wrprotected *mk_vm(struct vm_area_struct 
*vm)
{
    struct mtpmc_vm_wrprotected *wr_vma;

    wr_vma = (...) kmalloc(...........);
    INIT_LIST_HEAD(&wr_vma->pages_list);

    return wr_vma;
}

void mtpmc_set_mm_not_writable(struct mm_struct *mm)
{
    struct mtpmc_vm_wrprotected *vma;
    struct mtpmc_wrprotected_pages *page;
    struct vm_area_struct *vm;
    unsigned long addr;
    pte_t *pte;

    down_write(&mm->mmap_sem);

    for(vm = mm->mmap; vm != NULL; vm = vm->vm_next){
        vma = mk_vm(vm);
        for (addr = vm->vm_start; addr<vm->vm_end; addr+=PAGE_SIZE){
                    page = mk_page(addr);
                    list_add_tail(&page->list, &vma->pages_list);
        }

        list_add_tail(&vma->list, &vm_write_protected);
        vma->vm_start = vm->vm_start;
        vma->vm_end = vma->vm_end; /* THE PROLEM IS HERE - I'LL DESCRIBE IT 
                                                          BELOW */
    }

    up_write(&mm->mmap_sem);
 
    return;
} 

See the line indicated above where I execute "vma->vm_end = vma->vm_end;".
In this line there's an error. It should be "vma->vm_end = vm->vm_end;".
So I've changed vma in vm. The result is that the system crashes with the NULL 
exception I've described in previous emails.
I'm sorry if I'm posting many times this problem but when all seems go well 
some problem occurs.
Now, I've posted all interesting code, by simplifying it. 
I initialize all values of pages and vma before inserting them into the 
appropriate lists.
I'm using spin_lock_irqsave/spin_unlock_irqrestore while I'm creating the 
lists and spinlock/spin_unlock when I scan the lists from within the page 
fault handler.
I hope you've the patience to reply to this mail.
Thanks.
Vincenzo Mallozzi.

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux