Date: Tue, 11 Aug 2020 08:34:22 -0400 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Mateusz Guzik <mjguzik@gmail.com> Cc: Emmanuel Vadot <manu@bidouilliste.com>, Alan Cox <alc@rice.edu>, Emmanuel Vadot <manu@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r363842 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <20200811123422.sf63z62buxqcnv3c@mutt-hbsd> In-Reply-To: <CAGudoHHJ7mj3td4jD2SNABANoAsSwzKrOM18WE-zhoV0sNWbiQ@mail.gmail.com> References: <202008041525.074FPNLh043749@repo.freebsd.org> <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> <CAGudoHHJ7mj3td4jD2SNABANoAsSwzKrOM18WE-zhoV0sNWbiQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--mjzj2rmpidkza7u7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable If you use git, you can easily cherry-pick the fix from HardenedBSD: https://github.com/HardenedBSD/hardenedBSD/commit/e7ee74598b987fdc702614668= b7ea85884289cf1 On Tue, Aug 11, 2020 at 02:31:26PM +0200, Mateusz Guzik wrote: > Hi. This remains unfixed. >=20 > On 8/4/20, Emmanuel Vadot <manu@bidouilliste.com> wrote: > > On Tue, 4 Aug 2020 13:11:02 -0500 > > Alan Cox <alc@rice.edu> wrote: > > > >> > >> On 8/4/20 10:25 AM, Emmanuel Vadot wrote: > >> > Author: manu > >> > Date: Tue Aug 4 15:25:22 2020 > >> > New Revision: 363842 > >> > URL: https://svnweb.freebsd.org/changeset/base/363842 > >> > > >> > Log: > >> > linuxkpi: Add clear_bit_unlock > >> > > >> > This calls clear_bit and adds a memory barrier. > >> > > >> > Sponsored by: The FreeBSD Foundation > >> > > >> > Reviewed by: hselasky > >> > MFC after: 1 week > >> > Differential Revision: https://reviews.freebsd.org/D25943 > >> > > >> > Modified: > >> > head/sys/compat/linuxkpi/common/include/linux/bitops.h > >> > > >> > Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h > >> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > >> > --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 > >> > 15:00:02 2020 (r363841) > >> > +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 > >> > 15:25:22 2020 (r363842) > >> > @@ -275,6 +275,13 @@ find_next_zero_bit(const unsigned long *addr, > >> > unsigned > >> > #define test_bit(i, a) \ > >> > !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)= ]) & > >> > BIT_MASK(i)) > >> > > >> > +static inline void > >> > +clear_bit_unlock(long bit, volatile unsigned long *var) > >> > +{ > >> > + clear_bit(bit, var); > >> > + wmb(); > >> > >> > >> For an unlock operation, the memory barrier should come before the > >> clear_bit() call, not after.?? See, for example, the alpha implementat= ion > >> in Linux.?? Also, the correct "spelling" for this memory barrier in > >> FreeBSD would be atomic_thread_fence_rel(). See, for example, the > >> comment at the top of sys/amd64/include/atomic.h. > > > > Ah yes, thanks. I probably got lost looking for the linux implem but > > that does make sense, I'll fix that probably tomorow. > > > > Thanks. > > > >> > >> > +} > >> > + > >> > static inline int > >> > test_and_clear_bit(long bit, volatile unsigned long *var) > >> > { > > > > > > -- > > Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org> > > >=20 >=20 > --=20 > Mateusz Guzik <mjguzik gmail.com> > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --mjzj2rmpidkza7u7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl8ykEwACgkQ/y5nonf4 4fpS7A//V2iZ37Ya8JjEUlinCTwY3xpP77vHbx9c4KEofwI+av2BWFFLcYA9lIxG k2DjWfwjuPgqUYCL4/NPN6hGy2NrpNXl4IT1gpo1hKiWH9M5m4vI0ZP5+SW1bqi6 92ytAZUshzpLacklVbmG+GZT1BIpydjjA7tSNvA4YRWjPy65BATQYdzjlNCdgcSe OnF2VIyMFzdwycZn+a3+N14jEnv6+EqxJYJZroJLqHMK+rlS1v4LZvaZVky4qm9U eP7jbwaRbdJ+CTUooQPEwmcjcfqdGDuXyaBdutWLyz7dOZI/IjLjaAywbTAcBX3l E4XGa1qHrrOlaiP7yJjLS7efZn1Sr+d0ZdKQ7By1un7JEh+FCz90tK2qYuGK1QxI pMnX1SsPpshsi1Dk6zYmosdWVlZQZNmS9n+SLWKy4jPzbhbJSq2kjNRn+GvvaxpJ J/BqkfB+XTWJKDkIzIAQdlDrcknMuPsV08NC4Jd1OtT5gqKAZehIsb7o/0wbadiu Ll3ree/n/+mr6wSou1h2pdSLy3U4nSGAvDPPacz2nR3uVg1MGAs+turtd6CHNknu eFGnGu5KD9I+Ygg7tPm5JiUK9U8sKlMEvY9gIXwrYEnp9scwTb4i4zxt/G5Jmf5r YETkeQU3S5u94vEdbMg+5SQLbxW2UXknERpyD+hW6UtcyDG2gD0= =5HEO -----END PGP SIGNATURE----- --mjzj2rmpidkza7u7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200811123422.sf63z62buxqcnv3c>