Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 Feb 2021 17:06:13 +0800 (CST)
From: youyan <hyouyan@....com>
To: lkrg-users@...ts.openwall.com
Subject: feedback about lkrg porting to qcm2150&SL8541E android 10

Hi admins
Thanks admins for supporting me porting lkrg to android, specify thanks Adam. After a few months stability test, LKRG already run well on my android device.
Now, I want to feedback the issue which I met during the period of porting and stability testing, and some fix solution which may not be a good way,just for reference。
1:freeze userspace timeout lead to app anr
(1) At some situation,some thread block all signals(for example qcom TEE driver,use sigprocmask(SIG_SETMASK, &new_sigset, &old_sigset))
(2) qcom TEE driver must wait qcom TEE user application to send notify to restore the signal(sigprocmask(SIG_SETMASK, &old_sigset, NULL);)
(3) insmod lkrg module,code run on P_SYM(p_freeze_processes)(). which will freeze qcom TEE user application.
(4) above situation will lead to freeze processes timeout, timeout time is 20s. However, android anr time is 5s. So frezze timeout will lead some proccess crash.


    My fix solution:
     Before freeze processes,start hrtimer. Timer handle will be execed 500ms later. when timer handle  exec will check if freeze processes is sucessful. If not sucessful,cancel freeze processes. 
      if(freeze_successful==0)
{
p_print_log(P_LKRG_CRIT, "freeze proccess has some problem  00...\n");
pm_system_wakeup();
hrtimer_forward_now(timer, ms_to_ktime(500));
ret = HRTIMER_RESTART;
}


    2: The number of exit threads exceed 40,cause kernel crash
     (1) When system boot, or system abnormal, at this time a lot of threads exit. 
     (2)The number of exit threads exceed 40.
     (3) A thread is running on code do exit(do_exit), at the same time, lkrg is checking all process(p_cmp_tasks),may cause kernel null pointer crash。


   My fix solution:
   temporarily increase  kretprobe maxactive。
   3: CONFIG_OPTPROBES=y will lead insmod lkrg module more slowly
        when kernel config have  CONFIG_OPTPROBES=y, finish insmod lkrg module will need more time.
   My fix solution:
        before insmod lkrg,turn off optimization by echo 0 to /proc/sys/debug/kprobes-optimization


    4:Calculate kernel text and ro data, lock irq may lead some thread or interrupt can not process in time
    Calculate kernel text and ro data need 100ms(more or less) on qcm2150&SL8541E,  lock irq 100ms may lead some thread or interrupt can not process in time
   My fix solution:
       temporarily disable Calculate kernel text and ro data.
    5:mutex_lock() lead to kernel report bug crash
      when kernel config have CONFIG_DEBUG_ATOMIC_SLEEP=y,  schedule on atmoic context may cause kernel report bug crash,for example turn off selinux(setenforce 0).
    My fix solution:
      not very good way at this time,write some mutex code by myself, the function just do not have schedule on atmoic context








thanks and best regards
ethan


     


        
     








Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.