diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-03 17:30:25 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-03 17:30:25 +0900 |
| commit | 162265b47efb02ae7ed6d74f47c6fa95140129ae (patch) | |
| tree | 44fca5bac63a7255de2bc93685445097c00740ef | |
| parent | 3fa7ac04e43edef16efcd9db48c05daf961a2785 (diff) | |
container: reject strings larger than a page
The vfs stores these values in a page obtained via GFP, and silently stops copying once the page is filled. This check prevents confusing behaviour in such cases.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | container/errors.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/container/errors.go b/container/errors.go index a1069b65..5a67bb4c 100644 --- a/container/errors.go +++ b/container/errors.go @@ -118,6 +118,10 @@ func errnoFallback(op, path string, err error) (syscall.Errno, *os.PathError) { // mount wraps syscall.Mount for error handling. func mount(source, target, fstype string, flags uintptr, data string) error { + if max(len(source), len(target), len(data))+1 > os.Getpagesize() { + return &MountError{source, target, fstype, flags, data, syscall.ENOMEM} + } + err := syscall.Mount(source, target, fstype, flags, data) if err == nil { return nil |
