[PATCH] powerpc: Don't print kernel instructions in show_user_instructions()

Michael Ellerman mpe at ellerman.id.au
Mon Oct 8 19:12:07 AEDT 2018


Christophe LEROY <christophe.leroy at c-s.fr> writes:
> Le 05/10/2018 à 15:21, Michael Ellerman a écrit :
>> Recently we implemented show_user_instructions() which dumps the code
...
>> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
>> index 913c5725cdb2..bb6ac471a784 100644
>> --- a/arch/powerpc/kernel/process.c
>> +++ b/arch/powerpc/kernel/process.c
>> @@ -1306,6 +1306,16 @@ void show_user_instructions(struct pt_regs *regs)
>>   
>>   	pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));
>>   
>> +	/*
>> +	 * Make sure the NIP points at userspace, not kernel text/data or
>> +	 * elsewhere.
>> +	 */
>> +	if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {
>> +		pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
>> +			current->comm, current->pid);
>> +		return;
>> +	}
>> +
>
> This will conflict with my serie 
> https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=64611 
> which changes instructions_to_print to a constant. Will you merge it or 
> do you expect me to rebase my serie ?

I can fix it up.

But I see you've already rebased it and resent, you're too quick for me :)

cheers


More information about the Linuxppc-dev mailing list