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

Fix support of kernel < 3.0 #119

Merged
merged 2 commits into from Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix change in behaviour that causes error when unmarshaling `AuditStatus` with a short buffer. [#110](https://github.com/elastic/go-libaudit/pull/110)
- Reduce heap allocations when parsing and enriching auditd events. [#111](https://github.com/elastic/go-libaudit/pull/111)
- Relax short buffer requirement further to allow for kernels that do not support the backlog wait feature. [#113](https://github.com/elastic/go-libaudit/pull/113)

- Fix minimum `AuditStatus` length so that library can support kernels from 2.6.32. [#119](https://github.com/elastic/go-libaudit/pull/119)
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
### Removed

### Deprecated
Expand Down
9 changes: 5 additions & 4 deletions audit.go
Expand Up @@ -606,12 +606,13 @@ type AuditStatus struct {
const (
sizeofAuditStatus = int(unsafe.Sizeof(AuditStatus{}))

// MinSizeofAuditStatus is the minimum usable message size that
// is acceptable for unmarshaling from the wire format. Messages
// this size do not report features after the FeatureBitmap field.
// MinSizeofAuditStatus is the minimum usable message size for
// the earliest 2.6.32 kernel supported by Go lang.
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
// https://elixir.bootlin.com/linux/v2.6.32/source/include/linux/audit.h#L317
// Messages this size do not report features after the Backlog field.
// Users should consult the feature bitmap to determine which
// features are valid.
MinSizeofAuditStatus = int(unsafe.Offsetof(AuditStatus{}.FeatureBitmap) + unsafe.Sizeof(AuditStatus{}.FeatureBitmap))
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
MinSizeofAuditStatus = int(unsafe.Offsetof(AuditStatus{}.Backlog) + unsafe.Sizeof(AuditStatus{}.Backlog))
)

func (s AuditStatus) toWireFormat() []byte {
Expand Down