All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitri John Ledkov <xnox@ubuntu.com>
To: Colin Watson <cjwatson@debian.org>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org
Subject: Re: ext4: Funny characters appended to file names
Date: Mon, 7 Dec 2020 02:00:42 +0000	[thread overview]
Message-ID: <CANBHLUjzMSvFmUD-vBxQdAcGuyjvQ1pBSP3DzphqvXNTc4MJPA@mail.gmail.com> (raw)
In-Reply-To: <20201206182748.GA30693@riva.ucam.org>

Hi,

On Sun, 6 Dec 2020, 18:28 Colin Watson, <cjwatson@debian.org> wrote:
>
> On Sun, Dec 06, 2020 at 02:44:16PM +0000, Colin Watson wrote:
> > So, in the RESTORE_BACKUP case, shouldn't that be:
> >
> >   char *dstf = grub_util_path_concat (2, di, de->d_name);
> >
> > ... rather than grub_util_path_concat_ext?  Otherwise it seems to me
> > that it's going to try to append an additional argument which doesn't
> > exist, and may well add random uninitialised stuff from memory.  Running
> > grub-install under valgrind would probably show this up (I can't get it
> > to do it for me so far, but most likely I just haven't set up quite the
> > right initial conditions).
>
> While I couldn't reproduce this on amd64 (and valgrind didn't show any
> errors), I can reproduce it just fine on i386, which is what Paul is
> using.  I guess the va_list layout in memory is different enough between
> the two ABIs to tickle this.
>

Indeed, my patch was not tested on i386 and has had limited reviews
before landing in Ubuntu. Still not reviewed on the upstream mailing
list.

I am sorry for causing this issue.

> I'll apply this patch for Debian grub2 2.04-11, which I've confirmed
> fixes it for me:
>
> diff --git a/util/grub-install-common.c b/util/grub-install-common.c
> index a883b6dae..61f9075bc 100644
> --- a/util/grub-install-common.c
> +++ b/util/grub-install-common.c
> @@ -247,7 +247,7 @@ clean_grub_dir_real (const char *di, enum clean_grub_dir_mode mode)
>             }
>           else if (mode == RESTORE_BACKUP)
>             {
> -             char *dstf = grub_util_path_concat_ext (2, di, de->d_name);
> +             char *dstf = grub_util_path_concat (2, di, de->d_name);
>               dstf[strlen (dstf) - 1] = 0;
>               if (grub_util_rename (srcf, dstf) < 0)
>                 grub_util_error (_("cannot restore `%s': %s"), dstf,
>
> Dimitri, I know Ubuntu isn't very interested in supporting i386, but IMO
> you should apply this patch to Ubuntu in any case; it might affect other
> architectures, and anyway leaving known undefined behaviour around isn't
> a good idea.
>

Will do. And will resend it to the grub mailing list.

> Paul, note that you'll also need to run "sudo rm -f
> /boot/grub/i386-pc/*.{img,lst,mo,mod,o,sh}-*" to clean up the stray
> files created by this bug.

Thank you everyone for the code review.

  reply	other threads:[~2020-12-07  2:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 14:30 ext4: Funny characters appended to file names Paul Menzel
2020-12-04 15:28 ` Theodore Y. Ts'o
2020-12-04 15:39   ` Paul Menzel
2020-12-04 18:05     ` Theodore Y. Ts'o
2020-12-05 19:34       ` Paul Menzel
2020-12-06 14:44         ` Colin Watson
2020-12-06 15:15           ` Theodore Y. Ts'o
2020-12-06 17:37             ` Colin Watson
2020-12-06 17:44               ` Colin Watson
2020-12-06 18:27           ` Colin Watson
2020-12-07  2:00             ` Dimitri John Ledkov [this message]
2020-12-04 20:02 ` Andreas Dilger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANBHLUjzMSvFmUD-vBxQdAcGuyjvQ1pBSP3DzphqvXNTc4MJPA@mail.gmail.com \
    --to=xnox@ubuntu.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=cjwatson@debian.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.