1. 内核二分缺陷_缺陷跟踪

1.1 二分缺陷

# 利用git log 查看提交的历史记录
root@mouse:~/linux# git log --oneline
56e337f2cf13 (HEAD -> test, origin/master, origin/HEAD, master_base, master) Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"
6665ca15746d Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
09688c0166e7 (tag: v5.17-rc8) Linux 5.17-rc8
f0e18b03fcaf Merge tag 'x86_urgent_for_v5.17_rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
aad611a868d1 Merge tag 'perf-tools-fixes-for-v5.17-2022-03-12' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
1518a4f636b3 Merge tag 'drm-fixes-2022-03-12' of git://anongit.freedesktop.org/drm/drm
91c9923a473a perf parse: Fix event parser error for hybrid systems
073a15c3512f perf bench: Fix NULL check against wrong variable
a7a72631f624 perf parse-events: Fix NULL check against wrong variable
ec9d50ace399 tools headers cpufeatures: Sync with the kernel sources
#  git bisect start [终点] [起点]
root@mouse:~/linux# git bisect  start  56e337f2cf13 6c7cb60bff7a
Bisecting: 12 revisions left to test after this (roughly 4 steps)
[91c9923a473a694eb1c5c01ab778a77114969707] perf parse: Fix event parser error for hybrid systems
# 利用git log 再次查看 可以看见第一条变为91c9923a473a
root@mouse:~/linux# git log --oneline
91c9923a473a (HEAD) perf parse: Fix event parser error for hybrid systems
073a15c3512f perf bench: Fix NULL check against wrong variable
a7a72631f624 perf parse-events: Fix NULL check against wrong variable
ec9d50ace399 tools headers cpufeatures: Sync with the kernel sources
3ec94eeaff9a tools kvm headers arm64: Update KVM headers from the kernel sources
68453767131a ARM: Spectre-BHB: provide empty stub for non-config
77fe1ba90241 Merge tag 'riscv-for-linus-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
878409ecde7c Merge tag 'powerpc-5.17-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
6c7cb60bff7a (refs/bisect/good-6c7cb60bff7aec24b834343ff433125f469886a3) ARM: fix Thumb2 regression with Spectre BHB
3977a3fb6770 Merge tag 'mmc-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
93ce93587d36 Merge branch 'davidh' (fixes from David Howells)
413a4a6b0b55 cachefiles: Fix volume coherency attribute
173ce1ca47c4 afs: Fix potential thrashing in afs writeback
4edc0760412b watch_queue: Make comment about setting ->defunct more accurate
2ed147f015af watch_queue: Fix lack of barrier/sync/lock between post and read
7ea1a0124b6d watch_queue: Free the alloc bitmap when the watch_queue is torn down
3b4c0371928c watch_queue: Fix the alloc bitmap size to reflect notes allocated
a66bd7575b5f watch_queue: Use the bitmap API when applicable
96a4d8912b28 watch_queue: Fix to always request a pow-of-2 pipe ring size
c1853fbadcba watch_queue: Fix to release page in ->release()
db8facfc9faf watch_queue, pipe: Free watchqueue state after clearing pipe ring
c993ee0f9f81 watch_queue: Fix filter limit check
# git bisect  bad   该历史钱是不工作的
root@mouse:~/linux# git bisect  bad
Bisecting: 5 revisions left to test after this (roughly 3 steps)
[77fe1ba90241c2af6f14d53988bf0cd6b9586699] Merge tag 'riscv-for-linus-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux# 利用git log 再次查看 可以看见第一条变为77fe1ba90241  可以看出是往后面二分查找的
root@mouse:~/linux# git log --oneline
77fe1ba90241 (HEAD) Merge tag 'riscv-for-linus-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
878409ecde7c Merge tag 'powerpc-5.17-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
6c7cb60bff7a (refs/bisect/good-6c7cb60bff7aec24b834343ff433125f469886a3) ARM: fix Thumb2 regression with Spectre BHB
3977a3fb6770 Merge tag 'mmc-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
93ce93587d36 Merge branch 'davidh' (fixes from David Howells)
413a4a6b0b55 cachefiles: Fix volume coherency attribute
173ce1ca47c4 afs: Fix potential thrashing in afs writeback
4edc0760412b watch_queue: Make comment about setting ->defunct more accurate
2ed147f015af watch_queue: Fix lack of barrier/sync/lock between post and read
7ea1a0124b6d watch_queue: Free the alloc bitmap when the watch_queue is torn down
3b4c0371928c watch_queue: Fix the alloc bitmap size to reflect notes allocated
a66bd7575b5f watch_queue: Use the bitmap API when applicable
96a4d8912b28 watch_queue: Fix to always request a pow-of-2 pipe ring size
c1853fbadcba watch_queue: Fix to release page in ->release()
db8facfc9faf watch_queue, pipe: Free watchqueue state after clearing pipe ring
c993ee0f9f81 watch_queue: Fix filter limit check
79b00034e9dc Merge tag 'drm-fixes-2022-03-11' of git://anongit.freedesktop.org/d# git bisect  good  说明是正常的往前面找
root@mouse:~/linux# git bisect  good
Bisecting: 2 revisions left to test after this (roughly 2 steps)
[ec9d50ace39925f7fd0302bf0fad640e2c9826ea] tools headers cpufeatures: Sync with the kernel sources# 利用git log 再次查看 可以看见第一条变为 ec9d50ace399 这样就完成了二分缺陷的查找
root@mouse:~/linux# git log --oneline
ec9d50ace399 (HEAD) tools headers cpufeatures: Sync with the kernel sources
3ec94eeaff9a tools kvm headers arm64: Update KVM headers from the kernel sources
68453767131a ARM: Spectre-BHB: provide empty stub for non-config
77fe1ba90241 (refs/bisect/good-77fe1ba90241c2af6f14d53988bf0cd6b9586699) Merge tag 'riscv-for-linus-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
878409ecde7c Merge tag 'powerpc-5.17-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
6c7cb60bff7a (refs/bisect/good-6c7cb60bff7aec24b834343ff433125f469886a3) ARM: fix Thumb2 regression with Spectre BHB
3977a3fb6770 Merge tag 'mmc-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
93ce93587d36 Merge branch 'davidh' (fixes from David Howells)
413a4a6b0b55 cachefiles: Fix volume coherency attribute
173ce1ca47c4 afs: Fix potential thrashing in afs writeback
4edc0760412b watch_queue: Make comment about setting ->defunct more accurate
2ed147f015af watch_queue: Fix lack of barrier/sync/lock between post and read
7ea1a0124b6d watch_queue: Free the alloc bitmap when the watch_queue is torn down
3b4c0371928c watch_queue: Fix the alloc bitmap size to reflect notes allocated
a66bd7575b5f watch_queue: Use the bitmap API when applicable
96a4d8912b28 watch_queue: Fix to always request a pow-of-2 pipe ring size
c1853fbadcba watch_queue: Fix to release page in ->release()
db8facfc9faf watch_queue, pipe: Free watchqueue state after clearing pipe ring
c993ee0f9f81 watch_queue: Fix filter limit check
79b00034e9dc Merge tag 'drm-fixes-2022-03-11' of git://anongit.freedesktop.org/drm/drm

1.2 缺陷跟踪

#   dmesg 打印内核信息 root@mouse:~/linux# dmesg
[    0.000000] Linux version 5.4.0-92-generic (buildd@lgw01-amd64-016) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #103-Ubuntu SMP Fri Nov 26 16:13:00 UTC 2021 (Ubuntu 5.4.0-92.103-generic 5.4.157)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-92-generic root=UUID=3d5af7aa-dd5c-4ed3-b38a-e74236d4d773 ro vga=792 console=tty0 console=ttyS0,115200n8 net.ifnames=0 noibrs nvme_core.io_timeout=4294967295 nvme_core.admin_timeout=4294967295 quiet# 根据终端故障  利用gdb调试  假设终端输出故障   EIP is at vt_ioctl+0xda8/0x1482
root@mouse:~/x86linux/hx86/linux-5.8.6# gdb vmlinux
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vmlinux...
(gdb)  l *vt_ioctl+0xda8
0xffffffff814f36d8 is in vt_ioctl (drivers/tty/vt/vt_ioctl.c:401).
396                      * If the time is zero, turn off sound ourselves.
397                      */
398                     ticks = msecs_to_jiffies((arg >> 16) & 0xffff);
399                     count = ticks ? (arg & 0xffff) : 0;
400                     if (count)
401                             count = PIT_TICK_RATE / count;
402                     kd_mksound(count, ticks);
403                     break;
404             }
405# 可以查看.o文件内容
root@mouse:~/x86linux/hx86/linux-5.8.6# gdb drivers/tty/vt/vt_ioctl.o
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from drivers/tty/vt/vt_ioctl.o...
(gdb)  l *vt_ioctl+0xda8
0x1338 is in vt_ioctl (drivers/tty/vt/vt_ioctl.c:401).
396                      * If the time is zero, turn off sound ourselves.
397                      */
398                     ticks = msecs_to_jiffies((arg >> 16) & 0xffff);
399                     count = ticks ? (arg & 0xffff) : 0;
400                     if (count)
401                             count = PIT_TICK_RATE / count;
402                     kd_mksound(count, ticks);
403                     break;
404             }
405
# 也可以查看ko文件内容
root@mouse:~/x86linux/hx86/linux-5.8.6# gdb ./net/ipv4/netfilter/iptable_nat.ko
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./net/ipv4/netfilter/iptable_nat.ko...
(gdb) b
Display all 200 possibilities? (y or n)
(gdb) l
1       #include <linux/module.h>
2       #define INCLUDE_VERMAGIC
3       #include <linux/build-salt.h>
4       #include <linux/vermagic.h>
5       #include <linux/compiler.h>
6
7       BUILD_SALT;
8
9       MODULE_INFO(vermagic, VERMAGIC_STRING);
10      MODULE_INFO(name, KBUILD_MODNAME);
(gdb)# 对.ko文件执行反汇编
objdump -r -S -l --disassemble net/dccp/ipv4.o
root@mouse:~/x86linux/hx86/linux-5.8.6# objdump -r -S -l --disassemble ./net/ipv4/netfilter/nf_log_arp.ko./net/ipv4/netfilter/nf_log_arp.ko:     file format elf64-x86-64Disassembly of section .text:0000000000000000 <nf_log_arp_net_exit>:
nf_log_arp_net_exit():
/root/x86linux/hx86/linux-5.8.6/net/ipv4/netfilter/nf_log_arp.c:116return nf_log_set(net, NFPROTO_ARP, &nf_arp_logger);
}static void __net_exit nf_log_arp_net_exit(struct net *net)-r, --reloc              Display the relocation entries in the file
-S, --source             Intermix source code with disassembly
-d, --disassemble        Display assembler contents of executable sections
-l, --line-numbers             Include line numbers and filenames in output# 上报故障 报告给用于开发相关代码的邮件列表(linux-media
ML)
root@mouse:~/x86linux/hx86/linux-5.8.6# ./scripts/get_maintainer.pl -f net/ipv4/netfilter/nf_log_arp.c
Pablo Neira Ayuso <pablo@netfilter.org> (maintainer:NETFILTER)
Jozsef Kadlecsik <kadlec@netfilter.org> (maintainer:NETFILTER)
Florian Westphal <fw@strlen.de> (maintainer:NETFILTER)
"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [IPv4/IPv6])
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> (maintainer:NETWORKING [IPv4/IPv6])
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> (maintainer:NETWORKING [IPv4/IPv6])
Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL])
netfilter-devel@vger.kernel.org (open list:NETFILTER)
coreteam@netfilter.org (open list:NETFILTER)
netdev@vger.kernel.org (open list:NETWORKING [IPv4/IPv6])
linux-kernel@vger.kernel.org (open list)


调试.o文件、ko文件以及反汇编,针对某个故障进行分析。

更多详细得解读可以参考 2.1 技术参考

2. 总结

  • 利用git bisect进行源码缺陷定位
  • 利用gdb、objdump 修复源码
  • 利用./scripts/get_maintainer.pl -f [修复文件]    获取邮件列表并上报缺陷


    进入linux大门可以看哈这个视屏:https://ke.qq.com/course/417774?flowToken=1042383
    学习还是得靠自己。❤️

2.1 技术参考

参考链接1:http://www.ruanyifeng.com/blog/2018/12/git-bisect.html
参考链接2:https://www.kernel.org/doc/html/latest/translations/zh_CN/admin-guide/bug-hunting.html

内核二分缺陷_缺陷跟踪相关推荐

  1. 软件测试怎么跟踪缺陷,软件测试缺陷跟踪管理

    缺陷跟踪管理是工作的一个重要部分,的目的是为了尽早发现软件系统中的缺陷,因此,对缺陷进行跟踪管理,确保每个被发现的缺陷都能够及时得到处理是测试工作的一项重要内容. 1.缺陷跟踪管理的目标 软件缺陷能够 ...

  2. 软件测试--缺陷和缺陷报告

    缺陷的基本概述 定义:软件未实现产品说明书要求的功能 软件出现了产品说明书指明不应该出现的功能 软件实现了产品说明书未提及的功能 软件未实现产品说明书虽未说明单应该实现的目标 软件难以理解.不易使用. ...

  3. 软件测试 通用技术04 缺陷基本概述 缺陷的生命周期 缺陷的识别 缺陷报告 缺陷报告模板 测试需求、测试用例、缺陷报告的关系

    1 缺陷基本概述 1.1 缺陷的定义(重要!) 软件未实现产品说明书要求的功能: 软件出现了产品说明书指明不应该出现的功能: 软件实现了产品说明书未提到的功能: 软件未实现产品说明书虽未明确提及但应该 ...

  4. 软件测试——缺陷(缺陷的基本概、缺陷的生命周期、缺陷的识别)

    缺陷 一.缺陷的基本概述 1.缺陷的定义 软件未实现产品说明书要求的功能 软件出现了产品说明书指明不应该出现的功能 软件实现了产品说明书未提到的功能 软件未实现产品说明书虽未明确提及但应该实现的目标 ...

  5. 软件测试梳理 第九节 缺陷和缺陷报告

    缺陷的基本概述 缺陷的定义 软件未实现产品说明书要求的功能 软件出现了产品说明书指明不应该出现的功能 软件实现了产品说明书未提到的功能 软件未实现产品说明书虽未明确提及但应该实现的目标 软件难以理解. ...

  6. 软件测试---缺陷、缺陷报告

    软件缺陷基础概念 定义 从内部看,软件确认是产品开发或者维护过程中存在的错误.毛病等各种问题 从外部看,软件缺陷是系统所需要实现的某种功能的失效或者违背 总的来说,缺陷就是问题,最终表现为所需要的功能 ...

  7. linux 内核 网卡驱动 移植,Linux内核移植步骤_添加DM9000网卡驱动(设备树).docx

    Linux内核移植步骤_添加DM9000网卡驱动(设备树) Linux内核移植步骤2015年05月13日星期三上午 11:05往设备树中添加网卡驱动:1.选平台,指定交叉编译工具链:(1).在Make ...

  8. SPOJ 7258 SUBLEX 后缀数组_二分答案_前缀和

    SPOJ 7258 SUBLEX 后缀数组_二分答案_前缀和 Code: #include <cstdio> #include <algorithm> #include < ...

  9. linux内核协议栈 netfilter 之连接跟踪子系统的L3 L4协议栈模块初始化与自定义注册

    目录 1 L3.L4协议跟踪初始化 nf_conntrack_proto_init() 1.1 L3协议管理 1.1.1 struct nf_conntrack_l3proto 1.1.2 L3协议注 ...

最新文章

  1. 疯狂android讲义(kotlin版) 源码 pan_每周一书《疯狂Python讲义》分享
  2. 【项目管理】接手一支技术团队,你会做些哪些事?
  3. 微信群发即可免费领取电动车,这你也信?
  4. 如何利用python在yi'ge_【GE查找Python面试题】面试问题:使用 TVM … - 看准网
  5. front mysql 导出表结构_肿么将mysql的表结构导出到sqlserver中
  6. 中国金融体系主要指标大全!
  7. 转-PHP 设计模式 之策略模式 应用场景 Strategy Pattern
  8. intel和amd处理器发展历史
  9. WindowsServerAppFabric1.1安装失败、配置失败、1603错误码解决方案
  10. 红米6pro刷Android原生,红米6 Pro 魔趣OS 安卓9 MagiskV21版 完美ROOT 纯净完美 原生极简 纯净推荐...
  11. 蓝桥杯算法训练超全习题题解——ALGO-3.K好数**
  12. 构建微信公众号管理系统-微擎
  13. 什么叫资讯,资讯是什么?
  14. GPL和LGPL的区别!
  15. 我们不再是冷暖自知的个体
  16. poj3179 : corral the cows-离散化的巧妙运用
  17. Java 之 Excel文件下载
  18. SQL Server索引的创建与维护
  19. [3th of series ABE] Shamir‘s Secret Sharing
  20. isnumber()函数注意事项

热门文章

  1. 网易免费企业邮怎样设置客户端?
  2. 手动制作linux live,使用Etcher轻松制作Linux Live Disks | MOS86
  3. 关于虎牙登录算法分析
  4. 技术总结-从输入 URL 到页面加载完成的过程中都发生了什么事情?
  5. 《碎片的最佳实践》读书笔记
  6. 百度贴吧测试部门实习生电话面试
  7. mysql 的服务指南
  8. 大学计算机基础教研活动记录,大学计算机基础教学研讨会在我校举行
  9. msk 频偏_数字调制MSK探究
  10. 2018首届传神者大会:“语言+新技术”将推动语言产业生态化发展