From patchwork Wed Jan 9 03:54:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155045 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp255629jaa; Tue, 8 Jan 2019 19:57:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN4XcZeHeJn3MkzfjuMYlHsBOtIYLtMwx7fW6nK79Znvo6kb/V+UbsurFrLJL9izQPMScGyn X-Received: by 2002:a63:6b05:: with SMTP id g5mr3854505pgc.15.1547006159564; Tue, 08 Jan 2019 19:55:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006159; cv=none; d=google.com; s=arc-20160816; b=COfb4Y+lTPsWvest+iBZYmTK+AncGjZQpfbZf4X6mVD2k78qCUlMyVvuoZIcx/oHK7 21F8+skjwu6zOo5NO06v8qB2eE4mHWq6qcMa+wp7iDw+mgPtaq7pTW+Ci0y575Oey8v0 1KMmeHXZlY7ze8YD8R3NTqL88Ha+0S/vPZnHudt0G6m6f8ANklqs3iucA5x93w3hn7b7 A8E8EWclIy2geE8QmU4wFW6jILqGzNq6LWzBSSR22Bm5FcPWWNV7//KMzVhrV4C0AZ89 pVAtDi+nnGOKN/jKwulXIsWTxVF9RZHsKRMJ3zfqAb65JqxErZx6aNsCnVjpldYsHObN bwJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AmyLjgBBCj6oc3J9NLEQ15OP3X0xj6BVkHsydRd3U60=; b=bgBDL9WFcPO0YShoJaRRbAE/dG9S6FZea9GMFpmoh1hmZX+YYdQVvWJJ6vGQ7LxYYa dnuZIOH+5H294H+lCZJr/AsBZTEoUMZxqVgsHJBjJiKpvRJiYwC7ZZtPQ287wAbg/e5W zCpPDuIVK7HZ7tMdijWYBrG81xBsFCLJGxwvxWn9qCGV+EpxUVrqrwA0+zipKa1NC3iR oi97rMMS71oubI4TLfDm1iTEvpIIyyZ+e2oXV0ObzxYiGM510QUU2AyVWeQsL5rnaH3Y MoNLykaWSdxDqB+vNuPgPm+JiWE4h1Rrus8Qx9TRVqE5C550kjCQ+XOqh7ae/OmFNJmX 9Mqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=RoISlc7J; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m39si10551398plg.315.2019.01.08.19.55.59; Tue, 08 Jan 2019 19:55:59 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=RoISlc7J; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729402AbfAIDzw (ORCPT + 31 others); Tue, 8 Jan 2019 22:55:52 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:56242 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbfAIDzt (ORCPT ); Tue, 8 Jan 2019 22:55:49 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 9390F119303; Tue, 8 Jan 2019 22:55:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=efjSLXWMsEa9kIKOsVZ02niDE Ro=; b=RoISlc7JQddGZ45MNYdE176p9Ar+pIL8qhRyTKO0eEmDr4WiYVv39CQOf 5jQp1V0CS/swp9JW/HN8f7pfKp88Cg/0Iw075poRKUPI6M2tliW/fMpGzPgUPR8m AsEyhYXYGKea+nn6bMyTR+XwHkrP2UajvkaTwUccc1USn01Jyk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 892491192FF; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 0CBEF1192FC; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 3069F2DA0419; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] vt: make vt_console_print() compatible with the unicode screen buffer Date: Tue, 8 Jan 2019 22:54:59 -0500 Message-Id: <20190109035504.8413-2-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 7186B80C-13C2-11E9-83F5-70EFDD2159A7-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kernel messages are printed to the console, they appear blank on the unicode screen. This is because vt_console_print() is lacking a call to vc_uniscr_putc(). However the later function assumes vc->vc_x is always up to date when called, which is not the case here as vt_console_print() uses it to mark the beginning of the display update. This patch reworks (and simplifies) vt_console_print() so that vc->vc_x is always valid and keeps the start of display update in a local variable instead, which finally allows for adding the missing vc_uniscr_putc() call. Signed-off-by: Nicolas Pitre Cc: stable@vger.kernel.org # v4.19+ --- drivers/tty/vt/vt.c | 47 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 41ec8e5010..b9004bd087 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2884,8 +2884,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) unsigned char c; static DEFINE_SPINLOCK(printing_lock); const ushort *start; - ushort cnt = 0; - ushort myx; + ushort start_x, cnt; int kmsg_console; /* console busy or not yet initialized */ @@ -2898,10 +2897,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) vc = vc_cons[kmsg_console - 1].d; - /* read `x' only after setting currcons properly (otherwise - the `x' macro will read the x of the foreground console). */ - myx = vc->vc_x; - if (!vc_cons_allocated(fg_console)) { /* impossible */ /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */ @@ -2916,53 +2911,41 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) hide_cursor(vc); start = (ushort *)vc->vc_pos; - - /* Contrived structure to try to emulate original need_wrap behaviour - * Problems caused when we have need_wrap set on '\n' character */ + start_x = vc->vc_x; + cnt = 0; while (count--) { c = *b++; if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { - if (cnt > 0) { - if (con_is_visible(vc)) - vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); - vc->vc_x += cnt; - if (vc->vc_need_wrap) - vc->vc_x--; - cnt = 0; - } + if (cnt && con_is_visible(vc)) + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); + cnt = 0; if (c == 8) { /* backspace */ bs(vc); start = (ushort *)vc->vc_pos; - myx = vc->vc_x; + start_x = vc->vc_x; continue; } if (c != 13) lf(vc); cr(vc); start = (ushort *)vc->vc_pos; - myx = vc->vc_x; + start_x = vc->vc_x; if (c == 10 || c == 13) continue; } + vc_uniscr_putc(vc, c); scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); notify_write(vc, c); cnt++; - if (myx == vc->vc_cols - 1) { - vc->vc_need_wrap = 1; - continue; - } - vc->vc_pos += 2; - myx++; - } - if (cnt > 0) { - if (con_is_visible(vc)) - vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); - vc->vc_x += cnt; - if (vc->vc_x == vc->vc_cols) { - vc->vc_x--; + if (vc->vc_x == vc->vc_cols - 1) { vc->vc_need_wrap = 1; + } else { + vc->vc_pos += 2; + vc->vc_x++; } } + if (cnt && con_is_visible(vc)) + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); set_cursor(vc); notify_update(vc); From patchwork Wed Jan 9 03:55:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155042 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp254674jaa; Tue, 8 Jan 2019 19:55:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7rkrmubUGFE0rL7E4ZWdQfuUPTp1DMrWfffFHycumA/4gCQxL64GC4dtCeyD60xGfKSnUz X-Received: by 2002:a62:2cf:: with SMTP id 198mr4416191pfc.67.1547006148844; Tue, 08 Jan 2019 19:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006148; cv=none; d=google.com; s=arc-20160816; b=n0L+lu5zwvjIPZOFBdGuKGP6TgAHs37e6ZDSwc4Os3/TjcfDqfMtzP+E7RWposXyqX pU3joNF2D3HaY1AGQ72usWyNVn1NT/gZ4Lw1rRY9dg6fOdbYHxv2/cFgFxjNfjQm+pkU fH8YhSE0htpf7a8/he5Xwsakqdefg/S7vYAwdnNdye+CYf6ddlvBdWy53ZkEsuknaSZo f67WBwIhm536SEZIcjAOcxAcs0dSp/2Vgj6/jAqptQ5plOlAdLaVIjzvv5dCSSkUWv6N TD5I4uSIj+Pp/P67hF30yocVJ4IbvwmcqaD1W5gasexHBjnwm38zcGM/vUfWgdirZYpz X2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rncEwA0OlWlyYnPllVBLdEKszVHRyTdh4mWBzRxvR34=; b=CfrOjC+hSWbBOo5XE5RwwmLcvuWj2Sb4/GVMziRVgNcALvOHeIhwumTmNd46jDeAyP X3wyvZv65YNywGSJLJ5KwQbaZkTg3lIWVO63561ylXAN5m3hH04AZd+pbiDsHg/ZnCPK kbYTUmLRTmqYV9V2ei/vEaAqc4QcTedxRoj5FmT8d2FCk7aLD1X2VGfmvoz0Xql/UUSh scFcskmv3/Lh2DFh/fh9h9NLbmYHsYs0S2EToWMsNfspvU7BPpvANNAbs+nWCYAs9+Yr EZfTL/xC0PlyvFR0e5qw4OOY9TwhPcasAjkkJvQT8rFyQeVbeT9njbgCwvNQHJ2ESpfW Q5rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=QyCZDEEd; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v83si68407139pfk.264.2019.01.08.19.55.48; Tue, 08 Jan 2019 19:55:48 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=QyCZDEEd; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729201AbfAIDzr (ORCPT + 31 others); Tue, 8 Jan 2019 22:55:47 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:62701 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728278AbfAIDzr (ORCPT ); Tue, 8 Jan 2019 22:55:47 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id BFC68119305; Tue, 8 Jan 2019 22:55:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=O5HoLbt0EAT7EAsbBj0FKXLgN eQ=; b=QyCZDEEd537clSdq4Jx0eEd+9cdY7t6MpqT9WiVVk76i5IUEib3c0iIa7 VL/B0YW6qCEXvzWm5IxNoEGdsGp9k1k1aKvSMv9yEQ2gztcwUqmu2Qp78xjlv8c/ EcpttwAC5C09L2huRdvUQJqriXnWUGS3LkYnVoR0mlAUjD3AWc= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id B5913119304; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 288741192FD; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 4EB392DA041D; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] vt: always call notifier with the console lock held Date: Tue, 8 Jan 2019 22:55:00 -0500 Message-Id: <20190109035504.8413-3-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 719702DE-13C2-11E9-A82B-70EFDD2159A7-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Every invocation of notify_write() and notify_update() is performed under the console lock, except for one case. Let's fix that. Signed-off-by: Nicolas Pitre Cc: stable@vger.kernel.org --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index b9004bd087..5b8b0e33f9 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2764,8 +2764,8 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co con_flush(vc, draw_from, draw_to, &draw_x); vc_uniscr_debug_check(vc); console_conditional_schedule(); - console_unlock(); notify_update(vc); + console_unlock(); return n; } From patchwork Wed Jan 9 03:55:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155043 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp254712jaa; Tue, 8 Jan 2019 19:55:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ppsa8xKFxJe/k9cXqs9kuIPeQ5GPokI1J/+vNP49XzUs71KoBaqWxjA5hJbqVFmY72TeQ X-Received: by 2002:a63:170c:: with SMTP id x12mr3869554pgl.364.1547006152842; Tue, 08 Jan 2019 19:55:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006152; cv=none; d=google.com; s=arc-20160816; b=U9auUTD2d7/HURYmLqXqYdydh8SwtVFCSYAKVEBA0a1kXGUF5YRuwUFW6/CNgArdLv bfYTEfFBN5AmfWxHaVxqXBFCrlGxBbbkjZGNIOVIE6WvB+IjFkckdUIsbQPLDGBwlZ39 2QSEAfZ6ttNdPXpCemnhKlcbmnwPl2qXBcIe1uqpc7kAfN08Ami3teBnkhfiIVMyWcNx YkvrzBtPHULJHdOBJ8cZHNqVYW99i2VFbPAU5YWTD0/2QQysA2oaefOB0I1yiEY0rdyP DnU0LwfRwv8QV5t1MKvzJ1Dcub84H5B16sokuKpKnORUBE7tchF+7sfhFfQi0Ym1j3y3 PPEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YMApujsUN1ywHKAbbwqwbxwfhoGR1g+9jtipb5hc8fg=; b=fAxKLqMZ9gGMHtfqKmqa5tN3ySpLUWcF5SphSxP5PPGbydOFslbb+x3HlYchh3gcRT 6LV+IL28lZKF/SIZmXbA1GUe9NNV0WMFGhcbuqtNmjKqRktzaOhnlc5VecBorg+5VEQ9 k4jW9jy5oQVdJyKzMTSnvnx3IKEDgv2pQc3XezutN35EXnP1ZB7Rd8ZyJ6jYP1Ks3LgN cOvXnu8YS7fi9S4slIJZiw4i3b9v3/7JvBPqTqM57QCsDFdKhESjnWe9jtkW0+Ibej55 BXvIOiQBaAJgvRfd+8Hnoj8xBw7W4aLV079/iauzty8B950q8a5bRKtKaxV2AJ/ZASNA RDfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=en0QQLc2; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si61249842pgm.21.2019.01.08.19.55.52; Tue, 08 Jan 2019 19:55:52 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=en0QQLc2; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729327AbfAIDzv (ORCPT + 31 others); Tue, 8 Jan 2019 22:55:51 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:51069 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729053AbfAIDzt (ORCPT ); Tue, 8 Jan 2019 22:55:49 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id E979F119307; Tue, 8 Jan 2019 22:55:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=Ok46tFcJgtlME1pfsnHQK5+Pv zg=; b=en0QQLc2+VxmZCMeF3q0DJ6epSt36wSmNXyaqmxlDk+VwPxLbN6Vi2J3l CasnCSLDeM2IobKgJ7SCsWeHPsDmdfFdQFgBRvKJHsHuqddW6Kh6X2tQXwnB9svO gCZ7BcwQg1kSS0L9zUPoBR4OJQ++pB7yMx90BxuvERQ5+fluks= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id E10AF119306; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 5D2BC1192FE; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 7F4A72DA05DD; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] vt: invoke notifier on screen size change Date: Tue, 8 Jan 2019 22:55:01 -0500 Message-Id: <20190109035504.8413-4-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 71B86960-13C2-11E9-9F5D-70EFDD2159A7-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org User space using poll() on /dev/vcs devices are not awaken when a screen size change occurs. Let's fix that. Signed-off-by: Nicolas Pitre --- drivers/tty/vt/vt.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5b8b0e33f9..bba75560d1 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1272,6 +1272,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, if (con_is_visible(vc)) update_screen(vc); vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); + notify_update(vc); return err; } From patchwork Wed Jan 9 03:55:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155044 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp254734jaa; Tue, 8 Jan 2019 19:55:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN7TGYheve/FuEIy13LCyC5J/DthtZuiur3oGmOjjNuTvKZ6XVapbGsFC3SZfAjvIG7XLE8m X-Received: by 2002:a63:3602:: with SMTP id d2mr3886017pga.404.1547006155633; Tue, 08 Jan 2019 19:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006155; cv=none; d=google.com; s=arc-20160816; b=FUFeNOc6N0lgeg6pqZUHsU7e/hmYFVZlerbuR3IL08APP5sN+0alXk17Svd9+SDvG/ bm22gsGk+wlP8MaxWCNsqrVSLb7lcANNHLVAA86ypG5rgVAp0NxN+0ywp1KAhtgboz0W /4B5lKVaYstUzRs26PVVcBAFVc5DSmooEJHdMQeLNjCHjpOnTsqgr+0WHVikjpnYfpU6 F/akaSiYuxccbcaei4NTS7p6u/rB8mWHc5v5lSSqE1RpIQcfeU+PpnsXs2pz4pxDTnw+ T3SIBXlqCBuSUsIXu30NlIjYaHJ4/prGTjFIatQk+UJKVkdqHBVt4phaO6cwIIurUOV0 PMiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Dv01mCvUpuQlYx45hJPhTLqf1ZdQDmBP145IArq4pc=; b=Bp+lMnLsSuMN0BeFFr7kjdUz12gGwWsuWaH3P5NRB34B7PmYp533ZQcGIEzw+fueq4 uMqDqI1PkvzMWnX13W0ii4885AlEanUaqskz07XL8oYrzn5b+s2rduBJlXA1cN7DKVK0 +Wtra7QLfEyctdMH3yD56jACXevDUo5xA6FuV+ScA93qkY01VELejK/G4+W2nLtpnWhI r7SL+e8EZ1FSemPzragn6u5zm7BzL0Kp1KRhCemLx+NoAcziJtQOthHpg9EiKkcG0DQP qYiHwuLLqL29vOGwfAO/3SWhnxtYbAkxyjKZBBwbfZ9T0Gd+wbeDglOxk/QFkMSVaMDd SVEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=MDP5Eu2g; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si61249842pgm.21.2019.01.08.19.55.55; Tue, 08 Jan 2019 19:55:55 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=MDP5Eu2g; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729463AbfAIDzy (ORCPT + 31 others); Tue, 8 Jan 2019 22:55:54 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:52600 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729172AbfAIDzt (ORCPT ); Tue, 8 Jan 2019 22:55:49 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 2E323119309; Tue, 8 Jan 2019 22:55:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=6xfC+s0P4dYOGWNJOn3g1/ibg c4=; b=MDP5Eu2gJD2ROAPU0wxTvj2CVPzy8yKEYZV71nwHKfZ9rHDqt6m1fEOnH /X76HlTKqVhRWhcY/kbT6/mpvyUd41e5R8aJMlMmCS542jKSsyEPWDhiaySinge3 giVGP/1mADbnphsrvVtDyihR8c59aRF4oWb0UHO5EnCWN7Z324= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 23627119308; Tue, 8 Jan 2019 22:55:47 -0500 (EST) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 8CF2C119300; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id A91942DA06DA; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] vcsa: clamp header values when they don't fit Date: Tue, 8 Jan 2019 22:55:02 -0500 Message-Id: <20190109035504.8413-5-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 71D63472-13C2-11E9-BDB8-70EFDD2159A7-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The /dev/vcsa* devices have a fixed char-sized header that stores the screen geometry and cursor location. Let's make sure it doesn't contain random garbage when those values exceed 255. If ever it becomes necessary to convey larger screen info to user space then a larger header in the not-yet-implemented /dev/vcsua* devices should be considered. Signed-off-by: Nicolas Pitre --- drivers/tty/vt/vc_screen.c | 5 +++-- drivers/tty/vt/vt.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 2384ea85ff..3dba60825c 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -335,8 +335,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) if (p < HEADER_SIZE) { size_t tmp_count; - con_buf0[0] = (char)vc->vc_rows; - con_buf0[1] = (char)vc->vc_cols; + /* clamp header values if they don't fit */ + con_buf0[0] = min(vc->vc_rows, 0xFFu); + con_buf0[1] = min(vc->vc_cols, 0xFFu); getconsxy(vc, con_buf0 + 2); con_buf_start += p; diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index bba75560d1..f519c22e70 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4591,8 +4591,9 @@ EXPORT_SYMBOL_GPL(screen_pos); void getconsxy(struct vc_data *vc, unsigned char *p) { - p[0] = vc->vc_x; - p[1] = vc->vc_y; + /* clamp values if they don't fit */ + p[0] = min(vc->vc_x, 0xFFu); + p[1] = min(vc->vc_y, 0xFFu); } void putconsxy(struct vc_data *vc, unsigned char *p) From patchwork Wed Jan 9 03:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155048 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp260800jaa; Tue, 8 Jan 2019 20:04:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN5bS8yNsEj3N1i4Xbz1r1OqvmYH2xSlnAuKBCji0bivO8IcybcX7wr2Siym4uExFmw/60Ue X-Received: by 2002:a17:902:22f:: with SMTP id 44mr4433252plc.137.1547006678698; Tue, 08 Jan 2019 20:04:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006678; cv=none; d=google.com; s=arc-20160816; b=TEZjTQzZgRiXLtxHXg60AVz1+pk5n6DLT1G3bFwIRoKenJNbTPSKmn7rj055e6eh79 YKbOFSEqyN431MyhaF1rk2XhdpAKcCfRqqltp0x5TUp79i8WLZwzKxp+z1wLy4arfX58 y4hq4zj8tfKu5q7U51f5uNCr65AaF9NiYYqnVkQQVwSayC3PFt4pipgUbxJJkvDhiyKC yXgzgIuynvttZfGXN6HkndvZN9fz97OgskhG08KCpJInMEc3alVHWZNfR5jfC4zTta/x i9RjVWkeBpAprx5GdEC2yNhuG9zDYz6xeEnhHvxY44bVphSfsqYoKxNQ/xandYCDxf6E 1fXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RiDIhn3k+y3rCrALgB+0GpXM6fBO8JgdX0ogmxvYqgQ=; b=BjRUgljcSEL5NkxwLxeWXcNQaVPhnxYL2bUZBs7DznvkrNbSzp1epoHYsWuJZdFI6X +SK2rV0gLjfZc6YuwR9RnOH9ciMnHVTglLJ023+1VwueTctxiHCrJ5YHBfddEyc+m01U kjMFRbwogvj44INZ36cmmjRz1fmccg2WGZcN7ROiuNPYP7W75IwaxP2+oE1l28gNQeyo r7vI3OzJAO3tBbUG5Dn44xuwPT/Gr+8UmVNUku74YTM67obXKvvFsdJfXVBO0RBAXRAq rmg7gEZ1dIPCfHExLf23+WhdaGSSY4BYp++9MOxlDChrHILzS05TKEyLjqJvNiQOD0sO /DDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=jlzCwbui; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si66252484pgj.34.2019.01.08.20.04.38; Tue, 08 Jan 2019 20:04:38 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=jlzCwbui; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbfAIEEh (ORCPT + 31 others); Tue, 8 Jan 2019 23:04:37 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:59851 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbfAIEEh (ORCPT ); Tue, 8 Jan 2019 23:04:37 -0500 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 099F65C4AA; Tue, 8 Jan 2019 22:55:51 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=/oWaIbI7kf1YpW02K4Zc5hquC hM=; b=jlzCwbui5GC/9wY/IYIIaT8RSrLknPxqW424qnBcWwTdOVN1DeG/z7c+U c7lI6Tuoy+NeREdbbGJDG3oscKBfhK2jgN2jXXQ6dluJAOqwGjApz2dRncTrgvwv yFSPMGUHoAYBkm7xepAo+bSt7DpOP369dfSGxLIBcqOaVKG82Q= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 03CC85C4A9; Tue, 8 Jan 2019 22:55:51 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 1D93D5C4A8; Tue, 8 Jan 2019 22:55:48 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id CD8FB2DA06F2; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] vcs: poll(): cope with a deallocated vt Date: Tue, 8 Jan 2019 22:55:03 -0500 Message-Id: <20190109035504.8413-6-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 72C0E60C-13C2-11E9-9222-D889C09F693B-78420484!pb-smtp20.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When VT_DISALLOCATE is used on a vt, user space waiting with poll() on the corresponding /dev/vcs device is not awakened. This is now fixed by returning POLLHUP|POLLERR to user space. Also, in the normal screen update case, we don't set POLLERR anymore as POLLPRI alone is a much more logical response in a non-error situation, saving some confusion on the user space side. The only known user app making use of poll() on /dev/vcs* is BRLTTY which is known to cope with that change already, so the risk of breakage is pretty much nonexistent. Signed-off-by: Nicolas Pitre --- drivers/tty/vt/vc_screen.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 3dba60825c..1bbe2a30cd 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -80,7 +80,7 @@ struct vcs_poll_data { struct notifier_block notifier; unsigned int cons_num; - bool seen_last_update; + int event; wait_queue_head_t waitq; struct fasync_struct *fasync; }; @@ -94,7 +94,7 @@ vcs_notifier(struct notifier_block *nb, unsigned long code, void *_param) container_of(nb, struct vcs_poll_data, notifier); int currcons = poll->cons_num; - if (code != VT_UPDATE) + if (code != VT_UPDATE && code != VT_DEALLOCATE) return NOTIFY_DONE; if (currcons == 0) @@ -104,7 +104,7 @@ vcs_notifier(struct notifier_block *nb, unsigned long code, void *_param) if (currcons != vc->vc_num) return NOTIFY_DONE; - poll->seen_last_update = false; + poll->event = code; wake_up_interruptible(&poll->waitq); kill_fasync(&poll->fasync, SIGIO, POLL_IN); return NOTIFY_OK; @@ -261,7 +261,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) poll = file->private_data; if (count && poll) - poll->seen_last_update = true; + poll->event = 0; read = 0; ret = 0; while (count) { @@ -616,12 +616,21 @@ static __poll_t vcs_poll(struct file *file, poll_table *wait) { struct vcs_poll_data *poll = vcs_poll_data_get(file); - __poll_t ret = DEFAULT_POLLMASK|EPOLLERR|EPOLLPRI; + __poll_t ret = DEFAULT_POLLMASK|EPOLLERR; if (poll) { poll_wait(file, &poll->waitq, wait); - if (poll->seen_last_update) + switch (poll->event) { + case VT_UPDATE: + ret = DEFAULT_POLLMASK|EPOLLPRI; + break; + case VT_DEALLOCATE: + ret = DEFAULT_POLLMASK|EPOLLHUP|EPOLLERR; + break; + case 0: ret = DEFAULT_POLLMASK; + break; + } } return ret; } From patchwork Wed Jan 9 03:55:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 155047 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp258608jaa; Tue, 8 Jan 2019 20:01:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ji2J+wLiAg4l1lP/+aa64RkZmgz84JByy34SMTeGxA8uPZN3kitw65BbZJcXiiNyao9Hx X-Received: by 2002:a62:9719:: with SMTP id n25mr4565736pfe.240.1547006514415; Tue, 08 Jan 2019 20:01:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006514; cv=none; d=google.com; s=arc-20160816; b=FU2eP+8Fe+9QKg628ibs+y4Qx9x2THbe0kvJXZ/zav+w9uNxyZ6xm7Q1ivQWRbxhui XP5pQ4/elLEE2dwkqRxQuA17Tj0t9AHaPKKYZuU4qXfK6xTQliEtraaLdrNb3kD/X3k3 kwQ6yRh1xOY/f0/KlSrFIE6NPy0LswP39mjKVyQH2+rZH9MHI6kQOY+5Nzvjb7J5Ewbc od240aUMZGv6v2z26SGamIdCmPDcsG39GNAhSE/shs6yW1KsFv2kikr63ziMWvW4MrJV HvY0mmXWBKRMxxKGli+xGTHsOzkqduWd5CbzMxDJSf676UrEIRqdOQJ8IBU2LHQEjaMz MP8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qy7ecYNlukhEFJ1qzRyH/ib5ioiLv914cTZEKVeuLFw=; b=yC8Y5fdgqvp77lEf5YH5wcKDIvDS4wgOzVFAyt6ASWMb2HQKncg+aG9x+NwKD7aO31 Ok3Ue/E3tPiVt8eadcuOj/nLJ4XTWcjgIe4c2aKmPgiKx/U2/+EH4dMvHPPVQ+gxfznE 0phcr/VXIG8RATVCxhcQG0XeL2nKn//8uwQC/z4VAaVECeq151HmYa6et4fa1VCjuvRg 4qTBb5EP1IlniPHJ2qS4WoGiYMaEGjU9nAvkMVs5ucNNV2aJXGi4Jq3FWRpSm14NntFj 32YFoy8BTFrUTIZPvrJ1PTxW8UiHPORKQQX9ef2TiKQ6sJ201VG8B7C+mGlIdy4/ScOU 4nSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=a3lYeLFy; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k19si24458041pgn.20.2019.01.08.20.01.54; Tue, 08 Jan 2019 20:01:54 -0800 (PST) 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; dkim=pass header.i=@pobox.com header.s=sasl header.b=a3lYeLFy; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729435AbfAIEBx (ORCPT + 31 others); Tue, 8 Jan 2019 23:01:53 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:59751 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728483AbfAIEBw (ORCPT ); Tue, 8 Jan 2019 23:01:52 -0500 X-Greylist: delayed 360 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2019 23:01:51 EST Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 20A1E4D5FF; Tue, 8 Jan 2019 22:55:51 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=zys7wzfBEXI8WLsQRJK2ztCU7 R8=; b=a3lYeLFy7EbcTJGngJRCZXzWIerFwm5osXoz1Caw0aMbhcPJ2HiS5BfLz duHedGMFUOFBCa4zLYEUX/9LOUVLRczB9jlubgg6cgLQjvb51pL/r2fVb/7JeAD2 2jCqLkU3LU+lzLEWkRuTbwx118uCUoK0cpzrSVPPMo30A+QKas= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 193254D5FE; Tue, 8 Jan 2019 22:55:51 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 1B1314D5FD; Tue, 8 Jan 2019 22:55:48 -0500 (EST) (envelope-from nicolas.pitre@linaro.org) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 1562C2DA06F5; Tue, 8 Jan 2019 22:55:46 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] vcs: fasync(): make it consistent with poll() Date: Tue, 8 Jan 2019 22:55:04 -0500 Message-Id: <20190109035504.8413-7-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 72BF9086-13C2-11E9-959D-90A5DACCD188-78420484!pb-smtp21.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We use POLLPRI not POLLIN to wait for data with poll() as there is never any incoming data stream per se. Let's use the same semantic with fasync() for consistency, including the fact that a vt may go away. No known user space ever relied on the SIGIO reason so far, let alone FASYNC, so the risk of breakage is pretty much nonexistent. Signed-off-by: Nicolas Pitre --- drivers/tty/vt/vc_screen.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 1bbe2a30cd..1d887113ff 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -93,9 +93,18 @@ vcs_notifier(struct notifier_block *nb, unsigned long code, void *_param) struct vcs_poll_data *poll = container_of(nb, struct vcs_poll_data, notifier); int currcons = poll->cons_num; - - if (code != VT_UPDATE && code != VT_DEALLOCATE) + int fa_band; + + switch (code) { + case VT_UPDATE: + fa_band = POLL_PRI; + break; + case VT_DEALLOCATE: + fa_band = POLL_HUP; + break; + default: return NOTIFY_DONE; + } if (currcons == 0) currcons = fg_console; @@ -106,7 +115,7 @@ vcs_notifier(struct notifier_block *nb, unsigned long code, void *_param) poll->event = code; wake_up_interruptible(&poll->waitq); - kill_fasync(&poll->fasync, SIGIO, POLL_IN); + kill_fasync(&poll->fasync, SIGIO, fa_band); return NOTIFY_OK; }