Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
description of repo status
Open Source
>
Other
>
Operation System
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
458
Star
1.7K
Fork
1.9K
GVP
openEuler
/
kernel
Closed
Code
Issues
1271
Pull Requests
991
Wiki
Insights
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
NFSv4.2 挂载时,第二次使用 `O_ACCMODE` 标记打开文件时,执行 `lseek` 操作后发生空指针解引用
Done
#I5BZTX
Bug
陈孝松
Opened this issue
2022-06-13 14:35
<!-- #请根据issue的类型在标题右侧下拉框中选择对应的选项(需求、缺陷或CVE等)--> <!-- #请根据issue相关的版本在里程碑中选择对应的节点,若是与版本无关,请选择“不关联里程碑”--> 【标题描述】NFSv4.2 挂载时,第二次使用 `O_ACCMODE` 标记打开文件时,执行 `lseek` 操作后发生空指针解引用 【环境信息】 硬件信息:qemu 虚拟机 软件信息:涉及内核版本:OLK-5.10, openEuler-22.03-LTS,openEuler-1.0-LTS 【问题复现步骤】 通过以下步骤复现: ```shell 1. mount -t nfs -o vers=4.2 $server_ip:/ /mnt/ # NFSv4.2 挂载 2. fd = open("/mnt/file", O_ACCMODE|O_DIRECT|O_CREAT) # 第一次打开文件,如果不存在则创建 3. close(fd) 4. fd = open("/mnt/file", O_ACCMODE|O_DIRECT) # 第二次打开文件 5. lseek(fd) # 空指针解引用 ``` 出现概率(是否必现,概率性错误):必现 【预期结果】 正常打开文件,正常执行 lseek 【实际结果】 执行 lseek 后发生空指针解引用 【附件信息】 日志如下: ```shell [ 120.787545] BUG: kernel NULL pointer dereference, address: 0000000000000040 [ 120.788932] #PF: supervisor read access in kernel mode [ 120.789758] #PF: error_code(0x0000) - not-present page [ 120.790655] PGD 103908067 P4D 103908067 PUD 10398c067 PMD 0 [ 120.791571] Oops: 0000 [#1] PREEMPT SMP [ 120.792233] CPU: 3 PID: 639 Comm: rep Not tainted 5.17.0-12888-g77c9387c0c5b #16 [ 120.793436] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 [ 120.795377] RIP: 0010:nfs4_select_rw_stateid+0x5/0x280 [ 120.796229] Code: 49 10 89 4f 10 8b 4e 4c 39 d1 75 0a 48 83 05 e1 4b e5 0b 01 c9 c3 48 83 05 cf 4b e5 0b 01 eb 9a 0f 1f 44 00 00 0f 1f 44 00 00 <48> 8b 47 40 f6 c4 02 0f 85 52 02 00 00 55 48 89 e5 41 57 4d 89 c7 [ 120.799197] RSP: 0018:ffffc90000e67d90 EFLAGS: 00010246 [ 120.799976] RAX: ffff88810395a800 RBX: ffff8881085a01a0 RCX: ffffc90000e67e18 [ 120.801293] RDX: ffff888107020f40 RSI: 0000000000000001 RDI: 0000000000000000 [ 120.802333] RBP: ffffc90000e67e78 R08: 0000000000000000 R09: ffffc90000e67e18 [ 120.803378] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888108018300 [ 120.804419] R13: ffff88810395a000 R14: ffffc90000e67e00 R15: ffffc90000e67dd0 [ 120.805476] FS: 00007fd495e0b440(0000) GS:ffff88813bcc0000(0000) knlGS:0000000000000000 [ 120.806691] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 120.807544] CR2: 0000000000000040 CR3: 000000010cd0e000 CR4: 00000000000006e0 [ 120.808600] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 120.809673] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 120.810733] Call Trace: [ 120.811187] <TASK> [ 120.811555] nfs4_set_rw_stateid+0x24/0x30 [ 120.812203] _nfs42_proc_llseek+0xd2/0x320 [ 120.812889] ? nfs_get_lock_context+0x80/0x280 [ 120.813566] ? kmem_cache_alloc_trace+0x60/0x880 [ 120.814282] nfs42_proc_llseek+0xe8/0x160 [ 120.814901] nfs4_file_llseek+0x4c/0x70 [ 120.815476] ksys_lseek+0x9c/0x120 [ 120.816005] __x64_sys_lseek+0x1e/0x30 [ 120.816597] do_syscall_64+0x35/0x80 [ 120.817203] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 120.817966] RIP: 0033:0x7fd49570b4e9 [ 120.818523] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 6f 39 2c 00 f7 d8 64 89 01 48 [ 120.821326] RSP: 002b:00007fffdb620f28 EFLAGS: 00000213 ORIG_RAX: 0000000000000008 [ 120.822443] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd49570b4e9 [ 120.823498] RDX: 0000000000000004 RSI: 0000000000000009 RDI: 0000000000000003 [ 120.824544] RBP: 00007fffdb620f40 R08: 0000000000000000 R09: 00007fffdb621020 [ 120.825632] R10: 0000000000000000 R11: 0000000000000213 R12: 00000000004004a0 [ 120.826678] R13: 00007fffdb621020 R14: 0000000000000000 R15: 0000000000000000 [ 120.827727] </TASK> [ 120.828060] Modules linked in: [ 120.828542] CR2: 0000000000000040 [ 120.829100] ---[ end trace 0000000000000000 ]--- [ 120.829811] RIP: 0010:nfs4_select_rw_stateid+0x5/0x280 [ 120.830618] Code: 49 10 89 4f 10 8b 4e 4c 39 d1 75 0a 48 83 05 e1 4b e5 0b 01 c9 c3 48 83 05 cf 4b e5 0b 01 eb 9a 0f 1f 44 00 00 0f 1f 44 00 00 <48> 8b 47 40 f6 c4 02 0f 85 52 02 00 00 55 48 89 e5 41 57 4d 89 c7 [ 120.833401] RSP: 0018:ffffc90000e67d90 EFLAGS: 00010246 [ 120.834212] RAX: ffff88810395a800 RBX: ffff8881085a01a0 RCX: ffffc90000e67e18 [ 120.835286] RDX: ffff888107020f40 RSI: 0000000000000001 RDI: 0000000000000000 [ 120.836398] RBP: ffffc90000e67e78 R08: 0000000000000000 R09: ffffc90000e67e18 [ 120.837500] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888108018300 [ 120.838569] R13: ffff88810395a000 R14: ffffc90000e67e00 R15: ffffc90000e67dd0 [ 120.839640] FS: 00007fd495e0b440(0000) GS:ffff88813bcc0000(0000) knlGS:0000000000000000 [ 120.840852] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 120.841724] CR2: 0000000000000040 CR3: 000000010cd0e000 CR4: 00000000000006e0 [ 120.842783] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 120.843850] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ```
<!-- #请根据issue的类型在标题右侧下拉框中选择对应的选项(需求、缺陷或CVE等)--> <!-- #请根据issue相关的版本在里程碑中选择对应的节点,若是与版本无关,请选择“不关联里程碑”--> 【标题描述】NFSv4.2 挂载时,第二次使用 `O_ACCMODE` 标记打开文件时,执行 `lseek` 操作后发生空指针解引用 【环境信息】 硬件信息:qemu 虚拟机 软件信息:涉及内核版本:OLK-5.10, openEuler-22.03-LTS,openEuler-1.0-LTS 【问题复现步骤】 通过以下步骤复现: ```shell 1. mount -t nfs -o vers=4.2 $server_ip:/ /mnt/ # NFSv4.2 挂载 2. fd = open("/mnt/file", O_ACCMODE|O_DIRECT|O_CREAT) # 第一次打开文件,如果不存在则创建 3. close(fd) 4. fd = open("/mnt/file", O_ACCMODE|O_DIRECT) # 第二次打开文件 5. lseek(fd) # 空指针解引用 ``` 出现概率(是否必现,概率性错误):必现 【预期结果】 正常打开文件,正常执行 lseek 【实际结果】 执行 lseek 后发生空指针解引用 【附件信息】 日志如下: ```shell [ 120.787545] BUG: kernel NULL pointer dereference, address: 0000000000000040 [ 120.788932] #PF: supervisor read access in kernel mode [ 120.789758] #PF: error_code(0x0000) - not-present page [ 120.790655] PGD 103908067 P4D 103908067 PUD 10398c067 PMD 0 [ 120.791571] Oops: 0000 [#1] PREEMPT SMP [ 120.792233] CPU: 3 PID: 639 Comm: rep Not tainted 5.17.0-12888-g77c9387c0c5b #16 [ 120.793436] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 [ 120.795377] RIP: 0010:nfs4_select_rw_stateid+0x5/0x280 [ 120.796229] Code: 49 10 89 4f 10 8b 4e 4c 39 d1 75 0a 48 83 05 e1 4b e5 0b 01 c9 c3 48 83 05 cf 4b e5 0b 01 eb 9a 0f 1f 44 00 00 0f 1f 44 00 00 <48> 8b 47 40 f6 c4 02 0f 85 52 02 00 00 55 48 89 e5 41 57 4d 89 c7 [ 120.799197] RSP: 0018:ffffc90000e67d90 EFLAGS: 00010246 [ 120.799976] RAX: ffff88810395a800 RBX: ffff8881085a01a0 RCX: ffffc90000e67e18 [ 120.801293] RDX: ffff888107020f40 RSI: 0000000000000001 RDI: 0000000000000000 [ 120.802333] RBP: ffffc90000e67e78 R08: 0000000000000000 R09: ffffc90000e67e18 [ 120.803378] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888108018300 [ 120.804419] R13: ffff88810395a000 R14: ffffc90000e67e00 R15: ffffc90000e67dd0 [ 120.805476] FS: 00007fd495e0b440(0000) GS:ffff88813bcc0000(0000) knlGS:0000000000000000 [ 120.806691] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 120.807544] CR2: 0000000000000040 CR3: 000000010cd0e000 CR4: 00000000000006e0 [ 120.808600] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 120.809673] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 120.810733] Call Trace: [ 120.811187] <TASK> [ 120.811555] nfs4_set_rw_stateid+0x24/0x30 [ 120.812203] _nfs42_proc_llseek+0xd2/0x320 [ 120.812889] ? nfs_get_lock_context+0x80/0x280 [ 120.813566] ? kmem_cache_alloc_trace+0x60/0x880 [ 120.814282] nfs42_proc_llseek+0xe8/0x160 [ 120.814901] nfs4_file_llseek+0x4c/0x70 [ 120.815476] ksys_lseek+0x9c/0x120 [ 120.816005] __x64_sys_lseek+0x1e/0x30 [ 120.816597] do_syscall_64+0x35/0x80 [ 120.817203] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 120.817966] RIP: 0033:0x7fd49570b4e9 [ 120.818523] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 6f 39 2c 00 f7 d8 64 89 01 48 [ 120.821326] RSP: 002b:00007fffdb620f28 EFLAGS: 00000213 ORIG_RAX: 0000000000000008 [ 120.822443] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd49570b4e9 [ 120.823498] RDX: 0000000000000004 RSI: 0000000000000009 RDI: 0000000000000003 [ 120.824544] RBP: 00007fffdb620f40 R08: 0000000000000000 R09: 00007fffdb621020 [ 120.825632] R10: 0000000000000000 R11: 0000000000000213 R12: 00000000004004a0 [ 120.826678] R13: 00007fffdb621020 R14: 0000000000000000 R15: 0000000000000000 [ 120.827727] </TASK> [ 120.828060] Modules linked in: [ 120.828542] CR2: 0000000000000040 [ 120.829100] ---[ end trace 0000000000000000 ]--- [ 120.829811] RIP: 0010:nfs4_select_rw_stateid+0x5/0x280 [ 120.830618] Code: 49 10 89 4f 10 8b 4e 4c 39 d1 75 0a 48 83 05 e1 4b e5 0b 01 c9 c3 48 83 05 cf 4b e5 0b 01 eb 9a 0f 1f 44 00 00 0f 1f 44 00 00 <48> 8b 47 40 f6 c4 02 0f 85 52 02 00 00 55 48 89 e5 41 57 4d 89 c7 [ 120.833401] RSP: 0018:ffffc90000e67d90 EFLAGS: 00010246 [ 120.834212] RAX: ffff88810395a800 RBX: ffff8881085a01a0 RCX: ffffc90000e67e18 [ 120.835286] RDX: ffff888107020f40 RSI: 0000000000000001 RDI: 0000000000000000 [ 120.836398] RBP: ffffc90000e67e78 R08: 0000000000000000 R09: ffffc90000e67e18 [ 120.837500] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888108018300 [ 120.838569] R13: ffff88810395a000 R14: ffffc90000e67e00 R15: ffffc90000e67dd0 [ 120.839640] FS: 00007fd495e0b440(0000) GS:ffff88813bcc0000(0000) knlGS:0000000000000000 [ 120.840852] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 120.841724] CR2: 0000000000000040 CR3: 000000010cd0e000 CR4: 00000000000006e0 [ 120.842783] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 120.843850] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ```
Comments (
2
)
Sign in
to comment
Status
Done
Backlog
已挂起
Fixing
Confirmed
Done
Accepted
Canceled
Assignees
Not set
Labels
sig/Kernel
Not set
Projects
Unprojected
Unprojected
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(2)
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register