Cygwin: sigpending: don't report pending signals for other threads
The sigpending mechanism failed to check if the pending signal was a process-wide signal, or a signal for the curent thread. Fix that by adding a matching conditional to wait_sig's __SIGPENDING code. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -37,3 +37,6 @@ Bug Fixes | |||||||
|  |  | ||||||
| - Fix a timerfd deadlock. | - Fix a timerfd deadlock. | ||||||
|   Addresses: https://cygwin.com/ml/cygwin/2019-06/msg00096.html |   Addresses: https://cygwin.com/ml/cygwin/2019-06/msg00096.html | ||||||
|  |  | ||||||
|  | - Fix sigpending() incorrectly returning signals for unrelated threads. | ||||||
|  |   Addresses: https://cygwin.com/ml/cygwin/2019-07/msg00051.html | ||||||
|   | |||||||
| @@ -1335,8 +1335,13 @@ wait_sig (VOID *) | |||||||
| 	    *pack.mask = 0; | 	    *pack.mask = 0; | ||||||
| 	    tl_entry = cygheap->find_tls (pack.sigtls); | 	    tl_entry = cygheap->find_tls (pack.sigtls); | ||||||
| 	    while ((q = q->next)) | 	    while ((q = q->next)) | ||||||
| 	      if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo))) | 	      { | ||||||
| 		*pack.mask |= bit; | 		/* Skip thread-specific signals for other threads. */ | ||||||
|  | 		if (q->sigtls && pack.sigtls != q->sigtls) | ||||||
|  | 		  continue; | ||||||
|  | 		if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo))) | ||||||
|  | 		  *pack.mask |= bit; | ||||||
|  | 	      } | ||||||
| 	    cygheap->unlock_tls (tl_entry); | 	    cygheap->unlock_tls (tl_entry); | ||||||
| 	  } | 	  } | ||||||
| 	  break; | 	  break; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user