lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce58178c-7f26-a9a1-443a-71577162c814@loongson.cn>
Date: Mon, 29 Apr 2024 17:29:02 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: James.Bottomley@...senPartnership.com, martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Problem and solution about SCSI configs

Hi all,

In the current code, if the rootfs is located on a SCSI device and root=
/dev/sda3 is specified as boot option in grub.cfg, kernel boots failed
with CONFIG_SCSI=y and CONFIG_BLK_DEV_SD=m when there is no initrd, here
are the boot messages via the serial console:

   /dev/root: Can't open blockdev
   VFS: Cannot open root device "/dev/sda3" or unknown-block(0,0): error -6
   Please append a correct "root=" boot option; here are the available 
partitions:
   ...
   Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)

Set CONFIG_BLK_DEV_SD=y can solve the above issue, but in order to avoid
the potential failure, it is better to restrict the configs.

Here are some backgrounds according to Documentation/scsi/scsi.rst and
drivers/scsi/Kconfig:

The SCSI support in the Linux kernel can be modularized in a number of
different ways depending upon the needs of the end user.

The scsi-core (also known as the "mid level") contains the core of SCSI
support. Without it you can do nothing with any of the other SCSI drivers.
The SCSI core support can be a module, or it can be built into the kernel.
If the core is a module, it must be the first SCSI module loaded, and if
you unload the modules, it will have to be the last one unloaded.

The individual upper and lower level drivers can be loaded in any order
once the SCSI core is present in the kernel (either compiled in or loaded
as a module). The disk driver, CD-ROM driver, tape driver and SCSI generics
driver represent the upper level drivers to support the various assorted
devices which can be controlled.  You can for example load the tape driver
to use the tape drive, and then unload it once you have no further need for
the driver (and release the associated memory).

However, do not compile the SCSI disk driver as a module if your root file
system is located on a SCSI device. In this case, do not compile the driver
for your SCSI host adapter as a module either.

That is to say, if you want to use an ATA hard disk as root device, config
ATA will be set as y and select CONFIG_SCSI, then CONFIG_BLK_DEV_SD should
be set as y and it can not be modified as m through the defconfig or make
menuconfig if CONFIG_SCSI is y, the simple way is to let CONFIG_SCSI select
CONFIG_BLK_DEV_SD if CONFIG_SCSI is y.

Could you please let me know are you OK with the following change?

-- >8 --
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 634f2f501c6c..3e59e3e59e79 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -25,6 +25,7 @@ config SCSI
         select SG_POOL
         select SCSI_COMMON
         select BLK_DEV_BSG_COMMON if BLK_DEV_BSG
+       select BLK_DEV_SD if SCSI=y
         help
           If you want to use a SCSI hard disk, SCSI tape drive, SCSI 
CD-ROM or
           any other SCSI device under Linux, say Y and make sure that 
you know

If yes, I will post a formal patch later.

Thanks,
Tiezhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ