I make a kernel module. In the module, I redirect write system call. Before the data write to the file, I need to handle the data. In my write system call's function, what I do like this: 1. allocate the memory 2. copy the data from userspace 3. handle the data 4. call the original write system call's function to write the handled data to the file ................... enc_data = (char *)kmem_alloc(enc_size, KM_SLEEP); if(!enc_data){ error = ENOMEM; goto out; } memset(enc_data,0,enc_size); //copy data from user if(copyin(cbuf, enc_data, enc_size)){ //free memory kmem_free(enc_data, enc_size); error = EFAULT; goto out; }
encrypt_data(enc_data, enc_size); retsize = orig_write(fdes, enc_data, count); ............................. But there allways have the EFAULT(Bad address) error. Would you tell me how to do?Thank you very much! This message posted from opensolaris.org _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org