Comment 55 for bug 1797581

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

echo -n 'BOOT_IMAGE=http://10.10.101.2:5248/images/ubuntu/amd64/generic/bionic/daily/boot-kernel nomodeset ro root=squash:http://10.10.101.2:5248/images/ubuntu/amd64/generic/bionic/daily/squashfs ip=::::maas-vhost6:BOOTIF ip6=off overlayroot=tmpfs overlayroot_cfgdisk=disabled cc:{'datasource_list': ['MAAS']}end_cc cloud-config-url=http://10.10.101.2:5248/MAAS/metadata/latest/by-id/xeqrrw/?op=get_preseed apparmor=0 log_host=10.10.101.2 log_port=5247 --- console=ttyS0,115200 initrd=http://10.10.101.2:5248/images/ubuntu/amd64/generic/bionic/daily/boot-initrd BOOTIF=01-52-54-00-3f-ae-46' | wc -c
576

arch/x86/include/asm/setup.h:

#define COMMAND_LINE_SIZE 2048
#define PARAM_SIZE 4096 /* sizeof(struct boot_params) */

Doesn't look like we are any close to the kernel limits on parameters.

However, the root argument as printed in the panic message looks like a 64-byte string (last byte for null termination):

echo -n 'squash:http://10.10.101.2:5248/images/ubuntu/amd64/generic/bion' | wc -c
63

It looks like this is coming from the following code (strlcpy into a 64-byte array):

https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic/tree/init/do_mounts.c?id=Ubuntu-4.15.0-47.50#n42

static char __initdata saved_root_name[64];

static int __init root_dev_setup(char *line)
{
 strlcpy(saved_root_name, line, sizeof(saved_root_name));
 return 1;
}

__setup("root=", root_dev_setup);

And the overall code-path (judging by the md auto-detection log messages):

https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic/tree/init/do_mounts.c?id=Ubuntu-4.15.0-47.50#n545
prepare_namespace ->

 if (saved_root_name[0]) {
  root_device_name = saved_root_name; // <---- (!) usage of a cut-down root param
  if (!strncmp(root_device_name, "mtd", 3) ||
      !strncmp(root_device_name, "ubi", 3)) {
   mount_block_root(root_device_name, root_mountflags);

Does not look like we are hitting either EACCES or EINVAL and so we fall through to panic():

https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic/tree/init/do_mounts.c?id=Ubuntu-4.15.0-47.50#n381
void __init mount_block_root(char *name, int flags)
// ...
 for (p = fs_names; *p; p += strlen(p)+1) {
  int err = do_mount_root(name, p, flags, root_mount_data);
  switch (err) {
   case 0:
    goto out;
   case -EACCES:
   case -EINVAL:
    continue;
  }
         /*
   * Allow the user to distinguish between failed sys_open
   * and bad superblock on root device.
   * and give them a list of the available devices
   */
#ifdef CONFIG_BLOCK
  __bdevname(ROOT_DEV, b);
#endif
  printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
    root_device_name, b, err);
  printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");

  printk_all_partitions();
#ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
  printk("DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify "
         "explicit textual name for \"root=\" boot option.\n");
#endif
  panic("VFS: Unable to mount root fs on %s", b);