[Samsung Galaxy M30s Questions & Answers] superstarksa:
Hi,

My M30s started randomly restarting after a software update. I could not find solutions here when I searched but it appears a lot of people on the internet having been facing similar issues for quite a few months now. The Samsung community forums are full of multiple messages and Samsung is pushing people to get to their phones to the service centers and are getting the motherboards replaced for free if the warranty is valid (or at a cost of INR 9,000 otherwise).

In any case, I found another poster on the Samsung forums who seems much more tech savvy than I am. And he seems to have solved the problem on his phone by changing 2 lines of code in the Linux kernel wand rebuilding the OS afterward.

Like I said, I am not tech savvy enough for this, but I thought I would post the link here because I could not find this particular fix here.

Re: READ THIS IF YOUR SAMSUNG GALAXY M30S KEEPS RANDOMLY FREEZING AND RESTARTING AUTOMATICALLY

To add a bit of my research into this problem: My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the...

r2.community.samsung.com

(Here is the text from the post in case you are not able to open it)

-----------------------------------------------------------------------

To add a bit of my research into this problem:

My phone (SM-M307FN) is rebooting many times every single day due to a Linux kernel issue which has been already fixed a long time ago in the mainline version. I am still running Android 10, because that's the latest version (M307FNXXU2BTC6) of the OS Samsung has released on their open-source portal. I can use this source code to fix and rebuild the OS to prevent the issue from happening.

The issue and the fix is well known among the Samsung M30s community. It's two lines of code that need to be changed to prevent at least one of the common reasons for frequent reboots.

It takes a lot of work for a private user to fix those two lines of code, because Samsung releases source code that's non-trivial to compile and actually run on your device afterwards.

Samsung's Android 11 still ships with the same old kernel version (4.14.62) as their Android 9 (4.14.62), released back in 2018. There might have been some fixes between 4.14.62-19694174 and 4.14.62-20748039 introduced by Samsung in the meantime.

Regardless, this fix is

not

part of the source code for M307FNXXU2BTC6 (linked above) that's been released by Samsung in June 2020. Therefore, it doesn't seem like Samsung is actually applying all fixes to their kernels.

The kernel itself should have been upgraded to a higher version - at least to 4.19 - to fix bugs that's been plaguing users of Exynos 9611 chips running on Linux v4.14 for a long time.

Samsung: Please apply this fix to your Android kernels and push the update to your customers. Thank you!

References about the "fix NULL pointer deref in smaps_pte_range()":

Mainline Linux kernel fix:

[4.19,248/361] mm: /proc/pid/smaps_rollup: fix NULL pointer deref in smaps_pte_range()

https://lore.kernel.org/patchwork/patch/1010971/

Google Android Linux kernel backported this change in 2019 :

https://android.googlesource.com/kernel/common/+/043c92bd0517e0018cb6307390eb9c36b864fb9f

--------------------------------------------------------------------------------------

EDIT: After more hours of experimenting I have managed to compile a kernel with the patch mentioned in this post. I can confirm that I faced no reboots since I flashed my phone with this new kernel. Hence, I can confirm this fix really prevents frequent reboots.