ftruncate: pass a signed offset
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3f6d078d4accfff8b114f968259a060bfdc7c682 · < 836359247b0403e0634bfbc83e5bb8063fad287a| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ftruncate: pass a signed offset
The old ftruncate() syscall, using the 32-bit off_t misses a sign extension when called in compat mode on 64-bit architectures. As a result, passing a negative length accidentally succeeds in truncating to file size between 2GiB and 4GiB.
Changing the type of the compat syscall to the signed compat_off_t changes the behavior so it instead returns -EINVAL.
The native entry point, the truncate() syscall and the corresponding loff_t based variants are all correct already and do not suffer from this mistake.
From the CVE record · Linux
On 64-bit Linux architectures, the old ftruncate() syscall mishandles negative lengths when called in compat mode. A local caller can pass a negative length and unexpectedly truncate a file to a size between 2 GiB and 4 GiB; the input does not specify authentication requirements or user interaction.
Engineers running Linux on 64-bit architectures with compat-mode support should check their kernel versions; affected versions are not specified.