JOS——Lab 3

Answer the following questions in your answers-lab3.txt:

  1. What is the purpose of having an individual handler function foreach exception/interrupt? (i.e., if all exceptions/interrupts weredelivered to the same handler, what feature that exists inthe current implementation could not be provided?)
  2. Did you have to do anything to make the user/softint program behave correctly?The grade script expects it to produce a general protectionfault (trap 13), butsoftint's code saysint $14.Why should this produce interrupt vector 13?What happens if the kernel actually allowssoftint'sint $14 instruction to invoke the kernel's page fault handler(which is interrupt vector 14)?

问题一:

不同的异常的处理方式不同,需要的参数不同;因此,每个中断/异常需要有自己的处理函数;如果没有的话,在当前的实现情况下不能辨别到底是发生了什么样的异常。

问题二:

Executing the INT n instruction when the CPL is greater than the DPL of the referenced interrupt, trap, or task gate. (Intel技术手册233页)。当CPL是3(用户级别),但是我调用的INT n 指令的特权级别是0(内核级别),因此出现保护性错误。如果允许直接调用INT 14(缺页中断),则用户可以不经过内核的检查允许而自己分配内存,这是个很大的漏洞。


  1. The break point test case will either generate a break pointexception or a general protection fault depending on how you initializedthe break point entry in the IDT (i.e., your call toSETGATE from trap_init). Why?How do you need to set it up in order to get the breakpoint exceptionto work as specified above and what incorrect setup wouldcause it to trigger a general protection fault?
  2. What do you think is the point of these mechanisms,particularly in light ofwhat the user/softint test program does?
问题三:

产生general protection异常的原因是在设置IDT时将break point的特权级别设置为来0(内核级别),因此由用户来访问时肯定会发生保护错误。将其设置为3,则保护错误会消失。

问题四:

softint不允许用户直接产生保护了内核,防止收到恶性攻击;而break point的机制给开发人员提供了便利,但是却不会引发恶性的攻击。



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值