On Wed, Oct 28, 2015 at 10:59 AM, <
hawtp...@email.com> wrote:
> most of the time? so this feature wouldn't be helpful some of the time?
> Please explain thoroughly why you so adamantly object. I am asking this from
> both minux and russ cox.
It's a cost-benefit decision. Increasing the complexity of the
and verification that the change does not regress. They are saying
> On Monday, October 19, 2015 at 1:43:40 PM UTC-4, minux wrote:
>>
>>
>> On Mon, Oct 19, 2015 at 11:00 AM, Gregory Shimansky
>> <
gregory....@intel.com> wrote:
>>>
>>> When Go compiler and assembly generate code, functions are aligned on
>>> FuncAlign bytes boundary. For x86 architecture it is 16 bytes. Padding bytes
>>> between functions are filled with zero bytes. Two zero bytes 0x00 0x00 on
>>> x86 architecture mean instruction "add %al,(%rax)" which is valid and can be
>>> executed by processor. If instead of zeroes we used 0xCC byte, this would
>>> generate one-byte int3 opcode (trap) for padding bytes, which in some cases
>>> could help to find bugs in execution control transfer on a wrong address, or
>>> execution going past a function end. What do you think?
>>>
>>> If you think that this is a good idea, I have a patch ready. It is a
>>> small change in asm6.go file.
>>
>>
>> I don't think this is necessary.
>>
>> Even if the code does indeed jump to the wrong target, most of the time,
>> it will
>> hit somewhere inside a function, and this change won't help. Our liblink
>> will
>> make sure functions won't fall off the end (it inserts a self jump if the
>> function
>> doesn't end with a RET instruction.)
>>
>> Note that even for a unsafe language like C, gcc uses various NOP
>> instruction
>> to align a function.
>