Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2979129pxb; Mon, 6 Sep 2021 09:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2O7xc8f33gtia8shc4yyPdptuga51pgWilurIIiQ8N2IGVPwRLR+cZ57CN9q1T2TvsjQZ X-Received: by 2002:a05:6e02:1546:: with SMTP id j6mr8827796ilu.154.1630945761895; Mon, 06 Sep 2021 09:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630945761; cv=none; d=google.com; s=arc-20160816; b=FnDQHqnaHWGw9h5d79O328pWs7DAfRBk9t2XXBQVayR3t5SyLHi7nrJqzmdRZNj64c /awWhTn1MXZtUciyZtPYyQYnvRfhrnhR8+RJwh7HQbxM9t3qvwVHnnEAzMXE0WfuI+KH 5euzXRiQPTrB8f2fmIG6N/QwWZo3iJNq9UmPRjm+Nh9jcrQq0gXosNb2yKAjYA9DXmGq xZ2+Px/1nLxp35Ap+UlJ12l8KRT827MsP6rg9B/V23Euunt54NBAYQ+L+B43K3khUKOp 5YUQBVTLLyvf3HtBlSmiIgphnd3aOYoJ+4O9z04QGYP39OtGBrKaZKUoGWcoOXVCEbR9 ZuWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6oKyG7zEb/nW+FeiP30bM48MUXtoqIWfTDkbvnG8BkY=; b=KlscTHyMlC6IITFJPqeGkQwmn8KBMkK82RNGC7s/xdLR5EDBtx4GZUv1DDaIo9Q/Pl kfwY78+kuEd6lhXxqEh6osO1JHQs+dWIUmVBu8cNeyftwumtPuePaDaHjmEki5pQPYE4 Yf4cRVckWSS2972CAuTYFYhj16MV2EhRl+xWwtSooGXdlZVsqVJfkZGCIYayMABlSK2n Bu68yxAzoea+uSFLuptAeTDHJfSQs7dsGKSdSas7l602CcKzL3nC+oDPA8P8e6U4isDV gLbifvkTGqu4sSpZeFw7uJ7CR9W7sEUfkXBcx2aQCl/UMzwozcHmrSi/NVR1Mbw6bbZ2 xDhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="bszZ/g+T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p33si7904981jac.94.2021.09.06.09.29.09; Mon, 06 Sep 2021 09:29:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="bszZ/g+T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244063AbhIFQ30 (ORCPT + 99 others); Mon, 6 Sep 2021 12:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243784AbhIFQ3Z (ORCPT ); Mon, 6 Sep 2021 12:29:25 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF8CC061575; Mon, 6 Sep 2021 09:28:20 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id jg16so14493596ejc.1; Mon, 06 Sep 2021 09:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6oKyG7zEb/nW+FeiP30bM48MUXtoqIWfTDkbvnG8BkY=; b=bszZ/g+TVWRlcuLYrm4cp/AJpQzap4khelKGOFDxT37GwmFEI0nnoKH1mXocTABgEr kVhKcce52l+Bda2ODC/ZGHW8uZSxriuGwxC0LX48Hp8snUsmUVEXttz7mv959xm+oqyF bAg5uikiKTYSVezC6S3St86oKeK8d99jnXGqhATYzzcK2iRXCj37sVbgIQH+FlBFzMu7 qfs6jGjKM5o0LL9zRHBR73Sg1ZX0fRKN9P+K9qpA/WpYOc26ou7hAj7+mogNeb7JbXOf qOBWnKxn3Tz5Xu3MlM0GqX3FLeEaCgGOT/oL2MxPcb3m9e093RzGm+AL2OOUcvurFelA a4ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6oKyG7zEb/nW+FeiP30bM48MUXtoqIWfTDkbvnG8BkY=; b=RQF5n4tw1xWqkk4rzPzWEyh2JzDVcsAYgfmgM8t6MNtojeLof6lWYyOhKpYQIaxTCD oWYrTLaSaXNRTCXj6HqVSwCCnhnFv/9y8fe7OknO020aDpHQo++tF7V8ZlR6q8jFL8lw fxvAygjC2mBMkNEJBhzKoJaeljaVDd/Jo2hqA9LAlvYHBMICAMFXvMc2VcNdh1tu6tSh MNQ9rrk2BmDsC1bGrC0veODBa+9IJNKwfCwE4PRv/5aze1tVcJgRzxp7ksKnDikqfk8r GFC9qz7WJmFIkciqkDtU5LHkbZtGBacenrvmKnPhsByk7hPzy5BBDEjAYNR8orkjT2Co Y7Iw== X-Gm-Message-State: AOAM532dOsB6y4HLGqGMzJmugq+v842Bvp7yhhoPsCFm3COX3Q8SK7rP d+ANKAsmiBT83fpjToaMXTftaLLSJp949tYlcoo= X-Received: by 2002:a17:906:fb19:: with SMTP id lz25mr14543783ejb.162.1630945699450; Mon, 06 Sep 2021 09:28:19 -0700 (PDT) MIME-Version: 1.0 References: <20210830185541.715f6a39@windsurf> <20210830211224.76391708@windsurf> In-Reply-To: From: Pintu Agarwal Date: Mon, 6 Sep 2021 21:58:08 +0530 Message-ID: Subject: Re: Kernel 4.14: Using dm-verity with squashfs rootfs - mounting issue To: Thomas Petazzoni Cc: Mikulas Patocka , open list , Phillip Lougher , linux-fsdevel , linux-mtd , dm-devel@redhat.com, Kernelnewbies , agk@redhat.com, snitzer@redhat.com, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Thomas, Mikulas, Need your help in root causing my dm-verity issue with squashfs. Please see my comments inline. On Tue, 31 Aug 2021 at 18:49, Pintu Agarwal wrote: > > No, but you can backport it easily. Back at > > http://lists.infradead.org/pipermail/openwrt-devel/2019-November/025967.html > > I provided backports of this feature to OpenWrt, for the 4.14 and 4.19 > > kernels. > > > Yes, I can backport it to our 4.14 Kernel. > Can you share the list of patches to be backported to make it work on 4.14 ? > If it's backported also I need to report to our internal kernel, but > it might be slightly easier. > Please share the details. > I am interested to backport dm-mod.create related patches to our 4.14 kernel. Please let me know where can I find all the patches ? Is it already part of mainline 4.14 ? Please share the list of commits (from mainline) that we need to pull and backport. > > > Here is our kernel command line: > > > > > > [ 0.000000] Kernel command line: ro rootwait > > > console=ttyMSM0,115200,n8 .... verity="95384 11923 > > > 16da5e4bbc706e5d90511d2a3dae373b5d878f9aebd522cd614a4faaace6baa3 12026 > > > " rootfstype=squashfs ubi.mtd=40,0,30 ubi.block=0,0 root=/dev/dm-0 > > > .... init=/sbin/init root=/dev/dm-0 dm="rootfs none ro,0 95384 verity > > > 1 /dev/ubiblock0_0 /dev/mtdblock53 4096 4096 11923 8 sha256 > > > 16da5e4bbc706e5d90511d2a3dae373b5d878f9aebd522cd614a4faaace6baa3 > > > aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 10 > > > restart_on_corruption ignore_zero_blocks use_fec_from_device > > > /dev/mtdblock53 fec_roots 2 fec_blocks 12026 fec_start 12026" ... > > > > I don't see how this can work without the dm-mod.create feature. Are > > you sure the verity= and dm= kernel arguments exist? > I checked a little further and yes there is "dm=" command line in kernel available. This is already working with ext4 glue, but was never tried with squashfs. I think it is mainline derived from Android. https://patchwork.kernel.org/project/dm-devel/patch/2c01b2a43a46fab760208d7af3a7af37eec8c41a.1537936397.git.helen.koike@collabora.com/ https://github.com/projectceladon/device-androidia-kernel/blob/master/init/do_mounts_dm.c Mostly, this is the main repo where our source might be derived: https://github.com/android-linux-stable/msm-4.14 Can we backport the patches here ? If I get the list I can try it. > > Also, you mentioned: > >>> Here, it definitely worked to append the hash tree to the squashfs > >>> image and store them in the same partition. > Can you share some details about it ? > How it can be done since squashfs is readonly. Can you share your reference, how are you appending the hash tree ? Let me try the same. But it seems like the underlying concept is the same for both "dm-mod.create" and "dm=". However, I am not sure if there are any changes required for squashfs as block device.. Errors: Currently, we are getting this in boot logs: [ 4.962188] device-mapper: init: attempting early device configuration. [ 4.969699] device-mapper: init: created device '253:0' [ 4.975503] device-mapper: init: adding target '0 95384 verity 1 /dev/ubiblock0_0 /dev/mtdblock53 4096 4096 11923 8 sha256 8fc2e4bb751f4b3145a486a0f4f1b58149ba3eedc2a67312f31fbee131380dab aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 10 restart_on_corruption ignore_zero_blocks use_fec_from_device /dev/mtdblock53 fec_roots 2 fec_blocks 12026 fec_start 12026' [ 4.992323] device-mapper: verity: sha256 using implementation "sha256-generic" [ 5.015568] device-mapper: init: dm-0 is ready [ 10.080065] prepare_namespace: dm_run_setup - done [ 10.080093] prepare_namespace: saved_root_name: /dev/dm-0 [ 10.083903] prepare_namespace: Inside: name_to_dev_t [ 10.089605] prepare_namespace: Calling - mount_root() ... [ 10.094519] [PINTU]: mount_block_root: called with input name: /dev/root, fs_names: squashfs [ 10.263510] [PINTU]: do_mount_root: sys_mount failed: err: -22 [ 10.263544] [PINTU]: mount_block_root: do_mount_root: err: -22, p: squashfs, flags: 32769, root_mount_data: (null) [..] [ 10.745672] No filesystem could mount root, tried: [ 10.745676] squashfs [ 10.748015] [ 10.755232] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(253,0) It seems the rootfs could not mount due to invalid arguments. Not sure which arguments are invalid here... Thanks, Pintu