Re: [Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-13 Thread Rob Landley
On 2/13/21 1:35 AM, Yi-yo Chiang wrote: > Just found out this block of text from fscrypt manual > (https://elixir.bootlin.com/linux/v5.11-rc7/source/Documentation/filesystems/fscrypt.rst#L1066): >   > >>  The st_size of an encrypted symlink will not necessarily give the >>  length of the symlink t

Re: [Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-12 Thread Yi-yo Chiang via Toybox
Just found out this block of text from fscrypt manual ( https://elixir.bootlin.com/linux/v5.11-rc7/source/Documentation/filesystems/fscrypt.rst#L1066 ): > The st_size of an encrypted symlink will not necessarily give the > length of the symlink target as required by POSIX. It will actually > g

Re: [Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-08 Thread enh via Toybox
On Mon, Feb 8, 2021 at 2:06 AM Yi-yo Chiang via Toybox < toybox@lists.landley.net> wrote: > > > On Mon, Feb 8, 2021 at 5:19 PM Rob Landley wrote: > >> On 2/7/21 10:10 AM, Yi-Yo Chiang via Toybox wrote: >> > If file type is symlink and readlink() fails or returns unexpected link >> > size, then th

Re: [Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-08 Thread Yi-yo Chiang via Toybox
On Mon, Feb 8, 2021 at 5:19 PM Rob Landley wrote: > On 2/7/21 10:10 AM, Yi-Yo Chiang via Toybox wrote: > > If file type is symlink and readlink() fails or returns unexpected link > > size, then the file body wouldn't be written, resulting in a misaligned > > archive. > > Yup, misaligned archive i

Re: [Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-08 Thread Rob Landley
On 2/7/21 10:10 AM, Yi-Yo Chiang via Toybox wrote: > If file type is symlink and readlink() fails or returns unexpected link > size, then the file body wouldn't be written, resulting in a misaligned > archive. Yup, misaligned archive is definitely a bug. I wonder if I can reproduce it... > As exp

[Toybox] [PATCH] cpio: fix misaligned header if readlink() returns unexpected value

2021-02-07 Thread Yi-Yo Chiang via Toybox
If file type is symlink and readlink() fails or returns unexpected link size, then the file body wouldn't be written, resulting in a misaligned archive. As explained in the comments, there are some cases where the link size returned by lstat() and readlink() may be different. To accommodate this, w