Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity test suite #71

Closed
wants to merge 27 commits into from

Conversation

pakmarkthub
Copy link
Collaborator

This PR depends on PR #60. DO NOT merge it before merging PR #60.

This change:

  • introduces the sanity test suite, which does basic functionality and invalidation tests.
  • consolidates "basic" and "validate" tests into "sanity" test.
  • creates test cases to ensure no security holes due to invalidation issues.

@pakmarkthub pakmarkthub changed the title Sanity unittest Sanity test suite Jul 18, 2019
@drossetti
Copy link
Member

@pakmarkthub now that the other PR of yours has been merged into the upstream invalidate branch, could you please rebase your dev-sanity-unittest tree?

…" clean up to gdrdrv, and added *.swp to .gitignore
@pakmarkthub
Copy link
Collaborator Author

@drossetti Rebased. Please take a look.

@e-ago
Copy link
Collaborator

e-ago commented Aug 1, 2019

I've executed the ./sanity -v test on a DGX-1V with:

  • Ubuntu 18.04, kernel 4.4
  • GPU V100, CUDA 10.1, r418.67

Few comments:

  • You should specify in the README that the check framework is required on the machine
  • dmesg returns some messages when using sockets in tests:
[Aug 1 10:23] gdrdrv:invoking unpin_buffer while callback has already been fired
[  +0.000006] gdrdrv:invoking unpin_buffer while callback has already been fired
[  +1.815832] gdrdrv:filp is not opened by the current process
[  +2.542915] gdrdrv:filp is not opened by the current process
[  +1.639312] gdrdrv:invoking unpin_buffer while callback has already been fired
[  +1.715075] gdrdrv:filp is not opened by the current process
[  +0.454921] gdrdrv:filp is not opened by the current process
[  +1.252773] gdrdrv:filp is not opened by the current process
[  +0.078880] gdrdrv:filp is not opened by the current process

I still have to go through the entire code

@pakmarkthub pakmarkthub requested a review from e-ago August 1, 2019 17:42
@pakmarkthub
Copy link
Collaborator Author

Thank you @e-ago. dmesg is a good catch. I should use gdr_dbg instead of gdr_err to suppress the message. By the way, this is the expected behavior because "sanity" verifies that Process A cannot spy on Process B via gdrcopy.

@pakmarkthub pakmarkthub added this to the 2.0 milestone Aug 5, 2019
@pakmarkthub
Copy link
Collaborator Author

@e-ago I have fixed the code according to your comments. Please take a look.

memset(copy_buf, 0xA5, size * sizeof(*copy_buf));

print_dbg("check 2: gdr_copy_to_bar() + read back via cuMemcpy D->H\n");
gdr_copy_to_bar(buf_ptr, init_buf, size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In check 1 test you already set the value of buf_ptr with the same values ininit_buf. Maybe you can cleanup buf_ptr before copying again init_buf values with a different method (as you do for copy_buf)

compare_buf(init_buf, copy_buf, size - extra_off);
memset(copy_buf, 0xA5, size * sizeof(*copy_buf));

extra_off = 11;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you chose 11 to not use an aligned value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Davide wrote this test. I guess that is his intention.

@@ -339,7 +339,7 @@ static int gdrdrv_release(struct inode *inode, struct file *filp)
}
// Check that the caller is the same process that did gdrdrv_open
if (info->pid != task_pid(current)) {
gdr_err("filp is not opened by the current process\n");
gdr_dbg("filp is not opened by the current process\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should prevent the dmesg messages I was observing

ASSERT_EQ(gdr_close(g), 0);

print_dbg("Trying to read buf_ptr[0] after gdr_close\n");
expecting_exception_signal = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a memory barrier here (and in the next tests at this point) to prevent any reordering?

@pakmarkthub
Copy link
Collaborator Author

@e-ago I updated the code. Please take a look.

@pakmarkthub
Copy link
Collaborator Author

Merged

@pakmarkthub pakmarkthub closed this Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants