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

BUG: some tests fail on RHEL-6 #19

Closed
pcmoore opened this issue Feb 18, 2016 · 22 comments
Closed

BUG: some tests fail on RHEL-6 #19

pcmoore opened this issue Feb 18, 2016 · 22 comments
Assignees

Comments

@pcmoore
Copy link
Member

pcmoore commented Feb 18, 2016

We need to attempt a test run on a RHEL-6 system.

@The-Mule
Copy link
Member

Test are running, there is just a minor issue in the test driver - auditctl is expected in /usr/sbin but located in /sbin, I will patch it. Most of the test failed, I have to investigate that. We should also introduce some logic to distinguish between rhel-6, rhel-7 and fedora tests.

The-Mule added a commit to The-Mule/audit-testsuite that referenced this issue Nov 21, 2016
There are differences between Linux distributions - testsuite should
respect them to some extent to run correctly. Now it is possible to run
testsuite on Fedora, RHEL6, RHEL7 and Debian systems.

Moreover, some audit features available, for instance, for Fedora or
RHEL7 are missing in RHEL6. To make testsuite more robust, it is now
possible to use DISTRO environment variable which describes system under
test.

This change resolves GH Issue linux-audit#19 [1].

[1] linux-audit/audit-kernel#19

Signed-off-by: Ondrej Moris <omoris@redhat.com>
pcmoore pushed a commit that referenced this issue Nov 29, 2016
There are differences between Linux distributions - testsuite should
respect them to some extent to run correctly. Now it is possible to run
testsuite on Fedora, RHEL6, RHEL7 and Debian systems.

Moreover, some audit features available, for instance, for Fedora or
RHEL7 are missing in RHEL6. To make testsuite more robust, it is now
possible to use DISTRO environment variable which describes system under
test.

This change resolves GH Issue #19 [1].

[1] linux-audit/audit-kernel#19

Signed-off-by: Ondrej Moris <omoris@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
@The-Mule
Copy link
Member

The-Mule commented Dec 1, 2016

Well I did my homework and check all the tests in RHEL6. Details are as follows.

Working

  • syscalls_file
  • user_msg

Broken but Compatible

  • exec_execve - on RHEL6, it might take some time to populate events, test sometimes fails and sometimes passes, I hate adding sleeps to tests, but in this case adding 1s sleep before events before ausearch call makes it green

Broken

  • file_* - are these tests for directory watches? Is it supposed to be working on RHEL6? Rules are added correctly but no syscalls are audited at all

Generally Broken

  • login_tty - this test is broken for all distributions at the moment.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 1, 2016

Great, thanks for looking into this, I think we can move this from Q to BUG.

@pcmoore pcmoore added bug and removed priority/high labels Dec 1, 2016
@pcmoore pcmoore changed the title Q: do the tests run properly on RHEL-6 BUG: some tests fail on RHEL-6 Dec 1, 2016
@rgbriggs
Copy link
Member

rgbriggs commented Dec 2, 2016

Ok, I tracked down the problem with the file_* tests. The tempdir and tempfile functions don't honour the TEMPLATE assignment, so the intended file never gets created or tested. Testing with $filename = "$dir/$key";system("touch $filename"); works fine.

@rgbriggs
Copy link
Member

rgbriggs commented Dec 2, 2016

The login_tty test doesn't work on RHEL6 because that feature/bugfix hasn't been backported to RHEL6.

@rgbriggs
Copy link
Member

rgbriggs commented Dec 2, 2016

Not directly related to this issue, but in the process of debugging the tests, I found it difficult to parse the log output. It would be nice if there was a clear delimiter between each subdir test so when failures happen it is easier to see what part of the output goes with which test case.

@The-Mule
Copy link
Member

The-Mule commented Dec 2, 2016 via email

@rgbriggs
Copy link
Member

rgbriggs commented Dec 2, 2016

Here's a quick and dirty tempfile TEMPLATE workaround for RHEL6: rgbriggs@4d0fddc

@pcmoore
Copy link
Member Author

pcmoore commented Dec 15, 2016

Here's a quick and dirty tempfile TEMPLATE workaround for RHEL6: rgbriggs@4d0fddc

Thanks guys for the help on this.

One of the things that is nice about tempfile() is the automatic cleanup when UNLINK is true. @rgbriggs you mention that RHEL-6.x doesn't honor the tempfile() TEMPLATE parameter, does it still generate a file if we omit the TEMPLATE parameter? The name/location of the temp file generally shouldn't be important to us (assuming it is created in a valid temp/writable location, but I think that is a safe assumption).

@rgbriggs
Copy link
Member

It still generates a file while seemingly ignoring the TEMPLATE parameter, so I assume it would generate the same pattern of file with the TEMPLATE parameter missing. The file was generated in a safe place. Knowing that the TEMPLATE parameter was ignored (or incorrect syntax of the supplied parameter?) then I would cast some doubt that the UNLINK parameter was honoured either.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 15, 2016

It should be easy enough to verify if the UNLINK worked.

@rgbriggs
Copy link
Member

The UNLINK parameter was also ignored. There are temp files hanging around in /tmp/.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 16, 2016

Thanks for checking, but that's a bummer. We definitely need to find an alternate method of creating, and cleaning up, temporary files that works on RHEL-6.x forward (yes, I'm intentionally ignoring RHEL-5.x).

@rgbriggs
Copy link
Member

The quick and dirty patch from #19 (comment) does clean up after itself. The tempdir command does reap the files from the touch system command.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 19, 2016

So the TEMPLATE parameter works for tempdir() but not tempfile()? I didn't think that was the case based on your earlier comment, perhaps I misunderstood.

I don't see any rm/unlink actions in the quick n' dirty patch so the only way the temp files could be deleted is if $dir was deleted. What am I missing?

@rgbriggs
Copy link
Member

The TEMPLATE parameter appears to not work for either tempdir() or tempfile(), but it appears unlink works or defaults to on for tempdir() but not for tempfile(), which surprised me.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 19, 2016

Huh, yeah, I wouldn't have guess that either. What a mess.

This unpredictability makes me wonder about the difficulty of doing our own temp file management.

@rgbriggs
Copy link
Member

Well, for other tests I've just been making tempfiles based on the unique key generated for the test and cleaning up after myself.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 19, 2016

That may be the only reasonable solution, my only concern is cleanup in the case of abnormal termination, e.g. kill the test via Ctrl-C. That said, I'm not even sure the existing tempdir()/tempfile() solution handles this correctly, and I'm also not sure how much we should ultimately care about this; as long as everything is created under /tmp, artifacts under corner cases may be acceptable.

@The-Mule
Copy link
Member

It actually might be good to have some "clean-up stack" which is called when test exits or is killed / aborted. For instance, when you create a temporary file, you just add a removing call-back onto clean-up stack. Callbacks from the stack are then called by some exit subroutine or from a signal handler. Does it make sense? I can open an issue and write something for demonstration and we can then decide whether it is useful or not...?

@pcmoore
Copy link
Member Author

pcmoore commented Dec 22, 2016

@The-Mule yes, that makes sense to me (and I think what the original tempfile/tempdir code did), I just don't currently know how to do signal/exit handlers in perl; if you can write up a demonstration I think that would be very helpful.

@pcmoore
Copy link
Member Author

pcmoore commented Mar 9, 2020

It's not clear how much effort we want to put into RHEL-6.x at this point so let's close this out for now.

@pcmoore pcmoore closed this as completed Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants