mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
tests: check fpu registers before doing any function call
Function calls can "corrupt" fpu registers. PiperOrigin-RevId: 671577096
This commit is contained in:
@@ -110,11 +110,11 @@ TEST(FPSigTest, Fork) {
|
||||
asm volatile("svc #0\n" : "=r"(x0) : "r"(x0), "r"(x1), "r"(x2), "r"(x8) :);
|
||||
ret = x0;
|
||||
#endif
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
uint64_t got;
|
||||
GET_FP0(got);
|
||||
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
if (getpid() == parent) { // Parent.
|
||||
int status;
|
||||
ASSERT_THAT(waitpid(child, &status, 0), SyscallSucceedsWithValue(child));
|
||||
|
||||
@@ -82,11 +82,12 @@ void sigusr1(int s, siginfo_t* siginfo, void* _uc) {
|
||||
asm volatile("svc #0\n" : "=r"(x0) : "r"(x0), "r"(x1), "r"(x2), "r"(x8) :);
|
||||
ret = x0;
|
||||
#endif
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
// Record value of %xmm0 again to verify that the nested signal handler
|
||||
// does not clobber it.
|
||||
GET_FP0(exitxmm[0]);
|
||||
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
TEST(FPSigTest, NestedSignals) {
|
||||
@@ -132,11 +133,11 @@ TEST(FPSigTest, NestedSignals) {
|
||||
asm volatile("svc #0\n" : "=r"(x0) : "r"(x0), "r"(x1), "r"(x2), "r"(x8) :);
|
||||
ret = x0;
|
||||
#endif
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
uint64_t got;
|
||||
GET_FP0(got);
|
||||
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
//
|
||||
// The checks below verifies the following:
|
||||
// - signal handlers must called with a clean fpu state.
|
||||
|
||||
Reference in New Issue
Block a user