Re: [PATCH v1 2/3] Treewide: Stop corrupting socket's task_frag

From: Paolo Abeni
Date: Fri Dec 09 2022 - 07:38:17 EST


On Mon, 2022-11-21 at 08:35 -0500, Benjamin Coddington wrote:
> Since moving to memalloc_nofs_save/restore, SUNRPC has stopped setting the
> GFP_NOIO flag on sk_allocation which the networking system uses to decide
> when it is safe to use current->task_frag. The results of this are
> unexpected corruption in task_frag when SUNRPC is involved in memory
> reclaim.
>
> The corruption can be seen in crashes, but the root cause is often
> difficult to ascertain as a crashing machine's stack trace will have no
> evidence of being near NFS or SUNRPC code. I believe this problem to
> be much more pervasive than reports to the community may indicate.
>
> Fix this by having kernel users of sockets that may corrupt task_frag due
> to reclaim set sk_use_task_frag = false. Preemptively correcting this
> situation for users that still set sk_allocation allows them to convert to
> memalloc_nofs_save/restore without the same unexpected corruptions that are
> sure to follow, unlikely to show up in testing, and difficult to bisect.
>
> CC: Philipp Reisner <philipp.reisner@xxxxxxxxxx>
> CC: Lars Ellenberg <lars.ellenberg@xxxxxxxxxx>
> CC: "Christoph Böhmwalder" <christoph.boehmwalder@xxxxxxxxxx>
> CC: Jens Axboe <axboe@xxxxxxxxx>
> CC: Josef Bacik <josef@xxxxxxxxxxxxxx>
> CC: Keith Busch <kbusch@xxxxxxxxxx>
> CC: Christoph Hellwig <hch@xxxxxx>
> CC: Sagi Grimberg <sagi@xxxxxxxxxxx>
> CC: Lee Duncan <lduncan@xxxxxxxx>
> CC: Chris Leech <cleech@xxxxxxxxxx>
> CC: Mike Christie <michael.christie@xxxxxxxxxx>
> CC: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>
> CC: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
> CC: Valentina Manea <valentina.manea.m@xxxxxxxxx>
> CC: Shuah Khan <shuah@xxxxxxxxxx>
> CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> CC: David Howells <dhowells@xxxxxxxxxx>
> CC: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
> CC: Steve French <sfrench@xxxxxxxxx>
> CC: Christine Caulfield <ccaulfie@xxxxxxxxxx>
> CC: David Teigland <teigland@xxxxxxxxxx>
> CC: Mark Fasheh <mark@xxxxxxxxxx>
> CC: Joel Becker <jlbec@xxxxxxxxxxxx>
> CC: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
> CC: Eric Van Hensbergen <ericvh@xxxxxxxxx>
> CC: Latchesar Ionkov <lucho@xxxxxxxxxx>
> CC: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
> CC: "David S. Miller" <davem@xxxxxxxxxxxxx>
> CC: Eric Dumazet <edumazet@xxxxxxxxxx>
> CC: Jakub Kicinski <kuba@xxxxxxxxxx>
> CC: Paolo Abeni <pabeni@xxxxxxxxxx>
> CC: Ilya Dryomov <idryomov@xxxxxxxxx>
> CC: Xiubo Li <xiubli@xxxxxxxxxx>
> CC: Chuck Lever <chuck.lever@xxxxxxxxxx>
> CC: Jeff Layton <jlayton@xxxxxxxxxx>
> CC: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> CC: Anna Schumaker <anna@xxxxxxxxxx>
> CC: drbd-dev@xxxxxxxxxxxxxxxx
> CC: linux-block@xxxxxxxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> CC: nbd@xxxxxxxxxxxxxxxx
> CC: linux-nvme@xxxxxxxxxxxxxxxxxxx
> CC: open-iscsi@xxxxxxxxxxxxxxxx
> CC: linux-scsi@xxxxxxxxxxxxxxx
> CC: linux-usb@xxxxxxxxxxxxxxx
> CC: linux-afs@xxxxxxxxxxxxxxxxxxx
> CC: linux-cifs@xxxxxxxxxxxxxxx
> CC: samba-technical@xxxxxxxxxxxxxxx
> CC: cluster-devel@xxxxxxxxxx
> CC: ocfs2-devel@xxxxxxxxxxxxxx
> CC: v9fs-developer@xxxxxxxxxxxxxxxxxxxxx
> CC: netdev@xxxxxxxxxxxxxxx
> CC: ceph-devel@xxxxxxxxxxxxxxx
> CC: linux-nfs@xxxxxxxxxxxxxxx
>
> Suggested-by: Guillaume Nault <gnault@xxxxxxxxxx>
> Signed-off-by: Benjamin Coddington <bcodding@xxxxxxxxxx>

I think this is the most feasible way out of the existing issue, and I
think this patchset should go via the networking tree, targeting the
Linux 6.2.

If someone has disagreement with the above, please speak!

Thanks,

Paolo