[2/4] S390: Use own tbegin macro instead of __builtin_tbegin.

Message ID d0de2582-4666-6176-c3e6-518a962720b2@linux.vnet.ibm.com
State Superseded
Headers

Commit Message

Stefan Liebler Jan. 17, 2017, 3:28 p.m. UTC
  On 01/12/2017 04:45 PM, Florian Weimer wrote:
> On 01/10/2017 05:34 PM, Torvald Riegel wrote:
>
>> (2) This introduces a facility to probe memory for being accessible or
>> not, considering that you say it masks segfaults.  It seems that this
>> probing may not be visible to the same extent as possible if a signal
>> handler were installed.  Is this relevant from a security perspective?
>
> If the fallback implementation has essentially the same behavior, I
> don't think there is a transaction-specific security problem.
>
> One thing to check is if anything in the transaction memory code writes
> unprotected function pointers/code addresses to memory.  I'm not
> familiar with z Systems machine code, so I don't know if that's the case.
>
> For example, it would be problematic to store the address of the
> transaction abort handler in a TLS variable.

The first tbegin instruction starts transactional execution mode.
Then the Transaction-Abort PSW is set to the instruction after the
tbegin instruction. If this transaction or multiple nested transactions 
are aborted, the instruction in Transaction-Abort PSW (after the 
outermost tbegin) is executed and the condition code set to 1-3.
The code behind tbegin has to determine what to do next.
There is no instruction to extract Transaction-Abort PSW.
>
>>> +               /* Begin transaction: save all gprs, allow    \
>>> +                  ar modification and fp operations.  Some    \
>>> +                  program-interruptions (e.g. a null    \
>>> +                  pointer access) are filtered and the    \
>>> +                  trancsaction will abort.  In this case    \
>
> Typo: “transaction”
okay.
>
> Thanks,
> Florian
>

I've attached the diff here and will later make one patch with changelog 
for this and the other two patches.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/s390/htm.h b/sysdeps/unix/sysv/linux/s390/htm.h
index 32d5a88..af7144f 100644
--- a/sysdeps/unix/sysv/linux/s390/htm.h
+++ b/sysdeps/unix/sysv/linux/s390/htm.h
@@ -119,7 +119,7 @@ 
 			      ar modification and fp operations.  Some	\
 			      program-interruptions (e.g. a null	\
 			      pointer access) are filtered and the	\
-			      trancsaction will abort.  In this case	\
+			      transaction will abort.  In this case	\
 			      the normal lock path will execute it	\
 			      again and result in a core dump wich does	\
 			      now show at tbegin but the real executed	\