Project

General

Profile

Actions

Issue #2104

closed

Port the Replicant 6.0 fix for the Galaxy S III eMMC corruption bug in Replicant >= 9 kenrel

Added by Denis 'GNUtoo' Carikli over 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
08/05/2020
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed
Device:
Galaxy S 3 (I9300), Galaxy S 3 4G (I9305)
Grant:
Type of work:
C programming
Actions #1

Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Subject changed from Investigate if the eMMC bug is fixed in Linux to Investigate if the Galaxy SIII eMMC corruption bug is also fixed in Linux upstream or just in SMDK4412
  • Do we need to add quirks upstream, or is it already done?
  • What does the smdk4412 kernel does to avoid triggering that bug?
Actions #2

Updated by dl lud over 3 years ago

The commit that fixes the eMMC failure in the smdk4412 kernel is this one: da8461692362317a8ffce4d4646953985fcf4e1d

The eMMC sudden death research thread at xda tries to explain this patch.

Actions #3

Updated by dl lud over 3 years ago

  • Subject changed from Investigate if the Galaxy SIII eMMC corruption bug is also fixed in Linux upstream or just in SMDK4412 to Investigate if the Galaxy S III eMMC corruption bug is fixed in upstream Linux
  • Device Galaxy S 3 (I9300) added
  • Device deleted (Unknown)

Also note that the proper fix for the bug comes in a firmware update for the eMMC chip. Devices running the 0xF7 version of the VTU00M firmware should be ok and won't need a patched kernel.

Actions #4

Updated by Denis 'GNUtoo' Carikli over 3 years ago

Thanks. It describes things that the eMMC hacking, or: how I fixed long-dead Galaxy S3 phones talk doesn't like the smart report.

Actions #5

Updated by Denis 'GNUtoo' Carikli over 3 years ago

There is a link of eMMC fimrware bugs from the former CyanogenMod wiki here: https://undocumented.software/wiki_dump/EMMC_Bugs.html

Actions #6

Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Target version changed from replicant 10.0 to Replicant 11.0 0001
Actions #7

Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Subject changed from Investigate if the Galaxy S III eMMC corruption bug is fixed in upstream Linux to Investigate if the Galaxy S III eMMC corruption bug is fixed in upstream Linux and if not port the Replicant 6.0 fix
Actions #8

Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Device Galaxy S 3 4G (I9305) added
Actions #9

Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Subject changed from Investigate if the Galaxy S III eMMC corruption bug is fixed in upstream Linux and if not port the Replicant 6.0 fix to Port the Replicant 6.0 fix for the Galaxy S III eMMC corruption bug in Replicant >= 9 kenrel
Actions #10

Updated by Denis 'GNUtoo' Carikli over 3 years ago

The bug is not fixed upstream, so we at least need to port it in our kernels not to brick any devices.

On the GT-I9300, the bugfix isn't great as it's just patch to hang the eMMC when it's about to create corruption, but not having that patch would be way worse.

We also might want to warn users if they have affected eMMC firmwares or not.

Actions #11

Updated by _I3^ RELATIVISM about 3 years ago

  • Type of work C programming added
Actions #12

Updated by Denis 'GNUtoo' Carikli over 2 years ago

I've done a bit more research on the bug to see how to upstream that patch:
  • In mmc_start_movi_smart, it seems to enter enters some "Smart Report mode1" to check a date.
  • There are MMC quirks too but the defines are in include/linux. We might be able to call it MMC_QUIRK_VT00M_0xF1_20120413_BUG or something like that as the bug causes some corruption in the FTL metadata which then crashes the eMMC CPU at the next boot. This patch just patches the eMMC firmware in RAM to make the eMMC CPU hang (by looping infinitely) when the corruption is about to happen. So we also need to do it before Linux gives access to the eMMC to userspace.
  • In the presentation about resurecting i9300, the presenter said that he didn't investigate the cause of the bug enough to be able to produce a patched firmware where it is really fixed (instead of being workarounded with that Samsung patch). So without more information we probably need to stick to just patching the eMMC RAM in the same way but integrating it better with the quirk system that is already in place in Linux to enable upstream to accept it.

1 https://android.googlesource.com/kernel/omap.git/+/7ec52272f810bd941af58ec87554e201d146934b/drivers/mmc/core/quirks.c

Actions #13

Updated by Denis 'GNUtoo' Carikli over 2 years ago

  • Status changed from New to Resolved
  • Resolution set to fixed

Since Belgin ported the patch, and that I now pushed it, we can consider it as fixed.

Another bug (#2267) has been opened for upstreaming that patch.

Thanks a lot for the patch.

I'll also update the wiki to not warn about it anymore, or at least not in the same way.

Actions

Also available in: Atom PDF