С find
и однолинейным:
find. -mindepth 2 -type f -execdir sh -c 'mv -vt../ "$@" ; rmdir "$PWD"' _ {} +
-mindepth 2
позволит команде find
игнорировать файлы текущих каталогов. -execdir
это важно здесь, и это заставляет find
изменить текущий каталог на каталог, в котором найден файл, и команды внутри будут выполняться в самом этом каталоге.
mv -vt../ "$@"
, это расширится доmv -vt../ "file1" "file 2" "..." "fileN"
rmdir "$PWD"
удалит каталог, в котором находится -execdir
, который запустится после того, как все файлы будут перемещены в parentDirectory . Будьте осторожны, вы не перезапишете файлы с тем же именем файла при переходе по пути назначения.
Я немного покопался, и эта уязвимость в документации упоминается как:
На самом деле я нашел документацию по ядру напрямую , цитата:
l1tf= [X86] Control mitigation of the L1TF vulnerability on
affected CPUs
The kernel PTE inversion protection is unconditionally
enabled and cannot be disabled.
full
Provides all available mitigations for the
L1TF vulnerability. Disables SMT and
enables all mitigations in the
hypervisors, i.e. unconditional L1D flush.
SMT control and L1D flush control via the
sysfs interface is still possible after
boot. Hypervisors will issue a warning
when the first VM is started in a
potentially insecure configuration,
i.e. SMT enabled or L1D flush disabled.
full,force
Same as 'full', but disables SMT and L1D
flush runtime control. Implies the
'nosmt=force' command line option.
(i.e. sysfs control of SMT is disabled.)
flush
Leaves SMT enabled and enables the default
hypervisor mitigation, i.e. conditional
L1D flush.
SMT control and L1D flush control via the
sysfs interface is still possible after
boot. Hypervisors will issue a warning
when the first VM is started in a
potentially insecure configuration,
i.e. SMT enabled or L1D flush disabled.
flush,nosmt
Disables SMT and enables the default
hypervisor mitigation.
SMT control and L1D flush control via the
sysfs interface is still possible after
boot. Hypervisors will issue a warning
when the first VM is started in a
potentially insecure configuration,
i.e. SMT enabled or L1D flush disabled.
flush,nowarn
Same as 'flush', but hypervisors will not
warn when a VM is started in a potentially
insecure configuration.
off
Disables hypervisor mitigations and doesn't
emit any warnings.
It also drops the swap size and available
RAM limit restriction on both hypervisor and
bare metal.
Default is 'flush'.
For details see: Documentation/admin-guide/hw-vuln/l1tf.rst
Я попробовал некоторые из этих вариантов, в итоге выбрав full,force
. Но это только мой личный выбор.
Если вы сейчас спрашиваете, как использовать (, что редактировать ), то ответ будет:
Отредактируйте следующий файл в своем любимом текстовом редакторе:
/etc/default/grub
Добавьте одну из опций, например позвольте мне использовать l1tf=full,force
, в эту строку:
GRUB_CMDLINE_LINUX_DEFAULT="... l1tf=full,force"
Обновите конфигурацию загрузчика с помощью:
sudo update-grub
Изменения вступают в силу после перезагрузки:
reboot --reboot
Если вы решите продолжить тестирование этого решения, вы должны получить аналогичные результаты:
CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: Mitigation: PTE Inversion; VMX: cache flushes, SMT disabled
* This system is a host running a hypervisor: YES (paranoid mode)
* Mitigation 1 (KVM)
* EPT is disabled: NO
* Mitigation 2
* L1D flush is supported by kernel: YES (found flush_l1d in /proc/cpuinfo)
* L1D flush enabled: YES (unconditional flushes)
* Hardware-backed L1D flush supported: YES (performance impact of the mitigation will be greatly reduced)
* Hyper-Threading (SMT) is enabled: NO
> STATUS: NOT VULNERABLE (L1D unconditional flushing and Hyper-Threading disabled are mitigating the vulnerability)
Изображение в формате UHD можно увеличить:
Также стоит прочитать специальнуюдокументацию ядра L1TF -, в которой подробно описаны уязвимости и способы их устранения, а также объясняется, как включать и отключать средства устранения (, включая отключение SMT)во время выполнения. , без перезагрузки или изменения конфигурации системы.