History

sysctl: enable strict writes

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

Kees Cook committed 10 years ago

Commit 41662f51 parent a460bec2 files · +8 −9Browse files

Unified · Split

2 files
  1. Documentation/sysctl/kernel.txt +7 −8
  2. kernel/sysctl.c +1 −1
Documentation/sysctl/kernel.txt+7−8
@@ -825,14 +825,13 @@ via the /proc/sys interface: · 824 unmodified lines
825825 Each write syscall must fully contain the sysctl value to be
826826 written, and multiple writes on the same sysctl file descriptor
827827 will rewrite the sysctl value, regardless of file position.
828− 0 - (default) Same behavior as above, but warn about processes that
829− perform writes to a sysctl file descriptor when the file position
830− is not 0.
831− 1 - Respect file position when writing sysctl strings. Multiple writes
832− will append to the sysctl value buffer. Anything past the max length
833− of the sysctl value buffer will be ignored. Writes to numeric sysctl
834− entries must always be at file position 0 and the value must be
835− fully contained in the buffer sent in the write syscall.
828+ 0 - Same behavior as above, but warn about processes that perform writes
829+ to a sysctl file descriptor when the file position is not 0.
830+ 1 - (default) Respect file position when writing sysctl strings. Multiple
831+ writes will append to the sysctl value buffer. Anything past the max
832+ length of the sysctl value buffer will be ignored. Writes to numeric
833+ sysctl entries must always be at file position 0 and the value must
834+ be fully contained in the buffer sent in the write syscall.
836835
837836 ==============================================================
838837
kernel/sysctl.c+1−1
@@ -173,7 +173,7 @@ extern int no_unaligned_warning; · 172 unmodified lines
173173 #define SYSCTL_WRITES_WARN 0
174174 #define SYSCTL_WRITES_STRICT 1
175175
176−static int sysctl_writes_strict = SYSCTL_WRITES_WARN;
176+static int sysctl_writes_strict = SYSCTL_WRITES_STRICT;
177177
178178 static int proc_do_cad_pid(struct ctl_table *table, int write,
179179 void __user *buffer, size_t *lenp, loff_t *ppos);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t