【问题标题】:fork() returns pid of existing processfork() 返回现有进程的 pid
【发布时间】:2013-02-26 11:44:39
【问题描述】:

我正在尝试修补 Android 的 init 以允许卸载 Android 并在已初始化的硬件上加载 Ubuntu。 here 是我正在尝试的补丁。

但是在 kill -USR1 1 内核出现恐慌并且重新启动后,我在 RAM 控制台中看到了下一个:

[   96.671325] init: Got SIGUSR1, trying to execve /system/xbin/ubuntu.sh
[   96.680786] init: fork done, pid=1
[   96.685089] [K] Kernel panic - not syncing: Attempted to kill init!
[   96.685150] [<c010ac50>] (unwind_backtrace+0x0/0xe0) from [<c0596408>] (panic+0x6c/0x198)
[   96.685150] [<c0596408>] (panic+0x6c/0x198) from [<c017e1d0>] (do_exit+0x98/0x650)
[   96.685180] [<c017e1d0>] (do_exit+0x98/0x650) from [<c017ea34>] (do_group_exit+0x84/0xc0)
[   96.685211] [<c017ea34>] (do_group_exit+0x84/0xc0) from [<c017ea80>] (__wake_up_parent+0x0/0x18)
[   96.685241] CPU1: stopping
[   96.685333] [<c010ac50>] (unwind_backtrace+0x0/0xe0) from [<c0109e2c>] (handle_IPI+0xd4/0x140)
[   96.685424] [<c0109e2c>] (handle_IPI+0xd4/0x140) from [<c01053cc>] (__irq_svc+0x4c/0xe4)
[   96.685516] [<c01053cc>] (__irq_svc+0x4c/0xe4) from [<c01058c0>] (ret_fast_syscall+0x0/0x30)
[   96.785858] subsystem-fatal-8x60: Q6 NMI was sent.
[   96.790924] [K] Rebooting in 5 seconds..
[  101.798248] [K] Going down for restart now

fork() 如何将 pid==1(子进程的)返回给已经有 pid==1 的父进程 init?

谢谢!

【问题讨论】:

  • strerror 在信号处理程序中不安全,我不知道 ERROR 做了什么,我们看不到您调用的脚本。这并不能回答您的问题,但它的信息会很方便。
  • here 是脚本,但如果 init 本身有问题,它是否有意义?谢谢你,我使用 strerror_r() 更新了补丁
  • 再次感谢您,更新补丁后看起来一切正常。

标签: android c linux-kernel fork init


【解决方案1】:

strerror 在信号处理程序中不安全,所以从那里开始! :-)

【讨论】:

    猜你喜欢
    • 2017-02-14
    • 2021-02-07
    • 1970-01-01
    • 2023-01-19
    • 2013-09-25
    • 1970-01-01
    • 1970-01-01
    • 2011-02-03
    • 1970-01-01
    相关资源
    最近更新 更多