Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp579224lqt; Fri, 19 Apr 2024 04:54:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzBrdLEy7y74Rc0KxZK7gpk2NNiq+p4S0Qg8FtE3WdmTk53E9Bmnbvxm+RqaveVqwLKWFzf345jbjKWbCxhtYKGYHMiwqeH260v+5SVg== X-Google-Smtp-Source: AGHT+IFElaiwFAYdF82wGwEukA0KzsKC4BGmzs766kIQaIByhz3sBjK8WszH6s7+FsSyKtdpytDK X-Received: by 2002:a50:c010:0:b0:56e:e76:6478 with SMTP id r16-20020a50c010000000b0056e0e766478mr1283914edb.31.1713527673534; Fri, 19 Apr 2024 04:54:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713527673; cv=pass; d=google.com; s=arc-20160816; b=N492XPew9uEARGIwVxp+aro3n8fy+Gd7KEXd5n532Fr+DI6aRBF9wltjUictezhkn5 wG58jZ6S6j/JQDuj9wvfuYVCHh4ZZBivCMPVzYaGmxH+kWmDOkQVMMJ3aemHwFJE0sqY 46t89fENnB1vzdf5PWdbKzJQGcV58YyNNewRgSb9Igjjfj6ecAxJtrmeI0ltLUZxWoKl Zumk7VRIqE5t+pZY6Vl//0wZzKTw+o7pGTwesN1+TTSOo2muuY8I96x0sRdxdxX+n/eI /RCbbyWSt2fwP4GvBzc40MI1pd1wZd9sPWsq5nBNg9Bw+kej43WoG0EJXHyEv7wHyyUV 0M6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=r33CO4uTcTV82jp5ffhYa6UPGqKMN0ZeuwL46dJowJU=; fh=lMlZtBW2jZCYaDz9Haq9KTQOrC9TsusSG7hqDnXXyx4=; b=g8SoENBfGKbgR2WP++4evDidW+UXI02/BQI+/QPcTfHZPnrNHy6eo5/xPr7aTfaDEI /CLO/Pn4fVSgeRaEiO0gi1ReHFzgFMvX03L1cyu7ze5rbwISh5ek7eaFiP1uIIw5/wAL ZL5qsWbKvNLwT9e2m0i6XqKcyaAL8Zjl5zWXWgMDZJdVIO4lKqJKDFq11zfDoOsdkn86 1HN1rD/ukXTHgUYvu+t3JJmUTtUCK1RThVCaManf8aXZZaio+QKmCypJS8RYmYD9JoAY PaoMKfY/dOQV0VPVYzpp20XPqFeM1otw2tPVC6Y5560m7qRbrtH6Hu4VDZZTzVElMXFQ iZSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-151387-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151387-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w11-20020aa7dccb000000b0057083e4eb96si1982506edu.183.2024.04.19.04.54.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 04:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151387-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-151387-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151387-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 44BD81F221A3 for ; Fri, 19 Apr 2024 11:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6484E83A0B; Fri, 19 Apr 2024 11:54:27 +0000 (UTC) Received: from mail114-241.sinamail.sina.com.cn (mail114-241.sinamail.sina.com.cn [218.30.114.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E666381720 for ; Fri, 19 Apr 2024 11:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.114.241 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713527666; cv=none; b=tCw9P67Xe7k1INJeBTMJvS0ECxaaiP/ajyEHkdJCBqs83F5nhJ73WZFdIgz4/dKWtCmkTBeZHGVKG9tLk8HVrAA3+7GBiykBS6zk+YEyDBacJ6UaMs5aX9wUCggvj7f/uS6fhhT1juKUIWlBHrJ1Zo7olilARksuzrVL5jydrgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713527666; c=relaxed/simple; bh=8vHirs8rA35/8bWtCtEYJFllQ2Aot13NJRR6SdUiE2Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VpOyD6NvLnveDrLce1rsBlJxIJX5rODjpCu+0Stz/QzPw1Iklp9CK3fX7dCOHQnO/M1lMegsGJJIhSjSEqMnh1LZJYLB3M1EPiatBRt5XsYSzat45vyPmyhEvHLCmrDiL18njVgJueMyp02bdEccmqoyLtdsBS5kWZewOpElKG0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.114.241 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.64.253]) by sina.com (172.16.235.24) with ESMTP id 66225B630000135A; Fri, 19 Apr 2024 19:54:13 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 8291945089467 X-SMAIL-UIID: 02C566C14E804937B17EB28983344192-20240419-195413-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Read in unix_del_edges Date: Fri, 19 Apr 2024 19:54:10 +0800 Message-Id: <20240419115410.2816-1-hdanton@sina.com> In-Reply-To: <000000000000c1fa0506166fdcfe@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 19 Apr 2024 02:39:21 -0700 > syzbot found the following issue on: > > HEAD commit: 7b4f2bc91c15 Add linux-next specific files for 20240418 > git tree: linux-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=128b1d53180000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 7b4f2bc91c15 --- x/net/unix/garbage.c +++ y/net/unix/garbage.c @@ -205,6 +205,7 @@ void unix_add_edges(struct scm_fp_list * edge = fpl->edges + i++; edge->predecessor = inflight; edge->successor = receiver; + sock_hold((struct sock *)receiver); unix_add_edge(fpl, edge); } while (i < fpl->count_unix); @@ -225,6 +226,7 @@ void unix_del_edges(struct scm_fp_list * { struct unix_sock *receiver; int i = 0; + int j; spin_lock(&unix_gc_lock); @@ -246,6 +248,12 @@ out: spin_unlock(&unix_gc_lock); fpl->inflight = false; + + for (j = 0; j < i; j++) { + struct unix_edge *edge = fpl->edges + j; + + sock_put((struct sock *)(edge->successor)); + } } void unix_update_edges(struct unix_sock *receiver) --