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 all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +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

Expand Down
9 changes: 5 additions & 4 deletions audit.go
Original file line number Diff line number Diff line change
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.
// 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