Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2690715lqo; Tue, 14 May 2024 06:38:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXKncyNYZnTgdGqBzkpHjfOan2CZK+RsJPgphOf29wbIlBrfAh5ZxIBXAzcVtbKoixOCk4YRnhu1+8hPhGFinqZiFwXU/sZwKpHwhRag== X-Google-Smtp-Source: AGHT+IFl++VIF6oxotQQ67mQXubeHrqguNaiiJxa9cUD0eXN0/sCcxeBsnL5qpr0OtPClcTefWEf X-Received: by 2002:a05:6a00:1992:b0:6f3:eaa2:53a0 with SMTP id d2e1a72fcca58-6f4e035d46cmr14485870b3a.24.1715693896409; Tue, 14 May 2024 06:38:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715693896; cv=pass; d=google.com; s=arc-20160816; b=D1oeVPVO6aIVJqun7QHslhJQ8nMHdF7/CHO0LrJEJubDi+vj9p3UUhuEJMytW/j5WX c78KQ1VYIZU1NLYc2M+kjtBhj2bXrESVoXdS8Lm8miMu99RiYekGGP9g+spp3vG7y9Xw VPnqhaVOW7ssFWl/NauFxGqSmR8T8f1ngc7x0GFj2/bqUOyAZUn+bN5JC16bCYXNdjNf eNdrQpKantFVlKWgSDsiIhH8ihBeYSr3eqz8q7rglRSHeyAOaHxFX4k9lh6sq5vtbqp3 hswcpGPmrPZ04rsD3m578n9Y0oaRygOP2BMad4REnDRrJEBxvFzvvu4zxo4SBt5mHcMO Ld2w== 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:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=hZtaa+gXLYdDiofDQR4Fm4ng3aii+qH+CB9OYIf7MZo=; fh=SObmMy/WXC7zlkI6/WwqA6fJk4YTXxIHzjf0ZQjQr0w=; b=VVjuQRIDZo9Sq/Nv6lme3VHe/gWAHN5JX8wAj5gHdzULWX+Q8UQVkYO5QN1WslI+Oo ekoNMIkTxrFd+icie/7V10r6RjMysnd4OQkiznZVe3w83MnkKqfwvlM6y+WqXHnsbt9e 8Djbruzs5gFPnEqsHRhINPwP9NH6Ovr8spCMKgwJeMeaJmNtrw8SgTFQbsU2y2m4WDCy tRTXDFKH0MUVZMYW9UrDw6LiqMNrDCwc8SWfZF5/yqEG6n39soN5n/yOfxB2CcdItHJC oc7pZnr2z4HEara0qqPTaC2vY/bVwwS5yOOjklD7CjTly8Njj8cetlROfQrlUo+UdMGy 6iyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=tG9nHuQa; arc=pass (i=1 spf=pass spfdomain=yahoo.com dkim=pass dkdomain=yahoo.com dmarc=pass fromdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-178748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f55fcsi11420377a12.262.2024.05.14.06.38.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 06:38:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=tG9nHuQa; arc=pass (i=1 spf=pass spfdomain=yahoo.com dkim=pass dkdomain=yahoo.com dmarc=pass fromdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-178748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A5AACB23D97 for ; Tue, 14 May 2024 13:30:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2FE3145A08; Tue, 14 May 2024 13:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="tG9nHuQa" Received: from sonic311-13.consmr.mail.bf2.yahoo.com (sonic311-13.consmr.mail.bf2.yahoo.com [74.6.131.123]) (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 1A84D1459F1 for ; Tue, 14 May 2024 13:21:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.6.131.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692893; cv=none; b=sKZTyad3v9Kz8iDWR8em5n9qyPy7WXySu7eTLXVYEN4p1S8J3rNYmRM8OS+8kTj2p4tq8JceSyhCe9kGda8J9oPpLJpWeQv9ieSJsm6CdpUXYGDPkPLt80iVL3jL3i3KhNmecip4AG9/sIyC9kKAbIqQ78kkCgQqteEgbdW3Ego= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692893; c=relaxed/simple; bh=hZtaa+gXLYdDiofDQR4Fm4ng3aii+qH+CB9OYIf7MZo=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=I62n4i2ujypU27q7fAfKbU/Gf/eIyfBW+pWHY9rfJ11ulVzkYDeCVKf6GMP/IyOQiw99SXK8nAj6cwFAmxT6r+Yv5SDQl6chpeCWj/zWc4EUNcZmV/41FNvXdIwpXcxGcnSho1gE3z13Z6A814nrEmC3P++8KnGhScFhKhz2uBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=tG9nHuQa; arc=none smtp.client-ip=74.6.131.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1715692885; bh=hZtaa+gXLYdDiofDQR4Fm4ng3aii+qH+CB9OYIf7MZo=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=tG9nHuQakGf2Q8AG3wahA9jaKjLDB1LpHLBrzN89CjkgVG/RIUWPqvDklnWhE2EZh3Xmwu03HRvGXC1S+0R2fDfFHfyArgjpEhfmMC+bdrPjuGm5M3/Dn6FZ7zit6aWX2Mtsr7FwrUnwvDKSfNIVfNlUfT6CGb4rrrvi8VaYaDBG8AuCbavzkgy+SkRdB++emExJgbtiaLKco7GBw094bfymqAGVrfW8/tC8c7qHQXVOljO+xQOdSvdS/ormuluQ9MvRyv4py7SuSkzr5vY3j12hPJYh8kpTNagW6TETG8kMJbXc4Rh63T7GIvJ7JvbifdG2XK0jMuZJcGicS4bLPw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1715692885; bh=7PngqoAxqPKK6rji8ZXq+PM5bGW2MtZgRGUZKxTTZ88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gdQ0J_Br94oCe2TxtlkhaCzC6mwT7Cf69Og3noUSFV6FeD3hzSzouhUJiQFJeJn4tTTO Q8DCtddvnZ1wq_0jWjMmAuSfQ8HcvAgx.isOhHZgHgpL6oQL6E0TLIty3fho0cK6k8b9AjlUHE1y GbQQJFeBv3hgnLZKmZZE4QYo8_FZJAXhTMhC78Q95k7SvROz_iB7j_L1uYcQm2rR9nL9MhKQbmhG bQxqmV6rCvPNpD2HCbcb02Pvq14bg.gz3h0GcQdnTQ5QC9EgYZ782.FD7WhS1HsCAqKUCJrA6Piq z_USTX3U2OyDM8hHb1BwyH0fxwG3KMsglDsadfKrMGBQL2NMyEPQYp8RyzrPoRWAuM7L4EQ712.. NKy.X1BIhfuJg1lUMuIYZWnbhG62fRPgIgsrqlJ_ndVwS5ghEs8t_nKkJr.PjnYruDKeTowzw9mk UfTGYjEErCgeAuRArUo4veQALnQxln8cAnin8yYtgAJL7JOPfB3ONNwTZwuDaSqJ14GjeNsBwM1d yDP.mDjutRQh9sh6t7aZtsaBr33rrS8tw_fC1TA-- X-Sonic-MF: X-Sonic-ID: 8705d1b8-d904-44ac-a0a6-bd8618fbaf99 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Tue, 14 May 2024 13:21:25 +0000 Date: Tue, 14 May 2024 13:21:20 +0000 (UTC) From: Vadym Krevs To: Andy Shevchenko , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= Cc: Bagas Sanjaya , Linux Kernel Mailing List , Linux Regressions , Linux Serial , Gilles Buloz , Greg Kroah-Hartman , Jiri Slaby Message-ID: <645803059.1237606.1715692880298@mail.yahoo.com> In-Reply-To: <6bfafddc-cf5b-4829-e09b-2622aaf83093@linux.intel.com> References: <606328522.1205749.1715678929830@mail.yahoo.com> <6bfafddc-cf5b-4829-e09b-2622aaf83093@linux.intel.com> Subject: Re: [regression] [bisected] commit 6bb6fa6908ebd3cb4e14cd4f0ce272ec885d2eb0 corrupts data sent via pseudoterminal device Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.22321 YMailNorrin On Tuesday, 14 May 2024 at 12:03:25 BST, Ilpo J=C3=A4rvinen wrote: =C2=A0 > On Tue, 14 May 2024, Andy Shevchenko wrote: >=C2=A0 > > On Tue, May 14, 2024 at 12:28=E2=80=AFPM Vadym Krevs = wrote: > > > > > > It's a standard setup for an out-of-the box default install of openSU= SE 15.5 with KDE. All tests done in Konsole with bash as shell. > > > > > > stty -a -F /dev/pts/1 > > > speed 38400 baud; rows 57; columns 217; line =3D 0; > > > intr =3D ^C; quit =3D ^; erase =3D ^?; kill =3D ^U; eof =3D ^D; eol = =3D ; eol2 =3D ; swtch =3D ; start =3D ^Q; stop =3D ^S= ; susp =3D ^Z; rprnt =3D ^R; werase =3D ^W; lnext =3D ^V; discard =3D ^O; m= in =3D 1; time =3D 0; > > > -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts > > > -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ix= on ixoff -iuclc -ixany -imaxbel iutf8 > > > opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 b= s0 vt0 ff0 > > > isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -e= choprt echoctl echoke -flusho -extproc > > > > Thank you! > > > > Yeah. SW flow control is enabled, but I don't see which character is > > being used for that. Anyway, let's give Ilpo a chance to look into > > this. >=C2=A0 > Thanks a lot for pinpointing the commit with bisect. It turns out this > is a quite bad corruption bug and I'm quite surprised I didn't see (or > notice) it while testing the patch. >=C2=A0 > Could you please test and confirm the patch below fixes the issue? > -- > [PATCH] tty: n_tty: Fix buffer offsets when looked ahead is used >=C2=A0 > When lookahead has "consumed" some characters (la_count > 0), > n_tty_receive_buf_standard() and n_tty_receive_buf_closing() for > characters beyond the la_count are given wrong cp/fp offsets which > leads to duplicating and losing some characters. >=C2=A0 > If la_count > 0, correct buffer pointers and make count consistency too > (the latter is not strictly necessary to fix the issue but seems more > logical to adjust all variables immediately to keep state consistent). >=C2=A0 > Reported-by: Vadym Krevs > Fixes: 6bb6fa6908eb ("tty: Implement lookahead to process XON/XOFF timely= ") > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D218834 > Cc: stable@vger.kernel.org > Signed-off-by: Ilpo J=C3=A4rvinen > --- > drivers/tty/n_tty.c | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) >=C2=A0 > diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c > index f252d0b5a434..5e9ca4376d68 100644 > --- a/drivers/tty/n_tty.c > +++ b/drivers/tty/n_tty.c > @@ -1619,15 +1619,25 @@ static void __receive_buf(struct tty_struct *tty,= const u8 *cp, const u8 *fp, > else if (ldata->raw || (L_EXTPROC(tty) && !preops)) > n_tty_receive_buf_raw(tty, cp, fp, count); > else if (tty->closing && !L_EXTPROC(tty)) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (la_count > 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (la_count > 0) { > n_tty_receive_buf_closing(tty, cp, fp, la_count, true); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (count > la_count) > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 n_tty_receive_buf_closing(tty,= cp, fp, count - la_count, false); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cp +=3D la_count; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (fp) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fp +=3D la_count= ; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 count -=3D la_count; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 } > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (count > 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 n_tty_receive_buf_closing(tty,= cp, fp, count, false); > } else { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (la_count > 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (la_count > 0) { > n_tty_receive_buf_standard(tty, cp, fp, la_count, true); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (count > la_count) > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 n_tty_receive_buf_standard(tty= , cp, fp, count - la_count, false); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cp +=3D la_count; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (fp) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fp +=3D la_count= ; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 count -=3D la_count; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 } > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (count > 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 n_tty_receive_buf_standard(tty= , cp, fp, count, false); >=C2=A0 > flush_echoes(tty); > if (tty->ops->flush_chars) > -- > 2.39.2 Yes, I've tested the patch against the 6.9.0-rc7-local-00012-gdccb07f2914c = kernel (last commit=C2=A045db3ab70092637967967bfd8e6144017638563c from May = 8th)=C2=A0and it works just fine.=C2=A0 Thank you very much for fixing the problem so quicky. Kind regards, Vadym P.S.: Hopefully, Yahoo mail has actually sent this reply as plain text.