[FZH] [Misc] 如何限制系统调用

Hexchain Tong richard0053在gmail.com
星期日 一月 9 09:38:03 UTC 2011


谢谢!现在的方法是把目标程序setuid成没有人

Hexchain Tong
On Jan 8, 2011 8:19 PM, "BYVoid" <byvoid.kcp在gmail.com> wrote:
> 使用ptrace
>
> Hexchain Tong <richard0053在gmail.com> 於 2011年1月7日下午4:40 寫道:
>
>> 2011/1/7 Hexchain Tong <richard0053在gmail.com>:
>> > Hi all,
>> >
>> > 最近在写一个类似于 OI 评测机的程序,由用户提交代码,处理后编译为目标程序执行。现在的想法是由一个程序 fork 出子进程,在子进程里
>> > chroot 后执行目标程序,主程序卡时间等待子程序退出(主进程退出时会按 pid 杀掉 fork
>> > 出来的子进程)。但是目标程序的这样一段代码会让自身不被杀掉:
>> >
>> > extern int kill(int, int);
>> > extern int getppid(void);
>> > extern int pause(void);
>> >
>> > int main() {
>> > kill(getppid(), 9);
>> > pause();
>> > return 0;
>> > }
>> >
>> > 在 USACO (http://ace.delos.com/usacogate) 上测试会出现 Bad syscall 的错误,请问这种对
>> > syscall 的限制是怎么做到的?如果有更好的方法,请告诉我,谢谢!
>> >
>> > --
>> > Hexchain Tong
>> > ----------------------------------------------------
>> > Profile: https://www.google.com/profiles/richard0053
>> > Twitter: @Hexc4l
>> > Facebook: hexchain在facebook.com
>> > Mail: richard0053在gmail.com
>> >
>>
>> 可能没说清楚……假设用户代码编译出来的程序是 A,执行 fork/chroot 的那个程序是 F,正常情况下 F 会 fork 出子进程后
>> exec A,上面的代码则会导致 F 死掉而 A 继续运行。
>>
>> --
>> Hexchain Tong
>> ----------------------------------------------------
>> Profile: https://www.google.com/profiles/richard0053
>> Twitter: @Hexc4l
>> Facebook: hexchain在facebook.com
>> Mail: richard0053在gmail.com
>> _______________________________________________
>> Chinese mailing list
>> Chinese at lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/chinese
>>
>
>
>
> --
> Chia-Pao Kuo
>
> Tsinghua University
> Department of Computer Science & Technology
>
> Email: byvoid.kcp在gmail.com
> Gtalk: byvoid1在gmail.com
> http://www.byvoid.com
> _______________________________________________
> Chinese mailing list
> Chinese at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/chinese


关于邮件列表 Chinese 的更多信息