From patchwork Sun Jun 9 16:42:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 166233 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp56801ilk; Sun, 9 Jun 2019 09:53:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1H9xeLQoCcYMMnGFl6ttaHwC6Es8jT02gyqaDsk5ErMrkgSFOkhk1rmY8WAG0SOpxxSiD X-Received: by 2002:a62:1dd0:: with SMTP id d199mr17517249pfd.257.1560099187166; Sun, 09 Jun 2019 09:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099187; cv=none; d=google.com; s=arc-20160816; b=D/H/us+Tfimy+IvfY+k0p71Eeoe8JJjK72NI90ZnrUUrhBk3hu8apaIcXPcu5oP80h nFXx2/fuU49v6Ojbbc2scRULnyUnYzqo7kINhFkee18aHvWwW8dVPsVfR6YBAm/cBhL1 r2wrCs3n4qWeR5YToTAwZ6G974yti8NlkZ20wuX8j7ixe7soJDveAx4YdkeETKBQT2LT fcvq8edHkEP8SlxBl01qEscayVQ9M6Vn/QqDkYKJgn902NP/C/I8u9ooJsFOz1vx4txN ZqSK6XBx1BRPUeazddRz1wWiCWc3YZPT2gxMfxxJ3IeTcWODeNN/n5Amodybh11gAhG7 KHCA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w7c0uN89M1txJb4p63sZ5NNeE5b4c28B+NR33o4WlFE=; b=BJu7c89dXFXXts7Qx9U/ehW9VxOrBC5bU2k7yTEXJCOtFjIWzCPsyGhJMobvDQS8tC SCTshx/zzAyiRJ4X65z31jrU+tW/x9YgIF0VF463lqvYzZVq5nA+fKrdlEeXGxPg8Thi bFsOuFSXRxQgGFoO9ho6ndedpo77uxtpKkC4SmsEKiyUQ8p4YSs0JvJJv1c194zawP9l QxKR5QPMFMAnWSYGap6M3928Q4QV07A2iDGac3M5rgE2PKRCos1tzalCoQPaIrZ4LHaf c0oS2zjhxCng7peLXAwc55/LAUDyPQQLAulBReVpUKFtz2yBPBTjoRDGjsfLx53sK0B5 smZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zWfWQ4eM; 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 b38si4444147pla.137.2019.06.09.09.53.06; Sun, 09 Jun 2019 09:53:07 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zWfWQ4eM; 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 S1732346AbfFIQxG (ORCPT + 30 others); Sun, 9 Jun 2019 12:53:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732333AbfFIQxD (ORCPT ); Sun, 9 Jun 2019 12:53:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58DC8204EC; Sun, 9 Jun 2019 16:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099182; bh=op1gChslQGxNPa936LUqZEqpWuej5GsHZdQxDraDVkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zWfWQ4eMhjWLSEWUtqE13N30Z8F8+oZ8Z/ZCTEK0xkyDthClvEofe+dHyPGtnNPdn PMOeVr6q/xZyq1n6rTksjBcM48wipe6prYfano6O4A4kVSN0lDcGxPr0XC+kyX+yma nuGHR4UD5kfRXqeJNNa4V1+LGtuHwaHWoUUQKYLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Ramirez-Ortiz , Bjorn Andersson , Stephen Boyd Subject: [PATCH 4.9 40/83] tty: serial: msm_serial: Fix XON/XOFF Date: Sun, 9 Jun 2019 18:42:10 +0200 Message-Id: <20190609164131.277962861@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.843327870@linuxfoundation.org> References: <20190609164127.843327870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jorge Ramirez-Ortiz commit 61c0e37950b88bad590056286c1d766b1f167f4e upstream. When the tty layer requests the uart to throttle, the current code executing in msm_serial will trigger "Bad mode in Error Handler" and generate an invalid stack frame in pstore before rebooting (that is if pstore is indeed configured: otherwise the user shall just notice a reboot with no further information dumped to the console). This patch replaces the PIO byte accessor with the word accessor already used in PIO mode. Fixes: 68252424a7c7 ("tty: serial: msm: Support big-endian CPUs") Cc: stable@vger.kernel.org Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson Reviewed-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/msm_serial.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -868,6 +868,7 @@ static void msm_handle_tx(struct uart_po struct circ_buf *xmit = &msm_port->uart.state->xmit; struct msm_dma *dma = &msm_port->tx_dma; unsigned int pio_count, dma_count, dma_min; + char buf[4] = { 0 }; void __iomem *tf; int err = 0; @@ -877,10 +878,12 @@ static void msm_handle_tx(struct uart_po else tf = port->membase + UART_TF; + buf[0] = port->x_char; + if (msm_port->is_uartdm) msm_reset_dm_count(port, 1); - iowrite8_rep(tf, &port->x_char, 1); + iowrite32_rep(tf, buf, 1); port->icount.tx++; port->x_char = 0; return; From patchwork Sun Jun 9 16:42:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 166234 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp57008ilk; Sun, 9 Jun 2019 09:53:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1gxQgl/dREWb++SOd26z92I5+PDIOXMWm1n/uniSzVCbedoc5aRxuaeJYrXEzwrVKJllk X-Received: by 2002:a62:e0c2:: with SMTP id d63mr13399723pfm.60.1560099203083; Sun, 09 Jun 2019 09:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099203; cv=none; d=google.com; s=arc-20160816; b=K38yRan6WLLCRsuow/MinqKb6oucI4VjSM4t5cq+WWn5Nx3YYkIfsI8iiwa1L6hajR 8SV5tIaa9RIY4kswByjdvLD6tm5Ms6uugsQX3oHbMoiQjmiRDD+kDed9R8YLM6PgYMo4 NKH4vvwmYuogvCDujr+azaWCsZihJGhNY7TdPih+vl2KuwS2tpjhxH6ft3eoNzw37he/ tPoAUD+TlrB6pd8I+ad++ssnJIyOcE+mo8lhDtYGw//Ag3YcIkKXjsCLj/WGYX0NI0DI pguwI1qMUFvoKPVQ4AH2PvgYzZUwU+ufTJP9gvhS9e6XcF55brfW3dBOyWSajwRVYCel eKeQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2WkLi9RHXRlXiPjSwPAgJuGG1n2ovPQ+dDTyaHvQREs=; b=fYJtcqax0up2l1oa48bGD4MF1Kh48QhkdVArbDx3ipr7B29GtMmUWFbOzhpUDzGmr5 Xx9TYFeQHZo0BF8Cmwpmjy86aAKZ1UGQS4JHE/ZWAjlx/AYm1PPe0YfTwjKWBnwwLE9I LA1IR1ybzjNs/4ErZV4TiZQjgmNKQXS9JDgX1SiU3633B8JkdxiVBtzMAJ4Tx2+8aMFE cs5SHMobEp1u4d82yVuG+5flUBX1bcQWGRdPs87V/p3AUK3y8YwleDazDqthlAuFwfAU 0ai9+ybNDZclsu2WvnUedqoJbtRUETWF33hSeMVZW/0NL9Rhzufnjpz3MvGEPx3YQcPW jkKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w98sDvUm; 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 b38si4444147pla.137.2019.06.09.09.53.22; Sun, 09 Jun 2019 09:53:23 -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; dkim=pass header.i=@kernel.org header.s=default header.b=w98sDvUm; 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 S1732382AbfFIQxV (ORCPT + 30 others); Sun, 9 Jun 2019 12:53:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732369AbfFIQxR (ORCPT ); Sun, 9 Jun 2019 12:53:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95E212081C; Sun, 9 Jun 2019 16:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099197; bh=MpYDlxEzM89J10j2FWR/9KD66j1za1YxxQWzRSi1PHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w98sDvUm8sPPYHBt+O8XVEXsOZ8u0ovh/VgyaIEkdRcqVW5EcPhI4LvuRiNIiGjEp R/qG6lz/zfqrKkKhh0BVtcKvhyaXyXU61PGePCz/Ah16KLDGcFMmirgH44PhPlyxD+ H7po4SQfvCQRAYQO6guL6v6sX/TLuT78TnxUUWfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Corbet Subject: [PATCH 4.9 44/83] docs: Fix conf.py for Sphinx 2.0 Date: Sun, 9 Jun 2019 18:42:14 +0200 Message-Id: <20190609164131.661407633@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.843327870@linuxfoundation.org> References: <20190609164127.843327870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Corbet commit 3bc8088464712fdcb078eefb68837ccfcc413c88 upstream. Our version check in Documentation/conf.py never envisioned a world where Sphinx moved beyond 1.x. Now that the unthinkable has happened, fix our version check to handle higher version numbers correctly. Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman --- Documentation/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -37,7 +37,7 @@ from load_config import loadConfig extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include', 'cdomain'] # The name of the math extension changed on Sphinx 1.4 -if major == 1 and minor > 3: +if (major == 1 and minor > 3) or (major > 1): extensions.append("sphinx.ext.imgmath") else: extensions.append("sphinx.ext.pngmath") From patchwork Sun Jun 9 16:42:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 166235 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp57424ilk; Sun, 9 Jun 2019 09:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNHy2i0t9RJubjm0W8viZJOOoh9cWu//mgpZC6Oi8+Uc5lFc5FVbGv1nbj33kunAbBvmAd X-Received: by 2002:a17:902:9b81:: with SMTP id y1mr41591976plp.194.1560099237633; Sun, 09 Jun 2019 09:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099237; cv=none; d=google.com; s=arc-20160816; b=ebWGDv28DjxbtSTsWELgTevvk36u56+/Z/yyyixRW/rJhToMuTmgQ5b+9hnKwJ1wh8 /dNFLEjH130O2e5GdIAdhyyy2lnXftDfSi69fVUg0xyiNunEh0isTrUXLq7jc+q+dlKx 8GYCfHDiZodxHrEE/Sg3HYWtfD2WP34yIrdzhVKrS6PoJx5g9zhLUb8gx0VyM9NfeCij GUQV8eTOerIwKnzqsWcIya62lb630L/xMkJd+nvKokAjt4WT4wZVHaB+vbA7AXLmKqDG 6Gw/ShHzW0xk/DmavdJylSWSwn4xfO9jL9idjvkkCYJsviOraTPwObjauYSQdL9N0e5o QnZw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KfqijX2r/iikQcFMzXBj2Ij5QGpwRL5hRfJEYyMN4q4=; b=PHvOjqtazsk8Tcq2f5+FHIy/ovaq8hfPOi4R9XiwxT/OlkRwiZavqwBVPAkycUwrsr RNHLqky/pUrkq+cFyMnqPFYJZOG06RoHoD4qj5jBcdFn+1o4fxP1agFQvPQM/+ijE40T 2LaLgyz3MSvrvnfCePvZymw7hnC5Gecjt5e5WXvJDlpAKoQJyexBX6tAMD8/EGA4c0Cg PNZhBgmIHKnNTklb8w8Nx2rjKBxriwXcVkLby5V3OlAjLMPijT1/MQ0BLhaqgeUy1EzS WYwWn1CvTI8y06EKW5OWhXh3SFCbMqIYImFaJ8SprPN2GSSBrmOHkK5JPjb08adtlXWe vr6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rNxuJoHv; 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 m20si8005470pjn.40.2019.06.09.09.53.57; Sun, 09 Jun 2019 09:53:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=rNxuJoHv; 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 S1732506AbfFIQx4 (ORCPT + 30 others); Sun, 9 Jun 2019 12:53:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:55250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732496AbfFIQxw (ORCPT ); Sun, 9 Jun 2019 12:53:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61AAC204EC; Sun, 9 Jun 2019 16:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099230; bh=jn5STUV+VcC4A12rzncY3TQ86QUZFyuFr8waJzuPqhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNxuJoHv6T/M4dfVv6m74Um4s+Bx0mmWZJx3YZz4ILkINWJuDoveX3lljK2bng10b 66Z4OkEGCvcuADD9SXq8gzcHnadfaT7/1KCdRQ0M86+eXS+8G+T3GD7vr1z2GpQzxu Pwlp1MdILAj81BdJTrc0q/VFqRe4ql5mISYJ1AFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Punit Agrawal , Steve Capper , "Kirill A. Shutemov" , "Aneesh Kumar K.V" , Catalin Marinas , Naoya Horiguchi , Mark Rutland , Hillf Danton , Michal Hocko , Mike Kravetz , Andrew Morton , Linus Torvalds , Ben Hutchings Subject: [PATCH 4.9 55/83] mm, gup: remove broken VM_BUG_ON_PAGE compound check for hugepages Date: Sun, 9 Jun 2019 18:42:25 +0200 Message-Id: <20190609164132.620872548@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.843327870@linuxfoundation.org> References: <20190609164127.843327870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon commit a3e328556d41bb61c55f9dfcc62d6a826ea97b85 upstream. When operating on hugepages with DEBUG_VM enabled, the GUP code checks the compound head for each tail page prior to calling page_cache_add_speculative. This is broken, because on the fast-GUP path (where we don't hold any page table locks) we can be racing with a concurrent invocation of split_huge_page_to_list. split_huge_page_to_list deals with this race by using page_ref_freeze to freeze the page and force concurrent GUPs to fail whilst the component pages are modified. This modification includes clearing the compound_head field for the tail pages, so checking this prior to a successful call to page_cache_add_speculative can lead to false positives: In fact, page_cache_add_speculative *already* has this check once the page refcount has been successfully updated, so we can simply remove the broken calls to VM_BUG_ON_PAGE. Link: http://lkml.kernel.org/r/20170522133604.11392-2-punit.agrawal@arm.com Signed-off-by: Will Deacon Signed-off-by: Punit Agrawal Acked-by: Steve Capper Acked-by: Kirill A. Shutemov Cc: Aneesh Kumar K.V Cc: Catalin Marinas Cc: Naoya Horiguchi Cc: Mark Rutland Cc: Hillf Danton Cc: Michal Hocko Cc: Mike Kravetz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- mm/gup.c | 3 --- 1 file changed, 3 deletions(-) --- a/mm/gup.c +++ b/mm/gup.c @@ -1316,7 +1316,6 @@ static int gup_huge_pmd(pmd_t orig, pmd_ head = pmd_page(orig); page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT); do { - VM_BUG_ON_PAGE(compound_head(page) != head, page); pages[*nr] = page; (*nr)++; page++; @@ -1351,7 +1350,6 @@ static int gup_huge_pud(pud_t orig, pud_ head = pud_page(orig); page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT); do { - VM_BUG_ON_PAGE(compound_head(page) != head, page); pages[*nr] = page; (*nr)++; page++; @@ -1387,7 +1385,6 @@ static int gup_huge_pgd(pgd_t orig, pgd_ head = pgd_page(orig); page = head + ((addr & ~PGDIR_MASK) >> PAGE_SHIFT); do { - VM_BUG_ON_PAGE(compound_head(page) != head, page); pages[*nr] = page; (*nr)++; page++; From patchwork Sun Jun 9 16:42:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 166236 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp58076ilk; Sun, 9 Jun 2019 09:54:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxns8hlhJrYf4TAOK7O3jChbFjUR/bq7YzmiYbb8dI75YqT9/7IrS9hrdBEjlL27HBxmWqs X-Received: by 2002:a63:1c16:: with SMTP id c22mr12741469pgc.333.1560099295333; Sun, 09 Jun 2019 09:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099295; cv=none; d=google.com; s=arc-20160816; b=t8nojJgpH7OuHWAxixFy9b8/r76fBlcQSNBvNZJfj5mUjlzhGRW+wRZfFoJ0dm9vn2 gaGgCN2EoGzm8fj+M04ac9jgsNw0yd13mgQauCh3lkDp/XofeWc1YV2ZfrEfnvhJun1c RY00D+TfbT8ZNLHFdYYqpoV1RMgmW0oRw2WzSIC5M1eDcCpZFhjCzUcrbZmPhyBUuiHU wZP0ns8CTv7gcwaJ+F1fjUXRqbMA0xZMFHiyYZvFO9c9Ab9tqHIoWVDZYhl5eb2PQIMu J4LGAaajxMlikmofnlc1wMI8f8Pa5/1ClW4uH+mOarpyiahCDa7g4Gxuzi4YvL8GNznT 3/VA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ty9fdZFnhJ25te6H6bzBZ8/XPNg5srtYlQWPhQOLgSw=; b=Zl6dwtXdPvLbjE81VZy6XYDWJ9CJ3Bbw+cXWA1FnfBBnxmRF3az+WmQ9C84M5crUHD NMQXZy0myyPJNgtIJ6r7H7MlodMwtgdU+1meibduBGd02JbAs+f3GLUzQa3s8xHLRuO6 au3nd6GBjpSk0vXyrtGT5L13mGuakbkicq5sCwTjTCwI/03Ws1kG47FH3kzT0u7ARKo/ hqSkdckJxy1fAuhhknVk3IDOXPcpRKTuu3v6psNHK+BKelA5kAQwCVmzdpglz4uMi4w/ orm3QnczvJp0sRoZXw+3d2YWiWY8ET1aD90DUdUzMc6O/hatf7XMdBM4ftt5JUEH8wzO 0kVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fehB3Rf6; 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 o3si7285020pll.53.2019.06.09.09.54.55; Sun, 09 Jun 2019 09:54:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fehB3Rf6; 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 S1732713AbfFIQyy (ORCPT + 30 others); Sun, 9 Jun 2019 12:54:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:56706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732702AbfFIQyu (ORCPT ); Sun, 9 Jun 2019 12:54:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 189C9204EC; Sun, 9 Jun 2019 16:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099289; bh=lAiU1RIanTfQNtNoN4gO/C1h84Mc1DG0kARE30guHgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fehB3Rf6aY2s5SGEf0lT+RxvO35xrlvGW57VEOjBYMLciWu8Rll4dLnit278QN6xt 90fpEraZORNFU4qqtDL7Vq87FUnI4fMdBa2NSzN7Jkldq/tOoKMT6+IWtLLznaD1n0 CVKt+UwYthTsqU5gdy9vj07JkhflVxIFw6PmjXyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Linus Torvalds , Matt Fleming , Peter Zijlstra , Thomas Gleixner , bhe@redhat.com, bhsharma@redhat.com, bp@alien8.de, eugene@hp.com, evgeny.kalugin@intel.com, jhugo@codeaurora.org, leif.lindholm@linaro.org, linux-efi@vger.kernel.org, mark.rutland@arm.com, roy.franz@cavium.com, rruigrok@codeaurora.org, Ingo Molnar Subject: [PATCH 4.9 60/83] efi/libstub: Unify command line param parsing Date: Sun, 9 Jun 2019 18:42:30 +0200 Message-Id: <20190609164132.986580103@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.843327870@linuxfoundation.org> References: <20190609164127.843327870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit 60f38de7a8d4e816100ceafd1b382df52527bd50 upstream. Merge the parsing of the command line carried out in arm-stub.c with the handling in efi_parse_options(). Note that this also fixes the missing handling of CONFIG_CMDLINE_FORCE=y, in which case the builtin command line should supersede the one passed by the firmware. Signed-off-by: Ard Biesheuvel Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: bhe@redhat.com Cc: bhsharma@redhat.com Cc: bp@alien8.de Cc: eugene@hp.com Cc: evgeny.kalugin@intel.com Cc: jhugo@codeaurora.org Cc: leif.lindholm@linaro.org Cc: linux-efi@vger.kernel.org Cc: mark.rutland@arm.com Cc: roy.franz@cavium.com Cc: rruigrok@codeaurora.org Link: http://lkml.kernel.org/r/20170404160910.28115-1-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar [ardb: fix up merge conflicts with 4.9.180] Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/libstub/arm-stub.c | 23 +++++++---------------- drivers/firmware/efi/libstub/arm64-stub.c | 4 +--- drivers/firmware/efi/libstub/efi-stub-helper.c | 19 +++++++++++-------- drivers/firmware/efi/libstub/efistub.h | 2 ++ include/linux/efi.h | 2 +- 5 files changed, 22 insertions(+), 28 deletions(-) --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -18,7 +18,6 @@ #include "efistub.h" -bool __nokaslr; static int efi_get_secureboot(efi_system_table_t *sys_table_arg) { @@ -268,18 +267,6 @@ unsigned long efi_entry(void *handle, ef goto fail; } - /* check whether 'nokaslr' was passed on the command line */ - if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { - static const u8 default_cmdline[] = CONFIG_CMDLINE; - const u8 *str, *cmdline = cmdline_ptr; - - if (IS_ENABLED(CONFIG_CMDLINE_FORCE)) - cmdline = default_cmdline; - str = strstr(cmdline, "nokaslr"); - if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) - __nokaslr = true; - } - si = setup_graphics(sys_table); status = handle_kernel_image(sys_table, image_addr, &image_size, @@ -291,9 +278,13 @@ unsigned long efi_entry(void *handle, ef goto fail_free_cmdline; } - status = efi_parse_options(cmdline_ptr); - if (status != EFI_SUCCESS) - pr_efi_err(sys_table, "Failed to parse EFI cmdline options\n"); + if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || + IS_ENABLED(CONFIG_CMDLINE_FORCE) || + cmdline_size == 0) + efi_parse_options(CONFIG_CMDLINE); + + if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0) + efi_parse_options(cmdline_ptr); secure_boot = efi_get_secureboot(sys_table); if (secure_boot > 0) --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -24,8 +24,6 @@ #include "efistub.h" -extern bool __nokaslr; - efi_status_t check_platform_features(efi_system_table_t *sys_table_arg) { u64 tg; @@ -60,7 +58,7 @@ efi_status_t handle_kernel_image(efi_sys u64 phys_seed = 0; if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { - if (!__nokaslr) { + if (!nokaslr()) { status = efi_get_random_bytes(sys_table_arg, sizeof(phys_seed), (u8 *)&phys_seed); --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -32,6 +32,13 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; +static int __section(.data) __nokaslr; + +int __pure nokaslr(void) +{ + return __nokaslr; +} + /* * Allow the platform to override the allocation granularity: this allows * systems that have the capability to run with a larger page size to deal @@ -351,17 +358,13 @@ void efi_free(efi_system_table_t *sys_ta * environments, first in the early boot environment of the EFI boot * stub, and subsequently during the kernel boot. */ -efi_status_t efi_parse_options(char *cmdline) +efi_status_t efi_parse_options(char const *cmdline) { char *str; - /* - * Currently, the only efi= option we look for is 'nochunk', which - * is intended to work around known issues on certain x86 UEFI - * versions. So ignore for now on other architectures. - */ - if (!IS_ENABLED(CONFIG_X86)) - return EFI_SUCCESS; + str = strstr(cmdline, "nokaslr"); + if (str == cmdline || (str && str > cmdline && *(str - 1) == ' ')) + __nokaslr = 1; /* * If no EFI parameters were specified on the cmdline we've got --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -15,6 +15,8 @@ */ #undef __init +extern int __pure nokaslr(void); + void efi_char16_printk(efi_system_table_t *, efi_char16_t *); efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image, --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1427,7 +1427,7 @@ efi_status_t handle_cmdline_files(efi_sy unsigned long *load_addr, unsigned long *load_size); -efi_status_t efi_parse_options(char *cmdline); +efi_status_t efi_parse_options(char const *cmdline); efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, struct screen_info *si, efi_guid_t *proto,