Bug 32981

Summary: Параметр --allow-discards
Product: Sisyphus Reporter: aebirukov
Component: make-initrd-luksAssignee: Alexey Gladkov <legion>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: glebfm, ldv, legion, mike, placeholder
Version: unstable   
Hardware: all   
OS: Linux   
Attachments:
Description Flags
Патч для установки параметра по умолчанию. none

Description aebirukov 2017-01-10 13:50:11 MSK
На данный момент нет возможности настроить параметр монтирования luks-разделов --allow-discards.
Поэтому практически невозможно использовать корневой раздел на ssd без использования обходных путей типа:

diff --git a/data/lib/initrd/handlers/050-luks b/data/lib/initrd/handlers/050-luks
index 6a013ff..7deac8b 100755
--- a/data/lib/initrd/handlers/050-luks
+++ b/data/lib/initrd/handlers/050-luks
@@ -63,11 +63,11 @@ handler() {
        if [ -n "${LUKS_KEY-}" ]; then
                findkey "$nameluks"
                readkey "$nameluks" |
-                       cryptsetup --allow-discards -d- luksOpen "$LUKS_ROOT" "$nameluks"
+                       cryptsetup -d- luksOpen "$LUKS_ROOT" "$nameluks"
        else
                rc=2
                while [ "$rc" = 2 ]; do
-                       cryptsetup --allow-discards -d- luksOpen "$LUKS_ROOT" "$nameluks"
+                       cryptsetup -d- luksOpen "$LUKS_ROOT" "$nameluks"
                        rc="$?"
                done
        fi
Comment 1 Michael Shigorin 2017-01-10 14:01:22 MSK
Спасибо!  А можно ещё дооформить патч до коммита и приложить?
(git format-patch HEAD^ в помощь)
Comment 2 aebirukov 2017-01-10 14:15:29 MSK
Created attachment 6928 [details]
Патч для установки параметра по умолчанию.
Comment 3 Michael Shigorin 2017-01-10 14:25:15 MSK
Просьба проверить http://webery.altlinux.org/task/176003 после сборки.

На всякий цитирую соответствующие фрагменты cryptsetup(8):

---
              WARNING: Option --allow-discards cannot be combined with  option
              --tcrypt-hidden.  For normal mapping it can cause destruction of
              hidden volume (hidden volume appears as unused space  for  outer
              volume so this space can be discarded).
[...]
       --allow-discards
              Allow the use of  discard  (TRIM)  requests  for  device.   This
              option is only relevant for open action.

              WARNING:  This  command  can  have  a  negative  security impact
              because it can make filesystem-level operations visible  on  the
              physical  device.  For  example,  information leaking filesystem
              type, used space, etc. may  be  extractable  from  the  physical
              device  if  the  discarded  blocks  can  be located later. If in
              doubt, do not use it.

              A kernel version of 3.1 or later is needed. For earlier  kernels
              this option is ignored.
---
Comment 4 Alexey Gladkov 2017-01-10 15:48:51 MSK
Я бы сделал флаг, который высталяется через initrd.mk или же позволить передавать произвольные параметры.
Comment 5 Alexey Gladkov 2018-04-23 18:36:58 MSK
2.0.7-alt1

- Add initrd-extract to split initramfs.
- Add feature to save information about generated initramfs.
- Feature make-initrd-ucode requires cpio (ALT#34270).
- LUKS feature changes:
  + Add luks-ignore option (thx Vladimir D. Seleznev).
  + Add luks-discard option (thx Vladimir D. Seleznev).
  + Add support for xts blockcipher (thx Vladimir D. Seleznev).
  + Add luks-key-format option.