免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2151 | 回复: 3
打印 上一主题 下一主题

驱动打开文件读取文件出现如下错误! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-30 01:13 |只看该作者 |倒序浏览
Dec 30 01:04:56 test-virtual-machine kernel: [  419.706977] Call Trace:
Dec 30 01:04:56 test-virtual-machine kernel: [  419.706992]  [<ffffffff813133dc>] apparmor_file_alloc_security+0x2c/0x60
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707008]  [<ffffffff812da046>] security_file_alloc+0x16/0x20
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707023]  [<ffffffff8119cd28>] get_empty_filp+0x88/0x180
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707033]  [<ffffffff811aa168>] path_openat+0x48/0x4d0
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707042]  [<ffffffff811aaff2>] do_filp_open+0x42/0xa0
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707052]  [<ffffffff816f3a8e>] ? _raw_spin_lock+0xe/0x20
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707059]  [<ffffffff811b8c75>] ? __alloc_fd+0xe5/0x170
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707067]  [<ffffffff8119ac1a>] do_sys_open+0xfa/0x250
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707075]  [<ffffffff8119a2b0>] ? sys_faccessat+0x1f0/0x220
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707082]  [<ffffffff8119ad91>] sys_open+0x21/0x30
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707090]  [<ffffffff816fc8dd>] system_call_fastpath+0x1a/0x1f
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707093] Code: 00 4d 8b 04 24 65 4c 03 04 25 08 dc 00 00 49 8b 50 08 4d 8b 28 4d 85 ed 0f 84 cf 00 00 00 49 63 44 24 20 49 8b 3c 24 48 8d 4a 01 <49> 8b 5c 05 00 4c 89 e8 65 48 0f c7 0f 0f 94 c0 84 c0 74 c2 49
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707154] RIP  [<ffffffff811850ff>] kmem_cache_alloc_trace+0x5f/0x140
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707161]  RSP <ffff88000b865cd8>
Dec 30 01:04:56 test-virtual-machine kernel: [  419.707173] ---[ end trace 60d56133fa2bcb94
这个是什么错误?

论坛徽章:
0
2 [报告]
发表于 2013-12-31 09:48 |只看该作者
我以前写的内核写文件代码片段,你看看吧!读的话用filp->f_op->read()。
在x86 linux-2.6.18
arm920t linux-3.2.36运行过
static char data_write[10] =
{
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9
};

static void filewrite(char* filename)
{
    struct file *filp;
    mm_segment_t fs;
    u32 index = 0;

    filp = filp_open(filename, O_RDWR| O_APPEND| O_CREAT, 0644);
    if (IS_ERR(filp))
    {
        printk("open error...\n");
        return;
    }
    fs=get_fs();

    set_fs(KERNEL_DS);

    for (index = 0; index < 10; index++)
    {
        memset(data_write, index, 10);
        filp->f_op->write(filp, data_write, sizeof(data_write),&filp->f_pos);
    }

    set_fs(fs);

    filp_close(filp,NULL);
}

论坛徽章:
0
3 [报告]
发表于 2013-12-31 11:35 |只看该作者
我的跟你这个差不多的!在centos系统上面运行上面没有问题。但是在ubuntu上面会出现上面说的错误!

论坛徽章:
2
酉鸡
日期:2013-09-26 11:11:15摩羯座
日期:2014-01-08 13:45:19
4 [报告]
发表于 2014-01-02 15:18 |只看该作者
apparmor 是一个类似selinux的东西,在ubuntu上独有,把它禁止看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP