From: Colin Watson <cjwatson@debian.org>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
linux-ext4@vger.kernel.org, Dimitri John Ledkov <xnox@ubuntu.com>
Subject: Re: ext4: Funny characters appended to file names
Date: Sun, 6 Dec 2020 18:27:48 +0000 [thread overview]
Message-ID: <20201206182748.GA30693@riva.ucam.org> (raw)
In-Reply-To: <20201206144416.GM13361@riva.ucam.org>
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.
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.
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.
--
Colin Watson (he/him) [cjwatson@debian.org]
next prev parent reply other threads:[~2020-12-06 18:28 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 [this message]
2020-12-07 2:00 ` Dimitri John Ledkov
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=20201206182748.GA30693@riva.ucam.org \
--to=cjwatson@debian.org \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=tytso@mit.edu \
--cc=xnox@ubuntu.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox