SYSCTL_WRITES_WARN was added in commit f4aacea2f5d1 ("sysctl: allow for strict write position handling"), and released in v3.16 in August of 2014. Since then I can find only 1 instance of non-zero offset writing[1], and it was fixed immediately in CRIU[2]. As such, it appears safe to flip this to the strict state now. [1] https://www.google.com/search?q="when%20file%20position%20was%20not%200" [2] http://lists.openvz.org/pipermail/criu/2015-April/019819.html
Unified · Split
| @@ -825,14 +825,13 @@ via the /proc/sys interface: · 824 unmodified lines | |||
| 825 | Each write syscall must fully contain the sysctl value to be | 825 | Each write syscall must fully contain the sysctl value to be |
| 826 | written, and multiple writes on the same sysctl file descriptor | 826 | written, and multiple writes on the same sysctl file descriptor |
| 827 | will rewrite the sysctl value, regardless of file position. | 827 | will rewrite the sysctl value, regardless of file position. |
| 828 | 0 - (default) Same behavior as above, but warn about processes that | 828 | 0 - Same behavior as above, but warn about processes that perform writes |
| 829 | perform writes to a sysctl file descriptor when the file position | 829 | to a sysctl file descriptor when the file position is not 0. |
| 830 | is not 0. | 830 | 1 - (default) Respect file position when writing sysctl strings. Multiple |
| 831 | 1 - Respect file position when writing sysctl strings. Multiple writes | 831 | writes will append to the sysctl value buffer. Anything past the max |
| 832 | will append to the sysctl value buffer. Anything past the max length | 832 | length of the sysctl value buffer will be ignored. Writes to numeric |
| 833 | of the sysctl value buffer will be ignored. Writes to numeric sysctl | 833 | sysctl entries must always be at file position 0 and the value must |
| 834 | entries must always be at file position 0 and the value must be | 834 | be fully contained in the buffer sent in the write syscall. |
| 835 | fully contained in the buffer sent in the write syscall. | ||
| 836 | 835 | ||
| 837 | ============================================================== | 836 | ============================================================== |
| 838 | 837 | ||
| @@ -173,7 +173,7 @@ extern int no_unaligned_warning; · 172 unmodified lines | |||
| 173 | #define SYSCTL_WRITES_WARN 0 | 173 | #define SYSCTL_WRITES_WARN 0 |
| 174 | #define SYSCTL_WRITES_STRICT 1 | 174 | #define SYSCTL_WRITES_STRICT 1 |
| 175 | 175 | ||
| 176 | static int sysctl_writes_strict = SYSCTL_WRITES_WARN; | 176 | static int sysctl_writes_strict = SYSCTL_WRITES_STRICT; |
| 177 | 177 | ||
| 178 | static int proc_do_cad_pid(struct ctl_table *table, int write, | 178 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
| 179 | void __user *buffer, size_t *lenp, loff_t *ppos); | 179 | void __user *buffer, size_t *lenp, loff_t *ppos); |