Skip to content

Commit 024d5b4

Browse files
events: include 32bit syscalls in syscall event range (#2218)
This fixes a bug where 32 bit syscalls were out of range for the sys_enter/exit tail call indexes, which caused a crash when tracing them.
1 parent 5c2aabe commit 024d5b4

File tree

4 files changed

+30
-39
lines changed

4 files changed

+30
-39
lines changed

cmd/tracee-ebpf/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ func printList() {
423423
b.WriteString("System Calls: " + titleHeaderPadFirst + "Sets:" + titleHeaderPadSecond + "Arguments:\n")
424424
b.WriteString("____________ " + titleHeaderPadFirst + "____ " + titleHeaderPadSecond + "_________" + "\n\n")
425425
printEventGroup(&b, 0, events.MaxSyscallID)
426-
printEventGroup(&b, events.Unique32BitSyscallsStartID, events.Unique32BitSyscallsEndID)
427426
b.WriteString("\n\nOther Events: " + titleHeaderPadFirst + "Sets:" + titleHeaderPadSecond + "Arguments:\n")
428427
b.WriteString("____________ " + titleHeaderPadFirst + "____ " + titleHeaderPadSecond + "_________\n\n")
429428
printEventGroup(&b, events.SysEnter, events.MaxCommonID)
@@ -441,7 +440,7 @@ func printEventGroup(b *strings.Builder, firstEventID, lastEventID events.ID) {
441440
continue
442441
}
443442
if event.Sets != nil {
444-
eventSets := fmt.Sprintf("%-22s %-40s %s\n", event.Name, fmt.Sprintf("%v", event.Sets), getFormattedEventParams(i))
443+
eventSets := fmt.Sprintf("%-28s %-40s %s\n", event.Name, fmt.Sprintf("%v", event.Sets), getFormattedEventParams(i))
445444
b.WriteString(eventSets)
446445
} else {
447446
b.WriteString(event.Name + "\n")

pkg/events/amd64.go

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -343,37 +343,33 @@ const (
343343
IoPgetevents ID = 333
344344
Rseq ID = 334
345345
// 335 through 423 are unassigned to sync up with generic numbers
346-
PidfdSendSignal ID = 424
347-
IoUringSetup ID = 425
348-
IoUringEnter ID = 426
349-
IoUringRegister ID = 427
350-
OpenTree ID = 428
351-
MoveMount ID = 429
352-
Fsopen ID = 430
353-
Fsconfig ID = 431
354-
Fsmount ID = 432
355-
Fspick ID = 433
356-
PidfdOpen ID = 434
357-
Clone3 ID = 435
358-
CloseRange ID = 436
359-
Openat2 ID = 437
360-
PidfdGetfd ID = 438
361-
Faccessat2 ID = 439
362-
ProcessMadvise ID = 440
363-
EpollPwait2 ID = 441
364-
MountSetatt ID = 442
365-
QuotactlFd ID = 443
366-
LandlockCreateRuleset ID = 444
367-
LandlockAddRule ID = 445
368-
LandloclRestrictSet ID = 446
369-
MemfdSecret ID = 447
370-
ProcessMrelease ID = 448
371-
MaxSyscallID ID = 449
372-
)
373-
374-
// Set of events IDs for 32bit syscalls which have no parallel 64bit syscall
375-
const (
376-
Waitpid ID = iota + Unique32BitSyscallsStartID
346+
PidfdSendSignal ID = iota + 89 // iota = 335 here 335 + 89 = 424
347+
IoUringSetup
348+
IoUringEnter
349+
IoUringRegister
350+
OpenTree
351+
MoveMount
352+
Fsopen
353+
Fsconfig
354+
Fsmount
355+
Fspick
356+
PidfdOpen
357+
Clone3
358+
CloseRange
359+
Openat2
360+
PidfdGetfd
361+
Faccessat2
362+
ProcessMadvise
363+
EpollPwait2
364+
MountSetatt
365+
QuotactlFd
366+
LandlockCreateRuleset
367+
LandlockAddRule
368+
LandloclRestrictSet
369+
MemfdSecret
370+
ProcessMrelease
371+
// Set of events IDs for 32bit syscalls which have no parallel 64bit syscall
372+
Waitpid
377373
Oldfstat
378374
Break
379375
Oldstat
@@ -459,7 +455,7 @@ const (
459455
RtSigtimedwaitTime32
460456
FutexTime32
461457
SchedRrGetInterval32
462-
Unique32BitSyscallsEndID
458+
MaxSyscallID
463459
)
464460

465461
// x86 32bit syscall numbers

pkg/events/arm64.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,9 @@ const (
348348
MemfdSecret ID = 447
349349
ProcessMrelease ID = 448
350350
MaxSyscallID ID = 449
351+
// TODO: Compile list of unique 32bit syscalls for arm64
351352
)
352353

353-
// TODO: There isnt a Unique32BitSyscalls list for arm64
354-
const Unique32BitSyscallsEndID ID = Unique32BitSyscallsStartID
355-
356354
// following syscalls are undefined on arm64
357355
const (
358356
Open ID = iota + 10000

pkg/events/events.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ const (
170170
MaxUserSpace
171171
)
172172

173-
const Unique32BitSyscallsStartID = 3000
174-
175173
// Capture meta-events
176174
const (
177175
CaptureFileWrite ID = iota + 4000

0 commit comments

Comments
 (0)