]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm-verity: restart or panic on an I/O error
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 24 Sep 2024 13:18:29 +0000 (15:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:47 +0000 (16:33 +0200)
commit4a7677a15469852a8ddb8c945189efd9deb01b25
treea5484663032ea98a4e97f5e4315900c96f6b1390
parentc98a910c64ef85ba67faf5b8e6c281c360942953
dm-verity: restart or panic on an I/O error

commit e6a3531dd542cb127c8de32ab1e54a48ae19962b upstream.

Maxim Suhanov reported that dm-verity doesn't crash if an I/O error
happens. In theory, this could be used to subvert security, because an
attacker can create sectors that return error with the Write Uncorrectable
command. Some programs may misbehave if they have to deal with EIO.

This commit fixes dm-verity, so that if "panic_on_corruption" or
"restart_on_corruption" was specified and an I/O error happens, the
machine will panic or restart.

This commit also changes kernel_restart to emergency_restart -
kernel_restart calls reboot notifiers and these reboot notifiers may wait
for the bio that failed. emergency_restart doesn't call the notifiers.

Reported-by: Maxim Suhanov <dfirblog@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-verity-target.c