Re: [PATCH 1/7] liblockdep: Fix undefined symbol prandom_u32

From: Sasha Levin
Date: Tue Jun 14 2016 - 17:31:47 EST


On 06/14/2016 04:47 PM, Ben Hutchings wrote:
> __lock_pin_lock() now calls prandom_u32() which is not defined in
> liblockdep. __lock_pin_lock() and its caller lock_pin_lock() are dead
> code in liblockdep, but we still need to provide a definition of
> prandom_u32() in case lazy binding is disabled.
>
> Fixes: e7904a28f533 ("locking/lockdep, sched/core: Implement a better ...")
> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
> ---
> tools/lib/lockdep/common.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c
> index d1c89cc06f5f..405c17667c4d 100644
> --- a/tools/lib/lockdep/common.c
> +++ b/tools/lib/lockdep/common.c
> @@ -1,5 +1,6 @@
> #include <stddef.h>
> #include <stdbool.h>
> +#include <stdlib.h>
> #include <linux/compiler.h>
> #include <linux/lockdep.h>
> #include <unistd.h>
> @@ -10,6 +11,11 @@ static __thread struct task_struct current_obj;
> /* lockdep wants these */
> bool debug_locks = true;
> bool debug_locks_silent;
> +u32 prandom_u32(void)
> +{
> + /* Used only by lock_pin_lock() which is dead code */
> + abort();
> +}

I had to place this bit in lockdep.c rather than common.c, since lockdep.c
is the one building kernel/lockdep.c.


Thanks,
Sasha


Attachment: signature.asc
Description: OpenPGP digital signature