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]
Date:	Wed, 7 Jan 2015 18:34:00 +0800
From:	Wang Nan <wangnan0@...wei.com>
To:	Hillf Danton <hillf.zj@...baba-inc.com>
CC:	<linux@....linux.org.uk>, "'Ingo Molnar'" <mingo@...hat.com>,
	<masami.hiramatsu.pt@...achi.com>,
	<anil.s.keshavamurthy@...el.com>, <davem@...emloft.net>,
	<ananth@...ibm.com>, <dave.long@...aro.org>, <tixy@...aro.org>,
	<lizefan@...wei.com>,
	"'linux-kernel'" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 09/11] kprobes: core logic of eraly kprobes

On 2015/1/7 18:02, Hillf Danton wrote:
>>>>
>>>> +struct early_kprobe_slot {
>>>> +	struct optimized_kprobe op;
>>>> +};
>>>> +
>>> [...]
>>>>
>>>>  /* Free optimized instructions and optimized_kprobe */
>>>> +static int ek_free_early_kprobe(struct early_kprobe_slot *slot);
>>>
>>> [2] How is it implemented? In subsequent patches?
>>>
>>
>> It is implemented using macro. Please see patch 7/11 and
>>
>> DEFINE_EKPROBE_ALLOC_OPS(struct early_kprobe_slot, early_kprobe, static);
>>
> What is the reason that it is listed in C file, given that it is done in H already?
> 

This macro defines an array and a bitmap, not only declare them. In addition,
the functions defined by it are used only in this specific .c file.

If there are not only one .c files use it, I think patch 7 can be improved:

#define DEFINE_EKPROBE_AREA(__t, __static)				\
__static __t __ek_##__name##_slots[NR_EARLY_KPROBES_SLOTS];		\
__static unsigned long __ek_##__name##_bitmap[EARLY_KPROBES_BITMAP_SZ];

#define DEFINE_EKPROBE_ALLOC_OPS(__t, __name, __static)			\
DEFINE_EKPROBE_AREA(__t, __static)					\
__DEFINE_EKPROBE_ALLOC_OPS(__t, __name)					\
static inline __t *ek_alloc_##__name(void)				\
{									\
...

In .h file(s):
DEFINE_EKPROBE_ALLOC_OPS(struct early_kprobe_slot, early_kprobe, extern)

In .c file:
DEFINE_EKPROBE_AREA(__t, )

What do you think?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ