Page MenuHomeFreeBSD

Add tests for {get/set}auid, {get/set}audit, {get/set}audit_addr
ClosedPublic

Authored by aniketp on Jun 17 2018, 8:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 1:19 AM
Unknown Object (File)
Fri, Nov 8, 9:32 PM
Unknown Object (File)
Fri, Nov 8, 7:49 AM
Unknown Object (File)
Thu, Nov 7, 11:32 AM
Unknown Object (File)
Thu, Nov 7, 8:18 AM
Unknown Object (File)
Oct 24 2024, 3:28 AM
Unknown Object (File)
Oct 24 2024, 3:28 AM
Unknown Object (File)
Oct 24 2024, 3:27 AM
Subscribers

Details

Summary

This revision introduces tests for syscalls from audit class administrative.
The syscalls are:

  • setauid(2)
  • getauid(2)
  • setaudit(2)
  • getaudit(2)
  • setaudit_addr(2)
  • getaudit_addr(2)
Test Plan

Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17397
Build 17229: arc lint + arc unit

Event Timeline

asomers added inline comments.
tests/sys/audit/administrative.c
408

In new code, you should prefer to use standardized types like unsigned int or uint32_t instead of u_int. And why use malloc for just 32 bits?

413

You're passing uninitialized memory here. I'm not sure exactly how this system call is supposed to be used, but I would guess that you should supply sizeof(auditinfo).

463

Don't forget to fix the uninitialized memory error here, too.

This revision now requires changes to proceed.Jun 17 2018, 10:15 PM

Instead of passing allocated and unitialized memory as the length for {get/set}audit_addr, simply pass the sizeof(auditinfo) as it is supposed to be used.

Thanks to @asomers for suggesting. Although I wish the man-page was a bit more clear on
this regard (about what exactly is length).

Instead of passing allocated and unitialized memory as the length for {get/set}audit_addr, simply pass the sizeof(auditinfo) as it is supposed to be used.

Thanks to @asomers for suggesting. Although I wish the man-page was a bit more clear on
this regard (about what exactly is length).

Though it doesn't say so explicitly, length's purpose is probably to allow the auditinfo_addr structure to grow in the future, while preserving the ability of older programs to continue using the old structure. It's a simpler alternative to updating the syscall.

This revision is now accepted and ready to land.Jun 18 2018, 3:33 PM
This revision was automatically updated to reflect the committed changes.