Page MenuHomeFreeBSD

Include <bsm/audit.h> in <security/audit/audit_ioctl.h> for `au_mask_t` data-type
ClosedPublic

Authored by aniketp on May 24 2018, 7:07 PM.

Details

Summary

The argument for auditpipe(4)'s AUDITPIPE_GET/SET_PRESELECT_AUID request is a data structure of type struct auditpipe_ioctl_preselect whose fields are not defined within the same header file. i.e security/audit/audit_ioctl.h

Here:

struct auditpipe_ioctl_preselect {
	au_id_t		aip_auid;
	au_mask_t	aip_mask;
};

has the data types au_id_t and au_mask_t whose definitions are present in bsm/audit.h. So it would be appropriate to include bsm/audit.h within security/audit/audit_ioctl.h

Bug Report: 228470

Test Plan

While working with auditpipe(4) in any application. Don't include bsm/audit.h additionally. It should work just fine with only including security/audit/audit_ioctl.h in the program.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

aniketp created this revision.May 24 2018, 7:07 PM
aniketp edited the summary of this revision. (Show Details)May 24 2018, 7:10 PM
aniketp edited the test plan for this revision. (Show Details)
asomers added inline comments.May 27 2018, 12:51 AM
sys/security/audit/audit_ioctl.h
34 ↗(On Diff #42952)

I thought the entire point of this change was so audit_ioctl.h wouldn't have to include bsm/audit.h?

aniketp added inline comments.May 27 2018, 12:54 AM
sys/security/audit/audit_ioctl.h
34 ↗(On Diff #42952)

AUDITPIPE_GET_PRESELECT_AUID uses struct auditpipe_ioctl_preselect. So one way or another, we'll have to include <bsm/audit.h> in audit_ioctl.h.

Moving the struct definitions along with the others in bsm/audit.h seemed like a cleaner approach.

asomers added inline comments.May 30 2018, 8:05 PM
sys/security/audit/audit_ioctl.h
34 ↗(On Diff #42952)

If security/audit/audit_ioctl.h must include bsm/audit.h anyway, then there's no point to moving the struct definition. Move it back.

aniketp updated this revision to Diff 43173.May 30 2018, 8:39 PM
aniketp retitled this revision from Move "struct auditpipe_ioctl_preselect" to <bsm/audit.h> from <security/audit/audit_ioctl.h> to Include <bsm/audit.h> in <security/audit/audit_ioctl.h> for `au_mask_t` data-type.
aniketp edited the summary of this revision. (Show Details)

Revert every change except importing <bsm/audit.h> into <security/audit/audit_ioctl.h>

asomers accepted this revision.May 30 2018, 8:58 PM
This revision is now accepted and ready to land.May 30 2018, 8:58 PM
This revision was automatically updated to reflect the committed changes.