lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJWu+orswdMT353AvkzOtjkiRT_B95-zg5CN1xE3ZFOaJr24Ag@mail.gmail.com>
Date:   Mon, 9 Oct 2017 12:21:46 -0700
From:   Joel Fernandes <joelaf@...gle.com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Joel Fernandes <joelaf@...gle.com>,
        Jessica Yu <jeyu@...nel.org>
Subject: Re: [PATCH v2] ftrace: Clear hashes of stale ips of init memory

On Mon, Oct 9, 2017 at 12:11 PM, Joel Fernandes <joelaf@...gle.com> wrote:
> On Mon, Oct 9, 2017 at 11:53 AM, Joel Fernandes <joelaf@...gle.com> wrote:
> [..]
>> +
>>  void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
>>  {
>>         unsigned long start = (unsigned long)(start_ptr);
>> @@ -6076,8 +6135,12 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
>>         struct dyn_ftrace *rec;
>>         struct dyn_ftrace key;
>>         struct ftrace_mod_map *mod_map = NULL;
>> +       struct ftrace_init_func *func, *func_next;
>> +       struct list_head clear_hash;
>>         int order;
>>
>> +       INIT_LIST_HEAD(&clear_hash);
>> +
>>         key.ip = start;
>>         key.flags = end;        /* overload flags, as it is unsigned long */
>>
>> @@ -6102,6 +6165,9 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
>>                 if (!rec)
>>                         continue;
>>
>> +               /* rec will be cleared from hashes after ftrace_lock unlock */
>> +               add_to_clear_hash_list(&clear_hash, rec);
>> +
>>                 if (mod_map)
>>                         save_ftrace_mod_rec(mod_map, rec);
>>
>> @@ -6123,6 +6189,11 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
>>                 goto again;
>>         }
>>         mutex_unlock(&ftrace_lock);
>> +
>> +       list_for_each_entry_safe(func, func_next, &clear_hash, list) {
>
> I think I screwed this list_for_each_entry up! Please ignore this
> revision, I'll send another patch revision shortly.

Actually, its correct. I got confused with how
list_for_each_entry_safe's terminating condition is defined:

&pos->member != (head)

I thought head itself had to be an entry's member, but here the
pointer offset is calculated and will take care of the termination so
its fine.

Sorry about the noise!

thanks,

- Joel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ