Contact me: hankecnc@gmail.com

如果未找到 _sincos,则 rtai_math 会导致内核崩溃。 #893

推推 grbl 3年前 (2023-01-30) 190次浏览
关闭
andypugh 打开了这个问题 2020 年 6 月 28 日 · 2 条评论
关闭

如果未找到 _sincos,则 rtai_math 会导致内核崩溃。#893

andypugh 打开了这个问题 2020 年 6 月 28 日 · 2 条评论

注释

如果未找到 _sincos,则 rtai_math 会导致内核崩溃。 #893
合作者
安迪普 评论了 2020 年 6 月 28 日  

如果 configure 找到 sincos 而不是 __sincos (?),则 HAVE_SINCOS 已定义且 HAVE__SINCOS 未定义。

这会在运行 on_abort_command_crazy_move 测试时导致 100% 可重复的内核恐慌。但它需要一个可能只有我拥有的设置。我正在运行带有 RTAI“vulcano”补丁 4.19.114 内核的 Buster,RTAI 配置为使用 MUSL 数学库

但是我认为任何了解配置脚本和 rtapi_math 的人都可以遵循逻辑(即,不是我)

配置输出:

checking for sincos function... yes
checking for __sincos... no

dmesg(调试打开并且 CONFIG_DYNAMIC_DEBUGGING=y)

Jun 28 00:46:40 rm-one kernel: [12329.424327] 	0xffffffffc0b8f000 .note.gnu.build-id
Jun 28 00:46:40 rm-one kernel: [12329.424328] 	0xffffffffc0b8f024 .note.Linux
Jun 28 00:46:40 rm-one kernel: [12329.424342] 	0xffffffffc0b74000 .text
Jun 28 00:46:40 rm-one kernel: [12329.424343] 	0xffffffffc0b8f040 .rodata
Jun 28 00:46:40 rm-one kernel: [12329.424344] 	0xffffffffc0b8f0d8 .rodata.cst8
...
Jun 28 00:46:40 rm-one kernel: [12329.424405] motmod does not use rtai_math!
...
Jun 28 00:46:45 rm-one kernel: [12334.686628] RTAPI: Task 1[ffffa42014c86000]: Fault with vec=8, signo=11 ip=ffffffffc0b8e434.
Jun 28 00:46:45 rm-one kernel: [12334.686628] RTAPI: This fault may not be recoverable without rebooting.

(随后是整个系统锁定)

addr2line 指向 sincos.c 第 36 行:

#include "config.h"

#if defined(__KERNEL__)
#undef HAVE_SINCOS
#endif

#ifndef HAVE_SINCOS

#include "rtapi_math.h"
#include "sincos.h"

#ifndef HAVE___SINCOS

#include "posemath.h"

void sincos(double x, double *sx, double *cx)
{
    *sx = sin(x);
    *cx = cos(x);
}

#endif

#endif

而且,事实上,注释掉对 sin 和 cos 的调用意味着系统不会崩溃并且 on_abort_crazy_move 测试通过。

我的理论是这段代码没有得到有效的 sin 和 cos。代码确实可以运行(通过添加带有 sin 和 cos 注释的 printk 来证明)

如果未找到 _sincos,则 rtai_math 会导致内核崩溃。 #893 安迪普 补充道 影响2.7 影响主人 2.8-必须修复 在 2.8 发布之前必须解决的问题影响2.8 标签 2020 年 6 月 28 日
如果未找到 _sincos,则 rtai_math 会导致内核崩溃。 #893
合作者作者

Jepler 指出,崩溃是由于 sincos 被编译器优化为对 sincos 的调用。

如果未找到 _sincos,则 rtai_math 会导致内核崩溃。 #893
合作者作者

关闭#896