NetBSD-Bugs archive

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

port-amd64/38708: lkm_map issues on amd64



>Number:         38708
>Category:       port-amd64
>Synopsis:       lkm_map issues on amd64
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 20 21:55:00 +0000 2008
>Originator:     Jared D. McNeill
>Release:        NetBSD 4.99.63
>Organization:
        
>Environment:
        
        
System: NetBSD black.invisible.ca 4.99.63 NetBSD 4.99.63 (GENERIC) #11: Tue May 
20 10:01:44 EDT 2008 
jmcneill%black.invisible.ca@localhost:/export/home/jmcneill/scratch/obj/sys/arch/amd64/compile/GENERIC
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        Code running from a kernel module on amd64 is flaky. Furthermore, if
        ~1MB is allocated from lkm_map, the vga console is corrupted and
        the next invocation of 'modstat' causes a panic.
>How-To-Repeat:
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>

#include <uvm/uvm.h>

MODULE(MODULE_CLASS_MISC, killah, NULL);

static vaddr_t killah_ptr = (vaddr_t)NULL;
extern struct vm_map *lkm_map;

static int
killah_modcmd(modcmd_t cmd, void *arg)
{
        switch (cmd) {
        case MODULE_CMD_INIT:
                printf("killah kmod: going to allocate 1MB from lkm_map...\n");
                killah_ptr = uvm_km_alloc(lkm_map, 1024*1024, 0,
                    UVM_KMF_WIRED | UVM_KMF_EXEC);
                printf("killah kmod: ptr is %p\n", (void *)killah_ptr);
                break;

        case MODULE_CMD_FINI:
                if (killah_ptr) {
                        printf("killah kmod: freeing %p\n", (void *)killah_ptr);
                        uvm_km_free(lkm_map, killah_ptr, 1024*1024,
                            UVM_KMF_WIRED);
                }
                printf("killah kmod: unloaded\n");
                break;

        default:
                return ENOTTY;
        }

        return 0;
}
>Fix:
        

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index