From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbcH0LjN (ORCPT ); Sat, 27 Aug 2016 07:39:13 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:38599 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbcH0LjK (ORCPT ); Sat, 27 Aug 2016 07:39:10 -0400 Message-ID: <1472297918.13300.312.camel@decadent.org.uk> Subject: Re: [PATCH 3.10 099/180] fix d_walk()/non-delayed __d_free() race From: Ben Hutchings To: Willy Tarreau , Al Viro Cc: Jari Ruusu , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby Date: Sat, 27 Aug 2016 12:38:38 +0100 In-Reply-To: <20160827093135.GA28378@1wt.eu> References: <20160827093135.GA28378@1wt.eu> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-qnylvMfkDnOX0wzp90ix" X-Mailer: Evolution 3.20.4-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-qnylvMfkDnOX0wzp90ix Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2016-08-27 at 11:31 +0200, Willy Tarreau wrote: > Greg, Jiri, >=20 > I checked Jari's explanation below and found that v3.14.77 and v3.12.62 > are missing the same fix as 3.10. In fact Al's original commit 3d56c25 > ("fix d_walk()/non-delayed __d_free() race") used to mention to check=C2= =A0 > this __d_materialise_dentry() function in the Cc: stable line, but this > got lost during the backports. >=20 > Normally all of our 3 kernels need to apply the following patch that > Ben correctly put in 3.16 and 3.2. I'm fixing the backport in 3.10.103 > right now. I never did get positive confirmation that this is the right change in __d_materialise_dentry(). =C2=A0Al, could you please comment? Ben. > > Cheers, > Willy >=20 > diff --git a/fs/dcache.c b/fs/dcache.c > index 2a808fb..2d0b9d2 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -2401,6 +2401,7 @@ static void __d_materialise_dentry(struct dentry *d= entry, struct dentry *anon) > > =C2=A0 switch_names(dentry, anon); > > =C2=A0 swap(dentry->d_name.hash, anon->d_name.hash); > =C2=A0 > > + dentry->d_flags |=3D DCACHE_RCUACCESS; > > =C2=A0 dentry->d_parent =3D dentry; > > =C2=A0 list_del_init(&dentry->d_child); > > =C2=A0 anon->d_parent =3D dparent; >=20 >=20 > On Mon, Aug 22, 2016 at 04:56:57PM +0300, Jari Ruusu wrote: > >=20 > > This patch for 3.10 branch appears to be missing one important > >=20 > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dentry->d_flags |=3D DCACHE_= RCUACCESS; > >=20 > > in fs/dcache.c __d_materialise_dentry() function. When Ben Hutchings > > backported Al Viro's original fix to stable branches that he maintains, > > he added that one additional line to both 3.2 and 3.16 branches. Please > > consider including that additional one line fix for 3.10 stable branch > > also. > >=20 > >=20 > > Ben Hutchings said this on his 3.2.82-rc1 patch: > > [bwh: Backported to 3.2: > > =C2=A0- Adjust context > > =C2=A0- Also set the flag in __d_materialise_dentry())] > >=20 > > http://marc.info/?l=3Dlinux-kernel&m=3D147117565612275&w=3D2 > >=20 > >=20 > > Ben Hutchings said this on his 3.16.37-rc1 patch: > > [bwh: Backported to 3.16: > > =C2=A0- Adjust context > > =C2=A0- Also set the flag in __d_materialise_dentry())] > >=20 > > http://marc.info/?l=3Dlinux-kernel&m=3D147117433412006&w=3D2 > >=20 > >=20 > > Also mentioned by Sasha Levin on 3.18 and 4.1 commits: > > > > Cc: stable@vger.kernel.org # v3.2+ (and watch out for __d_materiali= se_dentry()) > >=20 > > http://marc.info/?l=3Dlinux-stable-commits&m=3D146648034410827&w=3D2 > > http://marc.info/?l=3Dlinux-stable-commits&m=3D146647471009771&w=3D2 > >=20 > > --=C2=A0 > > Jari Ruusu=C2=A0=C2=A04096R/8132F189 12D6 4C3A DCDA 0AA4 27BD=C2=A0=C2= =A0ACDF F073 3C80 8132 F189 --=20 Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. ... I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949 --=-qnylvMfkDnOX0wzp90ix Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIcBAABCgAGBQJXwXu+AAoJEOe/yOyVhhEJh40P/RMppoiOXN2VKfshfk+33NCH +DNxiWIjJuq7ldpcQSwCx3UnbxsqW9TySAtR/p9Y8tD1iyX3zDF6t7BKqUGF0BT5 A/KYpeU9/tUs8AYfhs9Dwr6B6dKfasWX8gkZAvg8htu41ldegVouuUVUC7g4IdcP Jkle6mPONuIeeLGAdnSxhi6aYMIdLi8rnwyDc8iuiYG3K/VRZ1AI1VhQHgTWy9oD WSbTHiJ2XEj8CrUNzY7BoEXtGMQZp7V0Y61zCpt1QcrPEB2jIl1U+n5d7I7sIFTn GkBMD55cVQr6mSi8fdI6ScNz1Z9VBcPNi8nD5I1N7F70mT0ef0yyLTaqCZTdifZj QhXXjx7XERO9weCE8KAGDDwonicDS3SRjjPBKlDu4FROd7v72o187CQeyNJpDY9J GYqdcPo2XVf9gN2Mdcc+L4q60wonFHRA78dCBzuZJM9VOPU4E07X/vwJeN0f8z5i d4wxm9z8MkBlBvmeaiJtChVrIpDu613lCxfGhu7Xhc5sOfrnTmmw8qrKV+Kv0PO/ JlJLCbphZLgt2fE/ABFfeG2wlR3GQcBDAjEwMqVCH26EyW48bzBU9ZRbbW1FV46N LsTNAWELbbnYW+UIeKWfOyTHqlruDrxPKmPaemZrpEGseHqHKvadr0uFarkpH0r2 +nwD9pErPUJtsrbIn4od =iPtM -----END PGP SIGNATURE----- --=-qnylvMfkDnOX0wzp90ix--