622 RMessageT m(0x800fff00); // this should be off the end of the kernel heap |
622 RMessageT m(0x800fff00); // this should be off the end of the kernel heap |
623 m.Complete(KErrNone); // this should panic the thread |
623 m.Complete(KErrNone); // this should panic the thread |
624 return KErrNone; |
624 return KErrNone; |
625 } |
625 } |
626 |
626 |
|
627 TInt RogueThread5(TAny*) |
|
628 { |
|
629 // try to masquerade as the WindowServer |
|
630 UserSvr::WsRegisterThread(); // this should panic the thread |
|
631 return KErrNone; |
|
632 } |
|
633 |
|
634 TInt RogueThread6(TAny*) |
|
635 { |
|
636 // try to masquerade as the FileServer |
|
637 UserSvr::FsRegisterThread(); // this should panic the thread |
|
638 return KErrNone; |
|
639 } |
|
640 |
|
641 TInt RogueThread7(TAny*) |
|
642 { |
|
643 // try to masquerade as the FileServer |
|
644 RChunk myChunk; |
|
645 TInt err = myChunk.CreateLocal(4096, 8192); |
|
646 if (err == KErrNone) |
|
647 UserSvr::RegisterTrustedChunk(myChunk.Handle()); // this should panic the thread |
|
648 return err; |
|
649 } |
|
650 |
627 void DisplayThreadExitInfo(const RThread& aThread) |
651 void DisplayThreadExitInfo(const RThread& aThread) |
628 { |
652 { |
629 TFullName fn=aThread.FullName(); |
653 TFullName fn=aThread.FullName(); |
630 TExitType exitType=aThread.ExitType(); |
654 TExitType exitType=aThread.ExitType(); |
631 TInt exitReason=aThread.ExitReason(); |
655 TInt exitReason=aThread.ExitReason(); |
672 test_KErrNone(r); |
696 test_KErrNone(r); |
673 RunPanicThread(thread); // wait for rogue thread to die |
697 RunPanicThread(thread); // wait for rogue thread to die |
674 DisplayThreadExitInfo(thread); |
698 DisplayThreadExitInfo(thread); |
675 test(thread.ExitType()==EExitPanic); |
699 test(thread.ExitType()==EExitPanic); |
676 test(thread.ExitReason()==EBadMessageHandle); |
700 test(thread.ExitReason()==EBadMessageHandle); |
|
701 thread.Close(); |
|
702 |
|
703 test.Next(_L("Rogue thread test 5")); |
|
704 r=thread.Create(_L("Rogue5"),RogueThread5,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
|
705 test_KErrNone(r); |
|
706 RunPanicThread(thread); // wait for rogue thread to die |
|
707 DisplayThreadExitInfo(thread); |
|
708 test(thread.ExitType()==EExitPanic); |
|
709 test(thread.ExitReason()==EAccessDenied); |
|
710 thread.Close(); |
|
711 |
|
712 test.Next(_L("Rogue thread test 6")); |
|
713 r=thread.Create(_L("Rogue6"),RogueThread6,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
|
714 test_KErrNone(r); |
|
715 RunPanicThread(thread); // wait for rogue thread to die |
|
716 DisplayThreadExitInfo(thread); |
|
717 test(thread.ExitType()==EExitPanic); |
|
718 test(thread.ExitReason()==EAccessDenied); |
|
719 thread.Close(); |
|
720 |
|
721 test.Next(_L("Rogue thread test 7")); |
|
722 r=thread.Create(_L("Rogue7"),RogueThread7,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
|
723 test_KErrNone(r); |
|
724 RunPanicThread(thread); // wait for rogue thread to die |
|
725 DisplayThreadExitInfo(thread); |
|
726 test(thread.ExitType()==EExitPanic); |
|
727 test(thread.ExitReason()==EAccessDenied); |
677 thread.Close(); |
728 thread.Close(); |
678 } |
729 } |
679 |
730 |
680 TInt SecondClient(TAny* aSession) |
731 TInt SecondClient(TAny* aSession) |
681 { |
732 { |