Messages in this thread | | | Date | Tue, 11 Jun 2019 09:36:48 +0200 | From | Christoph Hellwig <> | Subject | Re: [PATCH 04/15] binfmt_flat: remove flat_old_ram_flag |
| |
On Tue, Jun 11, 2019 at 04:04:39PM +1000, Greg Ungerer wrote: >> index c0e4535dc1ec..18d82fd5f57c 100644 >> --- a/fs/binfmt_flat.c >> +++ b/fs/binfmt_flat.c >> @@ -488,7 +488,8 @@ static int load_flat_file(struct linux_binprm *bprm, >> * fix up the flags for the older format, there were all kinds >> * of endian hacks, this only works for the simple cases >> */ >> - if (rev == OLD_FLAT_VERSION && flat_old_ram_flag(flags)) >> + if (IS_ENABLED(CONFIG_BINFMT_FLAT_OLD_ALWAYS_RAM) && >> + rev == OLD_FLAT_VERSION) > > The flags are from the binary file header here, so this is going to lose > that check for most platforms (except h8300 where it would always have > been true).
Indeed. The old code is:
if (rev == OLD_FLAT_VERSION && flat_old_ram_flag(flags)) flags = FLAT_FLAG_RAM;
which for !h8300 evaluates to:
if (rev == OLD_FLAT_VERSION && flags) flags = FLAT_FLAG_RAM;
so basically if any flag was set it was turned into FLAT_FLAG_RAM. Was that really intentional? I guess even if it wasn't the is no point in changing this historic behavior now.
So I guess what we could do it something like:
if (rev == OLD_FLAT_VERSION && (flags || IS_ENABLED(CONFIG_BINFMT_FLAT_OLD_ALWAYS_RAM))) flags = FLAT_FLAG_RAM;
| |