tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: freeradius startup crash



On 19.12.2018 13:51, Martin Husemann wrote:
> On Wed, Dec 19, 2018 at 12:35:26PM +0000, Emmanuel Dreyfus wrote:
>> On Wed, Dec 19, 2018 at 03:36:40AM +0000, maya%netbsd.org@localhost wrote:
>>> Maybe simpler
>>
>> With the help of kern/53800 I got the right fix, and it was accepted
>> upstream. I will commit this to pkgsrc in a few hours, when I will
>> have my keys at hand.
> 
> While this fixes the obvious bug, it is not the right fix.
> 
> There are two issues:
> 
>  - It is very stupid to change the behaviour of an installed pkg when running
>    under a debugger, unless (a) you are debugging or (b) some security issue
>    requires this [typical case is makeing it harder to reverse engineer
>    something - obviously does not apply to open source]. It seems this should
>    only be enabled when doing some kind of debug build, but not for pkgsrc
>    default builds. It is not clear if this all is intended or some configure
>    magic goes wrong.
> 
>  - On NetBSD it is very simple to test if you are being traced by doing
>    a sysctl KERN_PROC2 and checking p_flag for P_TRACED (Kamil has a
>    very simple demo program showing this). Using ptrace for this is
>    way too heavy and obscure.
> 

The right approach is to check P_TRACED.

http://netbsd.org/~kamil/gdb/isdebugged.c

ptrace(2) based detection is wrong because it depends on a side effect
of a debugger not emulating ptrace(2) calls in tracee. At some point it
can start to be emulated and the detection will stop working.

> 
> Martin
> 


Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index