svn commit: r326110 - head/sys/kern

Shawn Webb shawn.webb at hardenedbsd.org
Thu Nov 23 03:16:12 UTC 2017


On Wed, Nov 22, 2017 at 11:52:05PM +0000, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Nov 22 23:52:05 2017
> New Revision: 326110
> URL: https://svnweb.freebsd.org/changeset/base/326110
> 
> Log:
>   rwlock: don't check for curthread's read lock count in the fast path
> 
> Modified:
>   head/sys/kern/kern_rwlock.c
> 
> Modified: head/sys/kern/kern_rwlock.c
> ==============================================================================
> --- head/sys/kern/kern_rwlock.c	Wed Nov 22 23:10:20 2017	(r326109)
> +++ head/sys/kern/kern_rwlock.c	Wed Nov 22 23:52:05 2017	(r326110)
> @@ -364,12 +364,20 @@ _rw_wunlock_cookie(volatile uintptr_t *c, const char *
>   * is unlocked and has no writer waiters or spinners.  Failing otherwise
>   * prioritizes writers before readers.
>   */
> -#define	RW_CAN_READ(td, _rw)						\
> -    (((_rw) & (RW_LOCK_READ | RW_LOCK_WRITE_WAITERS | RW_LOCK_WRITE_SPINNER)) ==\
> -    RW_LOCK_READ || ((td)->td_rw_rlocks && (_rw) & RW_LOCK_READ))
> +static bool __always_inline
> +__rw_can_read(struct thread *td, uintptr_t v, bool fp)
> +{
>  
> +	if ((v & (RW_LOCK_READ | RW_LOCK_WRITE_WAITERS | RW_LOCK_WRITE_SPINNER))
> +	    == RW_LOCK_READ)
> +		return (true);
> +	if (!fp && td->td_rw_rlocks && (v & RW_LOCK_READ))
> +		return (true);
> +	return (false);
> +}

This bit of the patch breaks buildkernel. You left a consumer of
RW_CAN_READ on line 554: MPASS(!RW_CAN_READ(td, v));

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:          0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20171122/34a50885/attachment.sig>


More information about the svn-src-all mailing list