Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3129425imm; Sun, 7 Oct 2018 21:08:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV632Wje70JcjK4C/yIp5VSJK4LIH4zSp65dMhoFWd81Gk6qMQ/pbcdJ31flkuvqWiRu0I4iB X-Received: by 2002:a17:902:650f:: with SMTP id b15-v6mr22248125plk.2.1538971682365; Sun, 07 Oct 2018 21:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538971682; cv=none; d=google.com; s=arc-20160816; b=VwSMTIt1vJIUslM2MZykYZy5lEwGegHdp/ZVsypY9llaB3UiPqhhbgffwqWFLYWar0 2kB0Wl8IQTDKZqta6vtvfVbsK/+ONQ1Ro9s92i474MkSJbgnIKM9SH+CM8fs0yx+N6uE zF5ejrDlO5eprPaDQydbSzWwp9xHpPr5lzq7qFYeeI3MstWlBB6Xuz5V5BM89wYM+HzE pPOrYqZIID57+SqPTC+Nt3SpjltMJEYxpXnyhXAcfqwP/4QDvOWmgpI1wFF/ry87VqMz dhFHVpIIyTaIcSpMgnEmmR4ewS2a2pYZ0hdNk9DlFQUuvCbjq3FfyvW7kt+12I/sdUGD wfJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Gc4Y3YQXb9RsZs3+lK2Ww5qHogG12h9+4Y9NQ5DIiRQ=; b=iZQadKoUf+p1+vAJfCBbPq7k8WHstvEZzDAd33rMS1UHBEbocOyr7jc9yeyQ5/piDZ RsIvMGyAqrfUt5aybQw+r23XfUCGVyqyDqXTLQNYGxvCzGPAjFKoDCJMpqcgw7oZa7W3 CjDJg8zjmoGyIPUcif4mMzD7j4dmDEUzd39iW+iHUTyTHg0uWNB6xAUTSWkAYqIqNTKZ /meiqrjYZHxKrOB5rbrzbhQ68FsSNlAyBszcZH1Hd2yf4CRpFDRS1f6ZxStPnzIoIWW1 uryuE207PX/MdiVv7rkz9pNAPhimIpAGIGettStQPMQ2wlvabJnRf9aqrkhR10RUS6p1 LQ/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11-v6si15533132plq.63.2018.10.07.21.07.47; Sun, 07 Oct 2018 21:08:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbeJHLRD (ORCPT + 99 others); Mon, 8 Oct 2018 07:17:03 -0400 Received: from terminus.zytor.com ([198.137.202.136]:56901 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725760AbeJHLRC (ORCPT ); Mon, 8 Oct 2018 07:17:02 -0400 Received: from carbon-x1.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w9846Y3R459574 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 7 Oct 2018 21:06:34 -0700 Received: from carbon-x1.hos.anvin.org (localhost [127.0.0.1]) by carbon-x1.hos.anvin.org (8.15.2/8.15.2) with ESMTP id w9846S641248324; Sun, 7 Oct 2018 21:06:28 -0700 Received: (from hpa@localhost) by carbon-x1.hos.anvin.org (8.15.2/8.15.2/Submit) id w9846Meo1248323; Sun, 7 Oct 2018 21:06:22 -0700 X-Authentication-Warning: carbon-x1.hos.anvin.org: hpa set sender to hpa@zytor.com using -f From: "H. Peter Anvin" To: linux-kernel@vger.kernel.org Cc: Tobias Klausmann , "H. Peter Anvin (Intel)" , Greg Kroah-Hartman , Jiri Slaby , Al Viro , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Gleixner , Kate Stewart , Philippe Ombredanne , Eugene Syromiatnikov , linux-alpha@vger.kernel.org, linux-serial@vger.kernel.org, Johan Hovold , Alan Cox , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , stable@vger.kernel.org Subject: [PATCH stable v2 0/2] termios: Alpha BOTHER/IBSHIFT, tty_baudrate fix Date: Sun, 7 Oct 2018 21:06:18 -0700 Message-Id: <20181008040620.1248277-1-hpa@zytor.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin (Intel)" It turns out that Alpha is the only architecture that never implemented BOTHER and IBSHIFT, which is otherwise ages old. This is one thing that has held up glibc support for this feature (all other architectures have supported these for about a decade, at least before the current 3.2 glibc cutoff.) Furthermore, in the process of dealing with this, I discovered that the current code in tty_baudrate.c can read past the end of the baud_table[] on Alpha and PowerPC. The second patch in this series fixes that, but it also cleans up the code substantially by auto-generating the table and, since all architectures now have them, removing all conditionals for BOTHER and IBSHIFT existing. Tagging for stable because these are concrete and immediate problems. I have a much bigger update in process, nearly done, which will clean up a lot of duplicated code and make the uapi headers usable for libc, but that is not critical on the same level. Tested on x86, compile-tested on Alpha. SPARC, and PowerPC. v2: the CBAUDEX masking-as-fallback code was wrong, but it could never be exercised on any architecture anyway (gcc would not even emit it) so just remove it. There are thus no object code changes from v1. --- arch/alpha/include/asm/termios.h | 8 +- arch/alpha/include/uapi/asm/ioctls.h | 5 + arch/alpha/include/uapi/asm/termbits.h | 17 +++ drivers/tty/.gitignore | 1 + drivers/tty/Makefile | 16 +++ drivers/tty/bmacros.c | 2 + drivers/tty/tty_baudrate.c | 182 ++++++++++++--------------------- 7 files changed, 114 insertions(+), 117 deletions(-) Signed-off-by: H. Peter Anvin (Intel) Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Al Viro Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Thomas Gleixner Cc: Kate Stewart Cc: Philippe Ombredanne Cc: Greg Kroah-Hartman Cc: Eugene Syromiatnikov Cc: Cc: Cc: Johan Hovold Cc: Alan Cox Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: