1. 01 6月, 2020 4 次提交
  2. 31 5月, 2020 21 次提交
  3. 13 5月, 2020 7 次提交
  4. 23 4月, 2020 1 次提交
  5. 10 3月, 2020 1 次提交
  6. 28 2月, 2020 1 次提交
    • V
      pstore: pstore_ftrace_seq_next should increase position index · 6c871b73
      Vasily Averin 提交于
      In Aug 2018 NeilBrown noticed
      commit 1f4aace6 ("fs/seq_file.c: simplify seq_file iteration code and interface")
      "Some ->next functions do not increment *pos when they return NULL...
      Note that such ->next functions are buggy and should be fixed.
      A simple demonstration is
      
       dd if=/proc/swaps bs=1000 skip=1
      
      Choose any block size larger than the size of /proc/swaps. This will
      always show the whole last line of /proc/swaps"
      
      /proc/swaps output was fixed recently, however there are lot of other
      affected files, and one of them is related to pstore subsystem.
      
      If .next function does not change position index, following .show function
      will repeat output related to current position index.
      
      There are at least 2 related problems:
      - read after lseek beyond end of file, described above by NeilBrown
        "dd if=<AFFECTED_FILE> bs=1000 skip=1" will generate whole last list
      - read after lseek on in middle of last line will output expected rest of
        last line but then repeat whole last line once again.
      
      If .show() function generates multy-line output (like
      pstore_ftrace_seq_show() does ?) following bash script cycles endlessly
      
       $ q=;while read -r r;do echo "$((++q)) $r";done < AFFECTED_FILE
      
      Unfortunately I'm not familiar enough to pstore subsystem and was unable
      to find affected pstore-related file on my test node.
      
      If .next function does not change position index, following .show function
      will repeat output related to current position index.
      
      Cc: stable@vger.kernel.org
      Fixes: 1f4aace6 ("fs/seq_file.c: simplify seq_file iteration code ...")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283Signed-off-by: NVasily Averin <vvs@virtuozzo.com>
      Link: https://lore.kernel.org/r/4e49830d-4c88-0171-ee24-1ee540028dad@virtuozzo.com
      [kees: with robustness tweak from Joel Fernandes <joelaf@google.com>]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6c871b73
  7. 26 2月, 2020 2 次提交
  8. 09 1月, 2020 1 次提交
    • K
      pstore/ram: Regularize prz label allocation lifetime · e163fdb3
      Kees Cook 提交于
      In my attempt to fix a memory leak, I introduced a double-free in the
      pstore error path. Instead of trying to manage the allocation lifetime
      between persistent_ram_new() and its callers, adjust the logic so
      persistent_ram_new() always takes a kstrdup() copy, and leaves the
      caller's allocation lifetime up to the caller. Therefore callers are
      _always_ responsible for freeing their label. Before, it only needed
      freeing when the prz itself failed to allocate, and not in any of the
      other prz failure cases, which callers would have no visibility into,
      which is the root design problem that lead to both the leak and now
      double-free bugs.
      Reported-by: NCengiz Can <cengiz@kernel.wtf>
      Link: https://lore.kernel.org/lkml/d4ec59002ede4aaf9928c7f7526da87c@kernel.wtf
      Fixes: 8df955a3 ("pstore/ram: Fix error-path memory leak in persistent_ram_new() callers")
      Cc: stable@vger.kernel.org
      Signed-off-by: NKees Cook <keescook@chromium.org>
      e163fdb3
  9. 03 1月, 2020 2 次提交