diff options
| author | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-08-22 12:52:41 -0700 |
|---|---|---|
| committer | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-08-22 12:53:26 -0700 |
| commit | 32c9be59a2485ef44ac4b3accc2f102cf2eb5a39 (patch) | |
| tree | 5f3067a604d06b13dcb006869225cca895a62842 /util | |
| parent | 5c853fd7317d337ab7dc3b9bfe533a22eb713e1f (diff) | |
security: Moved cache dropping function
Diffstat (limited to 'util')
| -rw-r--r-- | util/util.go | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/util/util.go b/util/util.go index acdc3fc..14d23e2 100644 --- a/util/util.go +++ b/util/util.go @@ -25,7 +25,6 @@ package util import ( "bufio" - "log" "math" "os" "unsafe" @@ -98,19 +97,3 @@ func ReadLine() (string, error) { scanner.Scan() return scanner.Text(), scanner.Err() } - -// DropInodeCache instructs the kernel to clear the global cache of inodes and -// dentries. This has the effect of making encrypted directories whose keys -// are not present no longer accessible. Requires root privileges. -func DropInodeCache() error { - log.Print("dropping page caches") - // See: https://www.kernel.org/doc/Documentation/sysctl/vm.txt - file, err := os.OpenFile("/proc/sys/vm/drop_caches", os.O_WRONLY|os.O_SYNC, 0) - if err != nil { - return err - } - defer file.Close() - // "2" just clears the inodes and dentries - _, err = file.WriteString("2") - return err -} |