如何在 Linux 内核中用用户定义的处理程序替换默认处理程序来处理生成核心转储的异常?

发布于 2024-11-03 08:34:49 字数 692 浏览 4 评论 0原文

我正在研究“在 Linux 平台上创建事后数据记录器”。我之前也发布了有关该项目的问题。在那里,我得到了RHEL版本中创建核心转储文件的调用流程机制:2.6.18.128-el5。

它如下:

File                                       Function called
1.source/ arch/i386/kernel/signal.c -----> do_signal( )
2.source/kernel/signal.c       ----------> get_signal_to_deliver( )
3.source/fs/exec.c          -------------> do_coredump( )
4.source/fs/binfmt_elf.c    -------------> elf_core_dump( )

现在,根据项目要求,我需要使用我自己的用户定义的信号处理程序来修改默认信号处理程序定义,该处理程序处理各种异常(SIGSEGVSIGFPESIGABRT 等)导致 coredump。此外,我需要构建内核以保留内核中的更改,并用我的处理程序替换默认处理程序。

有人可以分享一下执行这些操作的程序吗?

提前感谢所有回复者:)

谢谢 虚拟LC

I am working on "Creation of Postmortem data logger on Linux platform". I posted a question regarding this project previously also. There, i got the call flow mechanism of core dump file creation in RHEL version: 2.6.18.128-el5.

It follows as:

File                                       Function called
1.source/ arch/i386/kernel/signal.c -----> do_signal( )
2.source/kernel/signal.c       ----------> get_signal_to_deliver( )
3.source/fs/exec.c          -------------> do_coredump( )
4.source/fs/binfmt_elf.c    -------------> elf_core_dump( )

Now,as per project requirements, i need to modify the default signal handler definitions with my own user defined signal handler that handles various exceptions (SIGSEGV, SIGFPE, SIGABRT etc) causing coredump. Further, i need to build the kernel for keeping the changes in kernel with my handler replacing default handler.

Can anybody please share the proceedings to do those operations ?

Advance thanks to all repliers:)

Thanks
vlc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假扮的天使 2024-11-10 08:34:50

SIGFPE、SIGABRT、SIGSEGV 和其他一些默认情况下已经生成核心转储,请参阅 信号(7)。然而,许多发行版将核心文件大小资源限制设置为 0,从而禁用核心转储生成。您可以通过以下方式重新启用它:

ulimit -c unlimited

您可以传递核心转储应占用的文件系统块的最大数量,而不是无限制

SIGFPE, SIGABRT, SIGSEGV and some others already generate a core dump by default, see signal(7). However, many distros set the core file size resource limit to 0, disabling core dump generation. You can reenable it by:

ulimit -c unlimited

Instead of unlimited, you can pass the maximum number of filesystem blocks core dumps should take.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文