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] [thread-next>] [day] [month] [year] [list]
Message-ID: <9527f084-4d60-2a85-f4e3-8e16cf7aad08@oracle.com>
Date:   Thu, 2 Sep 2021 10:11:11 +1000
From:   imran.f.khan@...cle.com
To:     Vlastimil Babka <vbabka@...e.cz>, geert@...ux-m68k.org,
        akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        Alexander Potapenko <glider@...gle.com>
Subject: Re: [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack
 entries.

Hi Vlastimil,

On 1/9/21 7:07 pm, Vlastimil Babka wrote:
> On 9/1/21 07:19, Imran Khan wrote:
>> To print a stack entries, users of stackdepot, first
>> use stack_depot_fetch to get a list of stack entries
>> and then use stack_trace_print to print this list.
>> Provide a helper in stackdepot to print stack entries
>> based on stackdepot handle.
>>
>> Signed-off-by: Imran Khan <imran.f.khan@...cle.com>
>> Suggested-by: Vlastimil Babka <vbabka@...e.cz>
> 
> You should convert existing users together with the patch that introduces
> the helper. I think print_stack() in mm/kasan/report.c, and
> __dump_page_owner() could use this.
> 

Okay. I have done this in v2 of the patch set. BTW I also see some users 
(one place in page owner, rest all in some gpu drivers) of 
stack_depot_fetch + stack_trace_snprintf. Could you please let me know 
if it would be okay to add a helper corresponding to 
stack_trace_snprintf as well.

>> ---
>>   lib/stackdepot.c | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
> 
> It's missing a declaration in include/linux/stackdepot.h
> Perhaps it could be all be a static inline there anyway.
> 

Agree. I have added missing declaration now. I have not made it inline
though.
>> diff --git a/lib/stackdepot.c b/lib/stackdepot.c
>> index 1d42ef9ef766..eab4476b060b 100644
>> --- a/lib/stackdepot.c
>> +++ b/lib/stackdepot.c
>> @@ -214,6 +214,23 @@ static inline struct stack_record *find_stack(struct stack_record *bucket,
>>   	return NULL;
>>   }
>>   
>> +/**
>> + * stack_depot_print - print stack entries from a depot
>> + *
>> + * @handle:		Stack depot handle which was returned from
>> + *			stack_depot_save().
>> + *
>> + */
>> +void stack_depot_print(depot_stack_handle_t stack)
>> +{
>> +	unsigned long *entries;
>> +	unsigned int nr_entries;
>> +
>> +	nr_entries = stack_depot_fetch(stack, &entries);
>> +	stack_trace_print(entries, nr_entries, 0);
>> +}
>> +EXPORT_SYMBOL_GPL(stack_depot_print);
>> +
>>   /**
>>    * stack_depot_fetch - Fetch stack entries from a depot
>>    *
>>
> 

Thanks again for the review.

--Imran

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ