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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 5 Aug 2020 08:26:00 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     peterz@...radead.org
Cc:     mingo@...hat.com, oleg@...hat.com, acme@...nel.org,
        jolsa@...nel.org, Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com,
        alexander.shishkin@...ux.intel.com, mark.rutland@....com,
        rth@...ddle.net, ink@...assic.park.msu.ru, mattst88@...il.com,
        nickhu@...estech.com, green.hu@...il.com, chris@...kel.net,
        jcmvbkbc@...il.com
Subject: Re: [PATCH v1 1/2] Missing instruction_pointer_set() instances

Hi Peter,

On 8/4/2020 7:31 PM, peterz@...radead.org wrote:
> On Fri, Jul 31, 2020 at 10:56:16AM +0800, Jin Yao wrote:
>> There is a potential security issue that perf kernel samples
>> may be leaked even though kernel sampling is disabled. For fixing
>> the potential leakage, the idea is to use instruction_pointer_set
>> to set invalid ip address in leaked perf samples in some cases.
>>
>> But instruction_pointer_set is missing on some architectures.
>> Define instruction_pointer_set for these architectures.
>>
>> Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
>> ---
>>   arch/alpha/include/asm/ptrace.h  | 6 ++++++
>>   arch/arc/include/asm/ptrace.h    | 6 ++++++
>>   arch/nds32/include/asm/ptrace.h  | 7 +++++++
>>   arch/xtensa/include/asm/ptrace.h | 6 ++++++
>>   4 files changed, 25 insertions(+)
> 
> AFAICT you forgot to actually Cc the maintainers for all that.
> 

Thanks so much for helping to Cc the maintainers. I just checked the MAINTAINERS file and Cc the 
maintainer for PTRACE SUPPORT but I forgot to use the get_maintainer.pl script. :(

Thanks
Jin Yao

>> diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
>> index df5f317ab3fc..c464d525c110 100644
>> --- a/arch/alpha/include/asm/ptrace.h
>> +++ b/arch/alpha/include/asm/ptrace.h
>> @@ -25,4 +25,10 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
>>   	return regs->r0;
>>   }
>>   
>> +static inline void instruction_pointer_set(struct pt_regs *regs,
>> +					   unsigned long val)
>> +{
>> +	regs->pc = val;
>> +}
>> +
>>   #endif
>> diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
>> index 2fdb87addadc..8869a6c0fe8c 100644
>> --- a/arch/arc/include/asm/ptrace.h
>> +++ b/arch/arc/include/asm/ptrace.h
>> @@ -154,6 +154,12 @@ static inline long regs_return_value(struct pt_regs *regs)
>>   	return (long)regs->r0;
>>   }
>>   
>> +static inline void instruction_pointer_set(struct pt_regs *regs,
>> +					   unsigned long val)
>> +{
>> +	regs->ret = val;
>> +}
>> +
>>   #endif /* !__ASSEMBLY__ */
>>   
>>   #endif /* __ASM_PTRACE_H */
>> diff --git a/arch/nds32/include/asm/ptrace.h b/arch/nds32/include/asm/ptrace.h
>> index 919ee223620c..19a916bef7f5 100644
>> --- a/arch/nds32/include/asm/ptrace.h
>> +++ b/arch/nds32/include/asm/ptrace.h
>> @@ -62,6 +62,13 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
>>   {
>>   	return regs->uregs[0];
>>   }
>> +
>> +static inline void instruction_pointer_set(struct pt_regs *regs,
>> +					   unsigned long val)
>> +{
>> +	regs->ipc = val;
>> +}
>> +
>>   extern void show_regs(struct pt_regs *);
>>   /* Avoid circular header include via sched.h */
>>   struct task_struct;
>> diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
>> index b109416dc07e..82ab1ba99259 100644
>> --- a/arch/xtensa/include/asm/ptrace.h
>> +++ b/arch/xtensa/include/asm/ptrace.h
>> @@ -90,6 +90,12 @@ struct pt_regs {
>>   # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
>>   					       (regs)->areg[1]))
>>   
>> +static inline void instruction_pointer_set(struct pt_regs *regs,
>> +					   unsigned long val)
>> +{
>> +	regs->pc = val;
>> +}
>> +
>>   # ifndef CONFIG_SMP
>>   #  define profile_pc(regs) instruction_pointer(regs)
>>   # else
>> -- 
>> 2.17.1
>>

Powered by blists - more mailing lists