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)
Fri, Apr 19, 3:43 PM
Unknown Object (File)
Jan 27 2024, 1:49 AM
Unknown Object (File)
Jan 27 2024, 1:49 AM
Unknown Object (File)
Jan 27 2024, 1:30 AM
Unknown Object (File)
Jan 27 2024, 1:29 AM
Unknown Object (File)
Jan 27 2024, 12:51 AM
Unknown Object (File)
Jan 18 2024, 3:40 PM
Unknown Object (File)
Dec 22 2023, 9:55 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers added inline comments.
tests/sys/audit/administrative.c
409 ↗(On Diff #43967)

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?

414 ↗(On Diff #43967)

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).

464 ↗(On Diff #43967)

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.