aboutsummaryrefslogtreecommitdiffstats
path: root/prog/target.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-08-09 12:40:58 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-08-10 11:45:49 +0200
commit8fad22bf840fc968171bee6cf294f026eb1e0d3a (patch)
tree2bad644606904f4e75ef6fe689bac49e91877c40 /prog/target.go
parenta12254451cfa5e5129a0c091255d502b6805adf6 (diff)
prog: generate very long file names
Generate very long file names once in a while to provoke bugs like: https://github.com/google/gvisor/commit/f857f268eceb1cdee0b2bdfa218c969c84033fcd
Diffstat (limited to 'prog/target.go')
-rw-r--r--prog/target.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/prog/target.go b/prog/target.go
index 08495f1f2..56c2a94ca 100644
--- a/prog/target.go
+++ b/prog/target.go
@@ -54,6 +54,9 @@ type Target struct {
// Additional special invalid pointer values besides NULL to use.
SpecialPointers []uint64
+ // Special file name length that can provoke bugs (e.g. PATH_MAX).
+ SpecialFileLenghts []int
+
// Filled by prog package:
SyscallMap map[string]*Syscall
ConstMap map[string]uint64
@@ -132,6 +135,15 @@ func (target *Target) lazyInit() {
if len(target.SpecialPointers) > maxSpecialPointers {
panic("too many special pointers")
}
+ if len(target.SpecialFileLenghts) == 0 {
+ // Just some common lengths that can be used as PATH_MAX/MAX_NAME.
+ target.SpecialFileLenghts = []int{256, 512, 4096}
+ }
+ for _, ln := range target.SpecialFileLenghts {
+ if ln <= 0 || ln >= memAllocMaxMem {
+ panic(fmt.Sprintf("bad special file length %v", ln))
+ }
+ }
// These are used only during lazyInit.
target.ConstMap = nil
target.types = nil