From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E65616E860 for ; Wed, 18 Sep 2024 09:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726653071; cv=none; b=GrTnXkuKKC2tGSJg1L+l5aoWGXuAdCshJdpUAAGLREmytL82FCi7SpGnUAhG7lsYA6vUi9ep+kZsQwWOLfelmlZ2iFMTHhXp7fkiBHdTqL6bsZYQ+gIKZUDNHD+wAzy5vVTtkfztiGCUv2fmsofAouwlTA0RMDbHkOjzO5LNCbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726653071; c=relaxed/simple; bh=YYveKDNyLV/O+GuIZezG/H+dg/pEIjQTXZMwxfSjq/M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NfcY9aXzlF+dRww3+CDu8YRg8M/Y3WCfqIlGqyueUsiKqnuXjLz/+W5WX6+KTO4z9l2lTIXg2EYkW6vwE9XyClQanE6+Pyu1yXcfeHbX6MNgu+wc3aiOKPWVvGISqYKPy+s0kGfjbpHNw4WCCjzhgmdA3oi4/Tvznm+R1BxYIsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blackwall.org; spf=none smtp.mailfrom=blackwall.org; dkim=pass (2048-bit key) header.d=blackwall-org.20230601.gappssmtp.com header.i=@blackwall-org.20230601.gappssmtp.com header.b=js5NuPoK; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blackwall.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=blackwall.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20230601.gappssmtp.com header.i=@blackwall-org.20230601.gappssmtp.com header.b="js5NuPoK" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a8a7596b7dfso102666666b.0 for ; Wed, 18 Sep 2024 02:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20230601.gappssmtp.com; s=20230601; t=1726653068; x=1727257868; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U5Lz1QWVFmZd2N1NR4+boEn5JCoZBGXe5wWgia0cON4=; b=js5NuPoKWQ3/7Er/hcnJ06/MjTq1CnwJN0fwvs/Wtell0wWMwxV5iaJDLb3gcroNKj ZJ7sp9EWEhWHfZG9wAuDNeOMUn5UninPRsjKJzL4u8RGacMfsV0dRLQaGeIvlRJfLiSl OrZopnQPbGCK5MtP+YcAAqPP50RmOUOXwCCLfsT1cMmm0OFMg/l9aB3oJpXyamXHeJPw JqvVcQ9q6kZ/hqM1DGrXahR2ZeE90O+Cfz8QlGRMpSiNe5A6eNmdIIc4fgtO38m4a2bl Xx+oP0oB9B416DZnj3VY0uOGodn2k9t+XH1+CvuAqrYSQrL23cS0Rg5maAxbbbmwbIia LmNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726653068; x=1727257868; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U5Lz1QWVFmZd2N1NR4+boEn5JCoZBGXe5wWgia0cON4=; b=mHwDPxwN3pm3Z+cbm4uLvHAWxStcpWPDFrA5DLdZ0GpJnK3dU1+34ljQqQq2uWr3Vg iF521M1NKEWw7qiMyKvyUD1Oq9OBbEKHcZ9AXMyJiMRMaeEGHdAPX1wh4nOo9xHWhOnH 0SqbcYoL4GOPF9VGA/mBprqkmKSV2Ju09/zJaHtRMiqYhhdrlcykyxJyxyaKTb74QP70 qVbLlbaGsTId1v4gOuTvQMD1IoNxBFkV+/+JdLiL2hQOVXioasYh6zq0g+uy6NyUeVhr jb625361k5pp+jqYzXQ5nYwfNPUAVlrWErFOm3r3uwTG6T89RAHy1RwRBQ0z8q2eNFyb u4/A== X-Forwarded-Encrypted: i=1; AJvYcCWv/MwKmdvERlTTqFxxNfIaAPkg8nQVkxVBUbx/Nwceo7Ygb3VHMgV56NUzSQLjvbqaXWM4RL/ozjV5gGw=@vger.kernel.org X-Gm-Message-State: AOJu0YwJYYWpozd210wWbZX4t9a1wN0kvlzv4/ndNlbN1F3kgOAI1tEo Dg1DpH/fhxAU6mitM7xet9rdJwXnot2uLQa2c6egChtZQ+3047JaGKl1ANUepus= X-Google-Smtp-Source: AGHT+IGh+5daTFsNyDKlbll7KebWFSlnclyKmAwqiRqpM+wguKxxuLaiVoIA7Zfzj5R3BOYGBvdN6A== X-Received: by 2002:a17:907:3f91:b0:a8d:5f69:c839 with SMTP id a640c23a62f3a-a8ffabbcc0cmr2879337466b.15.1726653068106; Wed, 18 Sep 2024 02:51:08 -0700 (PDT) Received: from [192.168.0.245] ([62.73.69.208]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df75csm568606066b.149.2024.09.18.02.51.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Sep 2024 02:51:07 -0700 (PDT) Message-ID: Date: Wed, 18 Sep 2024 12:51:06 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2] bonding: Add net_ratelimit for bond_xdp_get_xmit_slave in bond_main.c To: Jiwon Kim , jv@jvosburgh.net, andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, joamaki@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, syzbot+c187823a52ed505b2257@syzkaller.appspotmail.com References: <20240918083545.9591-1-jiwonaid0@gmail.com> Content-Language: en-US From: Nikolay Aleksandrov In-Reply-To: <20240918083545.9591-1-jiwonaid0@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 18/09/2024 11:35, Jiwon Kim wrote: > Add net_ratelimit to reduce warnings and logs. > This addresses the WARNING in bond_xdp_get_xmit_slave reported by syzbot. > This commit message is severely lacking. I did the heavy lifting and gave you detailed analysis of the problem, please describe the actual issue and why this is ok to do. Also the subject is confusing, it should give a concise summary of what the patch is trying to do and please don't include filenames in it. You can take a look at other commits for examples. > Setup: > # Need xdp_tx_prog with return XDP_TX; > ip l add veth0 type veth peer veth1 > ip l add veth3 type veth peer veth4 > ip l add bond0 type bond mode 6 # <- BOND_MODE_ALB, unsupported by xdp > ip l add bond1 type bond # <- BOND_MODE_ROUNDROBIN by default > ip l set veth0 master bond1 > ip l set bond1 up > ip l set dev bond1 xdpdrv object tx_xdp.o section xdp_tx > ip l set veth3 master bond0 > ip l set bond0 up > ip l set veth4 up > ip l set veth3 xdpgeneric object tx_xdp.o section xdp_tx Care to explain why this setup would trigger anything? > > Reported-by: syzbot+c187823a52ed505b2257@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=c187823a52ed505b2257 > Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver") > Signed-off-by: Jiwon Kim > --- > v2: Change the patch to fix bond_xdp_get_xmit_slave > --- > drivers/net/bonding/bond_main.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > index b560644ee1b1..91b9cbdcf274 100644 > --- a/drivers/net/bonding/bond_main.c > +++ b/drivers/net/bonding/bond_main.c > @@ -5610,9 +5610,12 @@ bond_xdp_get_xmit_slave(struct net_device *bond_dev, struct xdp_buff *xdp) > break; > > default: > - /* Should never happen. Mode guarded by bond_xdp_check() */ > - netdev_err(bond_dev, "Unknown bonding mode %d for xdp xmit\n", BOND_MODE(bond)); > - WARN_ON_ONCE(1); > + /* This might occur when a bond device increases bpf_master_redirect_enabled_key, > + * and another bond device with XDP_TX and bond slave. > + */ The comment is confusing and needs to be reworded or dropped altogether. > + if (net_ratelimit()) > + netdev_err(bond_dev, "Unknown bonding mode %d for xdp xmit\n", > + BOND_MODE(bond)); > return NULL; > } >