[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <737ddf72-05f4-a47e-c901-fec5b1dfa7a6@mentor.com>
Date: Mon, 18 Jul 2022 19:08:04 +0100
From: Jim Baxter <jim_baxter@...tor.com>
To: Roberto Sassu <roberto.sassu@...wei.com>,
Eugeniu Rosca <erosca@...adit-jv.com>
CC: Rob Landley <rob@...dley.net>, "hpa@...or.com" <hpa@...or.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Arvind Sankar <nivedita@...m.mit.edu>,
Mimi Zohar <zohar@...ux.ibm.com>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
"initramfs@...r.kernel.org" <initramfs@...r.kernel.org>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bug-cpio@....org" <bug-cpio@....org>,
"zohar@...ux.vnet.ibm.com" <zohar@...ux.vnet.ibm.com>,
Silviu Vlasceanu <Silviu.Vlasceanu@...wei.com>,
Dmitry Kasatkin <dmitry.kasatkin@...wei.com>,
"takondra@...co.com" <takondra@...co.com>,
"kamensky@...co.com" <kamensky@...co.com>,
"arnd@...db.de" <arnd@...db.de>,
"james.w.mcmechan@...il.com" <james.w.mcmechan@...il.com>,
"linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
Dirk Behme <dirk.behme@...bosch.com>,
Eugeniu Rosca <roscaeugeniu@...il.com>
Subject: Re: [PATCH v4 0/3] initramfs: add support for xattrs in the initial
ram disk
Best regards,
*Jim Baxter*
Siemens Digital Industries Software
Automotive Business Unit
DI SW STS ABU
UK
Tel.: +44 (161) 926-1656
mailto:jim.baxter@...mens.com <mailto:jim.baxter@...mens.com>
sw.siemens.com <https://sw.siemens.com/>
On 18/07/2022 17:49, Roberto Sassu wrote:
>> From: Jim Baxter [mailto:jim_baxter@...tor.com]
>> Sent: Monday, July 18, 2022 6:36 PM
>>
>>
>> Hello,
>>
>> I have been testing these patches and do not see the xattr information when
>> trying to retrieve it within the initramfs, do you have an example of how
>> you tested this originally?
>
> Hi Jim, all
>
> apologies, I didn't find yet the time to look at this.
Hello Roberto,
Thank you for your response, I can wait until you have looked at the patches,
I asked the question to make sure it was not something wrong in my
configuration.
>
> Uhm, I guess this could be solved with:
>
> https://github.com/openeuler-mirror/kernel/commit/18a502f7e3b1de7b9ba0c70896ce08ee13d052da
>
> and adding initramtmpfs to the kernel command line. You are
> probably using ramfs, which does not have xattr support.
>
Thank you, I have tested that patch but the problem remained. Here is my
command line, I wonder if there is something wrong.
Kernel command line: rw rootfstype=initramtmpfs root=/dev/ram0 initrd=0x500000000 rootwait
I also found that root is always mounted as rootfs in my initramfs system
which I understood to be tmpfs, is that incorrect?
sh-3.2# mount
none on / type rootfs (rw)
>> So far I have set the xattr in the rootfs before creating the cpio file like this:
>> $ setfattr -n user.comment -v "this is a comment" test.txt
>> If I access the data here it works:
>> $ getfattr test.txt
>> # file: test.txt
>> user.comment
>>
>>
>> Then I package it and try to verify it with this command:
>> $getfattr /test.txt
>
> I assume you try to pack/unpack, right? If I remember correctly
> I only implemented the pack part. Unpacking is done by the kernel
> (but you are right, it should be done by user space too).
>
I modified the file before packing. To pack I use the following commands:
$ ./usr/gen_initramfs.sh -l initramfs.list -e xattr ../rootfs > initramfs.cpio
$ gzip initramfs.cpio
$ mkimage -A arm64 -O linux -T ramdisk -d initramfs.cpio.gz uRamdisk
The kernel is loaded using:
booti ${kernaddr} ${initramaddr} ${dtbaddr}
>> Which returns to the command line without the data.
>>
>>
>>
>> I believe the cpio is working because I see the file /METADATA\!\!\! in
>> the target root filesystem, which shows the following when viewed with cat -e:
>> 00000028^A^Auser.comment^@...s is a comment
>>
>> This matches the data I fed in at the start, so I believe the data is being
>> transferred correctly but I am accessioning it with the wrong tools.
>
> Yes, xattrs are marshalled in the METADATA!!! file, one per regular file
> xattrs are applied to. Xattrs are applied to the previous regular file.
> That file name was preferred to adding a suffix to the file, to avoid
> reaching the filename size limit.
>
> Roberto
Best regards,
Jim
Powered by blists - more mailing lists