From patchwork Mon Apr 9 00:23:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132982 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp729161ljb; Sun, 8 Apr 2018 19:44:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx48weIsy+TTA5i36HYvVMCE1syk/8Qy0a+nfzeKvr1+Q9aZ8Y016/DuCmfqk7cQDI1hEtIRB X-Received: by 10.98.13.71 with SMTP id v68mr27758205pfi.69.1523241856342; Sun, 08 Apr 2018 19:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523241856; cv=none; d=google.com; s=arc-20160816; b=TvF3Cn182edqa+s5YpK9lD2sxbDBoyqBuQLipn1HblFoclbuj/7SXq+CIh/4TUz0Ob pobCYkRymy4VbRdmWS0cbZUTbJXiCnTe+ticEzi8ieUvvIBE/ex9gXaNRquGb6UYMP0i OVBvb1Nxt6aHOWH1ioJUYUx7HVp2jQ5GPEHymL9XYw+rZ+mbp/4ovYQWWBzxbl1H/RHT 7s3d2A4TROaX4TvjJFONg+i0frVgS3hsAD7RUliS91fgkpeyLdSOujWmofma/+ytYAXY PLhDyFs9+kdrap/lBv6sToHNP+nmpXp+CnnISBt1fi4VA2H0xk2knkl/yqPlhAXf8W5f Bz5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=cm2VGSK59fqiO3rhd2hljPFgAG5FW2HpYoodtPO8Hy4=; b=UuEQNvpXQN2jnvBQL8VT5+zs+KtaSCdU8P/fB9ScVn8D+SdoMObXpohbvEYsVNr/Sn bTG0cSy0Mp9TY6zKkiJTRTN/kMkFe0p2KZ844QbhZovAHcImYBUqBjzp/qriw5fRvEp+ nitsT7/DrqYxNRy5B4itUYYV1K5QRF0tx0r6YB3IGwZ1IPvzRpAs+D2U/fmhRrVU7iK5 1tH+SfT6ESC5QL2DzF4/jhcgMNHjlpGX8apD94RvuQvq1MJ+YhU/OSWE/HgDvhF1R0Kl jWMRXf7uUEn3NWxR67Q+br+0t73IbXKJQ92Nfme5CTDDJlz+ZivqqQp4UqR9C70X9Sd0 9Fag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JisF9y1J; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si8829862pgs.153.2018.04.08.19.44.16; Sun, 08 Apr 2018 19:44:16 -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=@microsoft.com header.s=selector1 header.b=JisF9y1J; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757786AbeDICnj (ORCPT + 29 others); Sun, 8 Apr 2018 22:43:39 -0400 Received: from mail-by2nam03on0133.outbound.protection.outlook.com ([104.47.42.133]:46250 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755455AbeDIA0v (ORCPT ); Sun, 8 Apr 2018 20:26:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cm2VGSK59fqiO3rhd2hljPFgAG5FW2HpYoodtPO8Hy4=; b=JisF9y1JkpBGfEpaYn2Qu5i38qlFgrQDU38Ftz17fzlRN2NJO5Pncl450jhy9e/AdJzj1fwrlYz22YeXWKq+GLR/oTaJc8eYz+clSN6Ag8V7lPPPs8dqOauNdoJ++lG1eMVnPKVtKqK2wip2Pb1WO8PQ9dxK78gfvoR8y5ObHr8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:44 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:44 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Tero Kristo , Herbert Xu , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 025/293] crypto: omap-sham - buffer handling fixes for hashing later Thread-Topic: [PATCH AUTOSEL for 4.9 025/293] crypto: omap-sham - buffer handling fixes for hashing later Thread-Index: AQHTz5jwgYyJwCMQlUKSWMAh6Nz8Fg== Date: Mon, 9 Apr 2018 00:23:09 +0000 Message-ID: <20180409002239.163177-25-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0885; 7:PojUVnUikadcwilsq8Vxp249VKmnylLYqG3rDpBpYFLOMVWOQpF3s8cPEP9YQYCpLGcGJDzmUO0U7ObfHwco47sdtpeLBMwpdsZ5rzTlokD2FvxdRyzUfEikf8KElV/2jPMaxVAxAIzegtOLP3BR9gvM86xYnApDovjPAcqMt3P+DoG8gUOlKztiYPnfhUDk0jnag05TVFGzxEBpk0SlcWhsVhBT3M9nl7q4/R9dQ+M9v7faGF1kaJ21OHmsA/Gt; 20:i2gVkq6gVJm0DYopv9ANolAfMBbMm2q8afE8vIU+7XLpNaAWk9GviKcy9PUx7RPOdDBEIP8mPgUS/nA3Cl7JRgA2dOL7He8/sTtl0REH6NkYUP0W9rl6JDDx/zGH0BEwGp23e8m+3tvqc+MF7AcPQHSGbsWh0bO12arNCPZtOmg= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: f86eaa56-554e-45c0-4957-08d59db092a9 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0885; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(366004)(346002)(376002)(396003)(39380400002)(189003)(199004)(2906002)(68736007)(22452003)(316002)(6512007)(5660300001)(6666003)(54906003)(110136005)(486006)(6486002)(102836004)(36756003)(14454004)(99286004)(86612001)(105586002)(72206003)(106356001)(2900100001)(1076002)(97736004)(10090500001)(3280700002)(5250100002)(6436002)(3660700001)(6116002)(575784001)(3846002)(305945005)(86362001)(59450400001)(66066001)(10290500003)(186003)(81166006)(8936002)(478600001)(476003)(25786009)(81156014)(8676002)(4326008)(7736002)(2501003)(107886003)(6506007)(2616005)(26005)(76176011)(446003)(53936002)(11346002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0885; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: s2lkvUiFkV3kWDXp+cJ8pzCnuA1RAkoaE2OV6bfgGKxbG+xGBbOZnNBOOGN99c5aXHkAn+ou7xdplalGvvGhkBVKPG9uk2cH0v6nrtXWPPcdzP07Ium17PMH//2Fj13/Clh9LuXelgpGbPOcJhcBRJvu6TG4mUg+Lqiy1nMCqKBbF56ReBsvAN6/dvG0v7aDpcaXpnMsz8Xt6S/BR3kt79Kia1IX6C6RFNTg/HeHe5V1SFEOPTefHH615ZycRPMlwUGhNzh7+Wtwnasu0BwZxDsZ4FpHs6OzPsSz1vNyEAaG0jrvxRblP91KhJVWhYsQBf48Rk3yQYvK2EEpd5UpfvES5RUc8Zpd+DUvV9dmpD0YR8lrtDWwOfFRINO0QhSgaBGqaTQ0e3EqLbEh64x9HvfSUz4DKc9wVdY32LRDH7Q= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f86eaa56-554e-45c0-4957-08d59db092a9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:09.6123 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tero Kristo [ Upstream commit 5d78d57ede8f9e7f656c610ed25be7be337e0529 ] Currently, the hash later code only handles the cases when we have either new data coming in with the request or old data in the buffer, but not the combination when we have both. Fix this by changing the ordering of the code a bit and handling both cases properly simultaneously if needed. Also, fix an issue with omap_sham_update that surfaces with this fix, so that the code checks the bufcnt instead of total data amount against buffer length to avoid any buffer overflows. Signed-off-by: Tero Kristo Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/omap-sham.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.15.1 diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index d0b16e5e4ee5..c65b49baf0c7 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -873,14 +873,21 @@ static int omap_sham_prepare_request(struct ahash_request *req, bool update) } if (hash_later) { - if (req->nbytes) { - scatterwalk_map_and_copy(rctx->buffer, req->src, - req->nbytes - hash_later, - hash_later, 0); - } else { + int offset = 0; + + if (hash_later > req->nbytes) { memcpy(rctx->buffer, rctx->buffer + xmit_len, - hash_later); + hash_later - req->nbytes); + offset = hash_later - req->nbytes; } + + if (req->nbytes) { + scatterwalk_map_and_copy(rctx->buffer + offset, + req->src, + offset + req->nbytes - + hash_later, hash_later, 0); + } + rctx->bufcnt = hash_later; } else { rctx->bufcnt = 0; @@ -1189,11 +1196,10 @@ static int omap_sham_update(struct ahash_request *req) if (!req->nbytes) return 0; - if (ctx->total + req->nbytes < ctx->buflen) { + if (ctx->bufcnt + req->nbytes <= ctx->buflen) { scatterwalk_map_and_copy(ctx->buffer + ctx->bufcnt, req->src, 0, req->nbytes, 0); ctx->bufcnt += req->nbytes; - ctx->total += req->nbytes; return 0; } From patchwork Mon Apr 9 00:23:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132981 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp728763ljb; Sun, 8 Apr 2018 19:43:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49QIE7BZVZzG5PN0xv1z5v2r1ibEHpHxiGP5XrfMaFwvvr8LSR3Mniu6JeIYOnIGAKTu6JY X-Received: by 10.99.103.67 with SMTP id b64mr5004170pgc.14.1523241822922; Sun, 08 Apr 2018 19:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523241822; cv=none; d=google.com; s=arc-20160816; b=WqH/08bSskzIq9u1gXlzepn6jiacLiRoSbz/lTzpZsXd0cF/Fxm6/sVfS+WwA/M/K+ igoMlg+tBGNYKjA9GTCt8Aen1gOZ2iUPzyBkfLIBre0BcHamXGlQY7FmuJZV4mvyr2qD q/TTJsXkWJ+pg0CMS1TXpYAbT196vGwhPOX51RM0JtaCHqpZDoQyk78HldwwlsFujOe/ eYI1zDnM87groYaDp4UFJRMIfOAXLAAARBFTl858J3VpuSMg9Lp2OBr+kzkahycB2Cgl Ydt2BI0zU5bK4AxtR9FNw6NCDDKyUzgfDgLpyk5JBKmIZRQh+MqauQhSnT+JihpEvPXD cCIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NKfE98pSi4i0FPkiupnz+FO7OVsNfZ+j5BtzUUH+bmQ=; b=SD3ZbZgvKrqBN8bngJu/GAyb+W08L74sAASSFdwLcl0PuGywqJBfjIjV4t2EqLOpIX uQ2Yg70wOyqaxE99dswelgbaxgTkBo0W35VsZOyz/8hWF1IPsuRCJE2rJ+nXeLbGHMrK 5Pp2a5akUWH1iuemeCcJDgOH5HlFYFr/mB8IAqEADel1iYHWWslMK0dUwC5xbg/42VnG sIIYi6sm8SFdOFPrYkAJA9zdPnlc/s9u9NKXxE74ncevHxKwglTV1yAnQAYjlvtBRSt9 IMLGpk6FMcOTaEyEFNpOuETsSLrhfxX6bYwhDzwGZFM5vbpBoVYvuOZR4WQxvtO1jMer Bd6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lQnGldLM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4-v6si13254419pls.240.2018.04.08.19.43.42; Sun, 08 Apr 2018 19:43:42 -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=@microsoft.com header.s=selector1 header.b=lQnGldLM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756904AbeDICnh (ORCPT + 29 others); Sun, 8 Apr 2018 22:43:37 -0400 Received: from mail-by2nam03on0126.outbound.protection.outlook.com ([104.47.42.126]:2432 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755456AbeDIA0w (ORCPT ); Sun, 8 Apr 2018 20:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NKfE98pSi4i0FPkiupnz+FO7OVsNfZ+j5BtzUUH+bmQ=; b=lQnGldLMlzrtsRiuSCa+DU1yfwhcSy5Gx6B69GJKwtv3vaLu957M6T2gDf5FHDKcgTnpcKB76I/Z+UegapF2NiQIUBu1eB8gZkZb2hqdHQy+zpvUMBrDBjqqnBcN4ixv3f4I6EREdubNWifWiY0BO2VN3VSfW2NBvE8fKB3yuD0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:45 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:45 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Tero Kristo , Herbert Xu , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 026/293] crypto: omap-sham - fix closing of hash with separate finalize call Thread-Topic: [PATCH AUTOSEL for 4.9 026/293] crypto: omap-sham - fix closing of hash with separate finalize call Thread-Index: AQHTz5jwHNF0TLyyJ0qIfAUx/Jy8QA== Date: Mon, 9 Apr 2018 00:23:10 +0000 Message-ID: <20180409002239.163177-26-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0885; 7:x3wgahrVB0ra+VQqysCGY+CmMEb95m0ld6ptfWJAUwoNKysz76gQxSzEuKu5/xcuQcdD+NRWvY6Y7xXsgpwM2z2K29OU/Dsd40+668TVZsPwdBJJPbopFSSNgJSDMupeBRLzpX86B3CxW3YsRVDwvdLHHkYgKeMf6SOZqtKT6FtaLLn0d4Bx8bZFWlJKJXlVDTZoRAmAqLpRI5PjQAQsZWoDpmrJiah1pkFeD0RO4vwJQ2NIAMOunXJiq16SFSU1; 20:zuhg0716TuurbUrypm+ojo/7PY+gHVBSb1aDS/T9kMJ179nOB5HRVflx6yUUiCSqpUHq3Nhq6/cJsnfScHda6FaGbb2NinhaoHu3zq3Pu7GF1TP8RnqOD+RQckRAMmZr34UxiJetkwIGCD6fcxhTOY3fSEqY9Bu9P39PM8pDCHA= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 274f06d6-1d4d-44a0-3128-08d59db09312 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0885; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(366004)(346002)(376002)(396003)(39380400002)(189003)(199004)(2906002)(68736007)(22452003)(316002)(6512007)(5660300001)(6666003)(54906003)(110136005)(486006)(6486002)(102836004)(36756003)(14454004)(99286004)(86612001)(105586002)(72206003)(106356001)(2900100001)(1076002)(97736004)(10090500001)(3280700002)(5250100002)(6436002)(3660700001)(6116002)(575784001)(3846002)(305945005)(86362001)(59450400001)(66066001)(10290500003)(186003)(81166006)(8936002)(478600001)(476003)(25786009)(81156014)(8676002)(4326008)(7736002)(2501003)(107886003)(6506007)(2616005)(26005)(76176011)(446003)(53936002)(11346002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0885; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: w3GfjUUBnG07u5cqjbakcJMeWYmmtlISYnu8Sur0DAHPted7tNpHZ/0A+rC3KJ3zbgLqps/C+SQghdyGKIPtQz4hcZFIakwk9biZJNARzhmJG7mVj/yGd3lsnmvtozXX6H3AQS4TwHPxl6GawVfFkcunGVG0q5+gFoN9jftU3erDMKDOCpAPhAeaTv9PfOn0Ud+DBohMfVdw12IrOjiAdsFW8nrSlHNCfWkS2lCINOqmom5vsnVXLYl2onD+J3DatRRoF/wQqVque/YvxwWlY6cPnFQv4AyGZE5hcEpIMlyI8rq0Bht84YY+ss/OAj+hCcCQKJ309UunLR8j7xKXIsZni0ujDQF/j4ht3EREkfW3oNoBCHm7+1kFgD4vrIRAMenhhLHFMzsP6oJObrb+kIviNXqELSiIGM48U2XSeAE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 274f06d6-1d4d-44a0-3128-08d59db09312 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:10.4248 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tero Kristo [ Upstream commit 898d86a565925f09de3d0b30cf3b47ec2e409680 ] Currently there is an interesting corner case failure with omap-sham driver, if the finalize call is done separately with no data, but all previous data has already been processed. In this case, it is not possible to close the hash with the hardware without providing any data, so we get incorrect results. Fix this by adjusting the size of data sent to the hardware crypto engine in case the non-final data size falls on the block size boundary, by reducing the amount of data sent by one full block. This makes it sure that we always have some data available for the finalize call and we can close the hash properly. Signed-off-by: Tero Kristo Reported-by: Aparna Balasubramanian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/omap-sham.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index c65b49baf0c7..d8305ddf87d0 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -750,7 +750,10 @@ static int omap_sham_align_sgs(struct scatterlist *sg, if (final) new_len = DIV_ROUND_UP(new_len, bs) * bs; else - new_len = new_len / bs * bs; + new_len = (new_len - 1) / bs * bs; + + if (nbytes != new_len) + list_ok = false; while (nbytes > 0 && sg_tmp) { n++; @@ -846,6 +849,8 @@ static int omap_sham_prepare_request(struct ahash_request *req, bool update) xmit_len = DIV_ROUND_UP(xmit_len, bs) * bs; else xmit_len = xmit_len / bs * bs; + } else if (!final) { + xmit_len -= bs; } hash_later = rctx->total - xmit_len; @@ -1137,7 +1142,7 @@ retry: ctx = ahash_request_ctx(req); err = omap_sham_prepare_request(req, ctx->op == OP_UPDATE); - if (err) + if (err || !ctx->total) goto err1; dev_dbg(dd->dev, "handling new req, op: %lu, nbytes: %d\n", From patchwork Mon Apr 9 00:24:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132980 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp718480ljb; Sun, 8 Apr 2018 19:26:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx48h8j3YeooZ3Vx2NOyIYcq8chiRP9SCIF4lHwo66CNINiH23EYKpkbgeUvYK5z1YrrroxhT X-Received: by 2002:a17:902:3341:: with SMTP id a59-v6mr36690712plc.68.1523240781955; Sun, 08 Apr 2018 19:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523240781; cv=none; d=google.com; s=arc-20160816; b=tjDHE1Ky8lDBWHTr7Mib7/xGzy6/jZ6aywzqiqhf03UmEmxMa7bdQgh62VNcLbxFbb lMqj00yV2HVSfBzUV6KDyANmF5sMkIOKeKgASAC/a4B/sCMSOkOsPuG/J4B6cw1qkTk6 I+0/IwEi5ZoOsOrPE/WpPDYSRLBhLc9A5AIf3p1e9lf/5Dxa5n9Ba1EF+3c5K+XjHq5h /ZTiV0SLwCO1sKdoVBNhwwZe9X1YRB4bP+XEUhRzOk5GP9DInO/mlAuHyAPmr5x4DaDu YAo8vr7H3j0orpf7xQX6u6H4ShlyYVpR2T3WYUzCz1fEpi6B+Yly6im1hVhVF2qLtIIy rKjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=YuRJvLHqH+p0RgluGh678LSdg0H3GKzpf18qHr7pRPw=; b=VtEkKJLaZyakyrmBU4ZdVL4RLL+EgVAmzny9HqWtb0f0QWDE4MwqVulICCSLisrcRW qQxvIzO5iHPlI+IiBz0QiE+nTrOm+IybB4CAJ/k+0vAR+AxXnfnx7iaxYadbkMTrkS8Z mqrAEzlfWpBUu3X35stQG3aIHUeX2X2ct0mYI2pnY5EfDaJnZnWJeOG1NFF62uu5MYIH 0bQg18y/y+4kD9hHeENQ2KbeIE/UQA7mfWTC5dM51rMeI9FlYnb0oT3N+iATczflVLuf ijLlYRyBkSzTJC201/sxtsI8AIUHeh4nVdtHR717an4++s5eEIWapNVup8SbW8YhwHeO QJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=jYBYecUD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si10305963pgp.145.2018.04.08.19.26.21; Sun, 08 Apr 2018 19:26:21 -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=@microsoft.com header.s=selector1 header.b=jYBYecUD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756286AbeDIC0R (ORCPT + 29 others); Sun, 8 Apr 2018 22:26:17 -0400 Received: from mail-by2nam03on0120.outbound.protection.outlook.com ([104.47.42.120]:61603 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754405AbeDIA3M (ORCPT ); Sun, 8 Apr 2018 20:29:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YuRJvLHqH+p0RgluGh678LSdg0H3GKzpf18qHr7pRPw=; b=jYBYecUDtXQQMiOKljIFEOc1sAu9OUh6w0DqPic51oZymp7T8kgeFqxeoL8vFIOfWURLTIo3WAfYwN7S+k1gkiGZXYhC1R+ACDOvRzWvXgGDMcNHOJyngQ2hPot5IDRyUw2mCoNLylOmER6nChNKr2/8HKGgHcm/QlyEDoUOM14= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0967.namprd21.prod.outlook.com (52.132.133.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:29:10 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:29:10 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Wang Nan , Alexei Starovoitov , Hendrik Brueckner , Zefan Li , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 095/293] perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set Thread-Topic: [PATCH AUTOSEL for 4.9 095/293] perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set Thread-Index: AQHTz5kTfZ+OYHksUEGPnCwtcFSLeA== Date: Mon, 9 Apr 2018 00:24:08 +0000 Message-ID: <20180409002239.163177-95-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0967; 7:7JM/OQaK83P1EYg3KwAlzdDe0rbzivTvcFlymrz3jFE+mSKtDTpnpEMIkqtNiNsSHICroomioHWTSdDTB0wYfukUuhfFOznIbdc5i+hHD+yvZDDfRnEu7FIokkSwvnmZnNH5DHlXSCOtwivDGaKkEEzfCCa0mwmB8zQ3vfW4RQMbmNolrfmDX0ABak0rxMt3+JWSMWJjzMRQl62PXuk6Vy0Bw91AVtATlPlaLNkTPBg5eu4N4qIUJZaDMj3jgBT4; 20:865o+PDxYT7yAhBgIAGZ4Gmo75taGctI4lA2SdL+u+VayFxafZPSyFuRG4XrXI2edx693sNMwhDS1Yuj30olbVG+lHjVpUqwRa9dRLIJUJTF7+bGqvAc0rGEuswS4Kxqrz/GOI2nHDYhas9cxclz5T3Ycmlq87ekLMgDLA/4wU8= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: e51f77f3-3fec-49b8-8dbb-08d59db0e9e8 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0967; x-ms-traffictypediagnostic: DM5PR2101MB0967: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(85827821059158)(42068640409301)(104084551191319)(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR2101MB0967; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0967; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(366004)(376002)(39380400002)(346002)(199004)(189003)(6506007)(486006)(575784001)(86362001)(14454004)(59450400001)(68736007)(102836004)(99286004)(26005)(3846002)(6116002)(186003)(476003)(2616005)(1076002)(3280700002)(86612001)(72206003)(966005)(4326008)(446003)(54906003)(76176011)(11346002)(2906002)(22452003)(3660700001)(110136005)(97736004)(316002)(5660300001)(478600001)(8676002)(6512007)(6306002)(8936002)(39060400002)(107886003)(6486002)(53936002)(81166006)(36756003)(81156014)(10290500003)(6436002)(10090500001)(25786009)(66066001)(106356001)(305945005)(7736002)(2501003)(5250100002)(105586002)(2900100001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0967; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: GNh2JJ9A+OHbg4dKGObo6wygy0P7r3jAu2iKvpuiy++JfxNaHxqJ88XXQsfV+ugJX9p4Q/z1Z4GUTT8Pc4T9QY2587wZGHjya7xZT2h+SIkuQMGmATQ2lYNuk/NX0CXj2gg8dJg4O//dP3VDL3eqCGIhAY5q51qo71GRaX7OxiksU+Rhza9JKz3CGisFohEAr1iqd3jKSa19J+w36Jzs9xKGeXM50URXAZ6jOjr+Y5enpwem2CljakC4Scl6d7/TfYsuq09hBI/Hng9smMvLl24Lb7IBniu/RS187sXXDS0DC/A+jtHoFWuGJOb3R7867ZqjHopqUZ5JhaCc36+uXA3RS2cs6vZhMetz+j6sJRthTEMDUuTTujlnKsYr0CI/JqX6v32BbNlKXbEgNC57uPHX/ZD8Ve+rXeDHMDTJnR4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e51f77f3-3fec-49b8-8dbb-08d59db0e9e8 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:08.2218 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0967 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Nan [ Upstream commit 9b57fb7e35957c6838f89f4ed7e3f8433a4bbfc5 ] The 'if' keyword is a define that expands to complex code when CONFIG_PROFILE_ALL_BRANCHES is selected, which causes a 'perf test LLVM' failure like: $ ./perf test LLVM 35: LLVM search and compile : 35.1: Basic BPF llvm compile : Ok 35.2: kbuild searching : Ok 35.3: Compile source for BPF prologue generation: FAILED! 35.4: Compile source for BPF relocation : Skip The only affected test case is bpf-script-test-prologue.c because it uses kernel headers and has 'if' inside. This patch undefines 'if' to make it passes perf test. More detailed analysis from a message in this thread, also by Wang: The problem is caused by following relocation information: $ readelf -a ./llvmsubtest3 ... [ 5] _ftrace_branch PROGBITS 0000000000000000 00000260 00000000000000a0 0000000000000000 WA 0 0 4 ... Relocation section '.relfunc=null_lseek file->f_mode offset orig' at offset 0x490 contains 4 entries: Offset Info Type Sym. Value Sym. Name 000000000038 000b00000001 unrecognized: 1 0000000000000000 _ftrace_branch 0000000000b0 000b00000001 unrecognized: 1 0000000000000000 _ftrace_branch 000000000128 000b00000001 unrecognized: 1 0000000000000000 _ftrace_branch 0000000001c0 000b00000001 unrecognized: 1 0000000000000000 _ftrace_branch Relocation section '.rel_ftrace_branch' at offset 0x4d0 contains 8 entries: Offset Info Type Sym. Value Sym. Name 000000000000 000200000001 unrecognized: 1 0000000000000000 .L__func__.bpf_func__n 000000000008 000100000001 unrecognized: 1 0000000000000015 .L.str 000000000028 000200000001 unrecognized: 1 0000000000000000 .L__func__.bpf_func__n 000000000030 000100000001 unrecognized: 1 0000000000000015 .L.str 000000000050 000200000001 unrecognized: 1 0000000000000000 .L__func__.bpf_func__n 000000000058 000100000001 unrecognized: 1 0000000000000015 .L.str 000000000078 000200000001 unrecognized: 1 0000000000000000 .L__func__.bpf_func__n 000000000080 000100000001 unrecognized: 1 0000000000000015 .L.str ... So I think the failure is because you enabled CONFIG_PROFILE_ALL_BRANCHES. I can reproduce your buggy result by selecting CONFIG_PROFILE_ALL_BRANCHES in my kbuild: $ ./perf test LLVM 35: LLVM search and compile : 35.1: Basic BPF llvm compile : Ok 35.2: kbuild searching : Ok 35.3: Compile source for BPF prologue generation: FAILED! 35.4: Compile source for BPF relocation : Skip Simply undef CONFIG_PROFILE_ALL_BRANCHES in clang opts not working because it is introduced by "#include ", which override cmdline options. So I think the best way is to undefine 'if' inside BPF script. Reported-and-Tested-by: Thomas-Mich Richter Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: Hendrik Brueckner Cc: Zefan Li Link: http://lkml.kernel.org/r/20170620183203.2517-1-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/bpf-script-test-prologue.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.15.1 diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c index 7230e62c70fc..b4ebc75e25ae 100644 --- a/tools/perf/tests/bpf-script-test-prologue.c +++ b/tools/perf/tests/bpf-script-test-prologue.c @@ -10,6 +10,15 @@ #include +/* + * If CONFIG_PROFILE_ALL_BRANCHES is selected, + * 'if' is redefined after include kernel header. + * Recover 'if' for BPF object code. + */ +#ifdef if +# undef if +#endif + #define FMODE_READ 0x1 #define FMODE_WRITE 0x2 From patchwork Mon Apr 9 00:24:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132949 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp644150ljb; Sun, 8 Apr 2018 17:30:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ESLkNpVvtyf50V2uNv/8NbAN4q0f5CUgAkGAK9pL4fF8ibftOTzMYhp+sRNxWYIiTdRGC X-Received: by 2002:a17:902:7c83:: with SMTP id y3-v6mr31675700pll.378.1523233811123; Sun, 08 Apr 2018 17:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523233811; cv=none; d=google.com; s=arc-20160816; b=h22EXy5r/LL2e1pyuERMVEUlOE/9WrRpoWRXu1uGrXgEJHOuhRuFJbbjP3UE99nZr2 rsvAdj7+szOHB444CneqICVbTYLBlCayzKJbis4FlNRsC5+x2+Bl/ZyWGx2vnpAgMj5/ TEQepEsALRpUqrgMe4AFLSfWFAnVsTwkqtUqJo/oz6WINpn7mArBK6sBDkRSflDgoitz FWfCbieYuC+xnUUN873ddLkl1CSiFmGVf19n7lrfOYEQSLPK8kDezAV13Ks2rWVW1pmW twtg6f5MC6Dal+OGPvBwerPXBv5CnScqClBUS6vF7verMYAVZ7YbJzStj6vrJtvZAge+ ikCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Hc6nLPJVp8wu8SkOJXZj19L1h+xsTjdVFHXZuslMiMA=; b=IUtSiCUOGSJmQvuGEL9hcxx4oVeXevBDwNIUH9TYDnrQO3q7JWxOunuMjIW6ZAnvLo f7RqJ4MfUloGEu7GEn+X5yFcoY3om22H8Z9MwHUunx2LXmAB2taLBkocoAv4V7UK+Zgj HGBqKPVUkYW/IpoQd9PyIP3eUdks6EvCv5LwBi/xnHrw4e/70bN+9zA6eT/q3viuZqKS 8ldKoL0FhXzXWZ68sx30/rGbd9yWBawpADQAKWuTQ+sQOJpAUuUAPOVgZRAj/aCViQEd WlnnnCJwfU789Tw038gvOJo0Dt4cckPfN9lEAsHSyl9hAyogW1HDo5AkhdnLM646adQh B9eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gn3K2+nD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si10227182pga.364.2018.04.08.17.30.10; Sun, 08 Apr 2018 17:30:11 -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=@microsoft.com header.s=selector1 header.b=gn3K2+nD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756058AbeDIAaH (ORCPT + 29 others); Sun, 8 Apr 2018 20:30:07 -0400 Received: from mail-sn1nam02on0106.outbound.protection.outlook.com ([104.47.36.106]:7529 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932128AbeDIA3s (ORCPT ); Sun, 8 Apr 2018 20:29:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Hc6nLPJVp8wu8SkOJXZj19L1h+xsTjdVFHXZuslMiMA=; b=gn3K2+nDKO3KG5cdsaQHNH+Xs2lLH8Z7v7n/qrj3ObWOM+to3xwQzHDYZogeE4hyul+OiDQy3Ws0+fDezEWpCWbw8Es70vQWuZkcgTcGf4CN6pL7u97b8o9X6n2g7CdrSAeTj9FfCjAwD8kIt+jIsmiCowG0IcZBYQnipIKzAfs= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:29:43 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:29:43 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dave Martin , Will Deacon , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 120/293] arm64: ptrace: Flush user-RW TLS reg to thread_struct before reading Thread-Topic: [PATCH AUTOSEL for 4.9 120/293] arm64: ptrace: Flush user-RW TLS reg to thread_struct before reading Thread-Index: AQHTz5kersbuDb7X0EWcileNz7K5cw== Date: Mon, 9 Apr 2018 00:24:26 +0000 Message-ID: <20180409002239.163177-120-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1032; 7:TQqY1ulQEa71DIfNi8UUJ58bHSTUpAKptRFsnYONNmzL07cfUnkv/6Zq7T/VEAnPHQp9Xn3JDoIrqooD4VZl4iYy14GKcniG1Utm6evo+k0D5KxnYynzWkbExNNo//kvumeJzUWBOhLykRoACRDnDmyYe3m1dMwekhfJxsMggD5ojTYHM7Xe+iAqGwsL4g1UNA812dzJWk9DzinT9t5f2fX2o92EMQqVQB/t32f70zgc7qrU1Y30gIGTAWkniYln; 20:iaQezoq1jj3Ka9D6W2Gu6if0bX0+IuIuTTXvjexGaFenKyMTxqvG2HBxcDhYuTX99X8k66yDQ0oFIdJNR5EoI1IKNeoR9MMB/dP5fcyLAZlRP94u2Z/6hQoLvXOEAcxPhUne1Mb3ZEk2s92GxsEy8MRSLjfZ/hyEbpjeO1B94Wg= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 2ef8733c-dbcd-492c-52ae-08d59db0fd45 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1032; x-ms-traffictypediagnostic: DM5PR2101MB1032: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231221)(944501327)(52105095)(10201501046)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB1032; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1032; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39380400002)(346002)(396003)(39860400002)(376002)(366004)(189003)(199004)(5660300001)(76176011)(99286004)(10090500001)(2900100001)(105586002)(305945005)(7736002)(107886003)(2501003)(5250100002)(14454004)(53936002)(4326008)(8936002)(68736007)(25786009)(86612001)(3846002)(66066001)(1076002)(486006)(316002)(72206003)(22452003)(106356001)(186003)(97736004)(6436002)(6116002)(476003)(2616005)(478600001)(6486002)(10290500003)(2906002)(110136005)(54906003)(6512007)(81156014)(81166006)(8676002)(36756003)(11346002)(3660700001)(446003)(6666003)(86362001)(26005)(102836004)(3280700002)(6506007)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1032; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: jM96s6lPQbFt4vVwGLZzxXSu/9p/OElnkEGdTIIWUBdmvXcMsFQ0dB00p+IJ1VsnwK0riHN078Xsvdz7s0YmUsMizDm5UEIFwDx1pd0nsgJN89LMkcE6UYJ+6XejTnO2CrcqAzOmUqfRseLMirhM57B9nnekj62zuGDl4DtsakjNv/+hZt4CrHMMokPs1QxoSMNQER8SbUsBMq6EhAdgS9H0lDL0cvIaL0cpHozGLJQg6xmkdQQQwARUo/jr+tL2SW17BKOZfuUNZI2xBakkAZJmNKV5roHyMdF8ao1c/R/FlcZaNpB8/CxLE9rgzguDBJ1BEu4sxx8qN4yLNp/kwa2SY25gunisORvR5KWWtfLJXvMp6XB11y4iaTJwq1EWBMUsR2LdVdiBLD4Fk6S4fSoqCxjriX6CHXcmjsaP+1c= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ef8733c-dbcd-492c-52ae-08d59db0fd45 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:26.5656 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1032 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Martin [ Upstream commit 936eb65ca22ad856cb3a995e8cd742e982dc2dd0 ] When reading current's user-writable TLS register (which occurs when dumping core for native tasks), it is possible that userspace has modified it since the time the task was last scheduled out. The new TLS register value is not guaranteed to have been written immediately back to thread_struct in this case. As a result, a coredump can capture stale data for this register. Reading the register for a stopped task via ptrace is unaffected. For native tasks, this patch explicitly flushes the TPIDR_EL0 register back to thread_struct before dumping when operating on current, thus ensuring that coredump contents are up to date. For compat tasks, the TLS register is not user-writable and so cannot be out of sync, so no flush is required in compat_tls_get(). Signed-off-by: Dave Martin Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/processor.h | 3 +++ arch/arm64/kernel/process.c | 8 ++++++-- arch/arm64/kernel/ptrace.c | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 60e34824e18c..b3ac6e5a70b9 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -102,6 +102,9 @@ struct thread_struct { #define task_user_tls(t) (&(t)->thread.tp_value) #endif +/* Sync TPIDR_EL0 back to thread_struct for current */ +void tls_preserve_current_state(void); + #define INIT_THREAD { } static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 0e7394915c70..90e2823e5081 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -304,12 +304,16 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, return 0; } +void tls_preserve_current_state(void) +{ + *task_user_tls(current) = read_sysreg(tpidr_el0); +} + static void tls_thread_switch(struct task_struct *next) { unsigned long tpidr, tpidrro; - tpidr = read_sysreg(tpidr_el0); - *task_user_tls(current) = tpidr; + tls_preserve_current_state(); tpidr = *task_user_tls(next); tpidrro = is_compat_thread(task_thread_info(next)) ? diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 8eedeef375d6..d1fd560b3a2a 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -646,6 +646,10 @@ static int tls_get(struct task_struct *target, const struct user_regset *regset, void *kbuf, void __user *ubuf) { unsigned long *tls = &target->thread.tp_value; + + if (target == current) + tls_preserve_current_state(); + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, tls, 0, -1); } From patchwork Mon Apr 9 00:24:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132979 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp712243ljb; Sun, 8 Apr 2018 19:16:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/iXOmhd9eoFfA6+FRzYyCTJBxn7E7333Av5GpJ2Iwm9YmGBBZYBvandeHJt1DwbMKJrkWc X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr27325883plm.266.1523240207054; Sun, 08 Apr 2018 19:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523240207; cv=none; d=google.com; s=arc-20160816; b=u/LQBztUEe6+kNwXHdRxZ+8nzz6eVQywB06XFyz+1eKquFJJmEbuVv85eGX9Oh4C+x zWmRwsRYYEE83iM//w5flpvYXrz7/kRoc5yXeeUf/Tzlcwb2lOYAMnaLTZgdEyH5eouh wEOYOrJ9tbZuXEg4AlQpeTLePIGef2BCesCiWpSKRMhUQWVJbC7gX5kDPYSoD4LGKU/l 7Spt/ooFJ0Ek1iIHNB0phkY/DFhigvefGGNjKxXQTtsMTsevPRYyJ/tMUBVpQN/Z44sE RSwqqS+pneWYSu/rd1/cGb+0losrUYGgOF3eEvT8Ufd8cCZmsp+qsLiDVs5vLwc41CA5 HbhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ieHOEZ8g270OBs8XgJ3xZjL/zqXl4yeze/4ddhKPFzI=; b=Ie5CsN3LZ4xjKlKZgcYtNMQ49FylQGm/TN1hIj1OdtxhihwSrVNcZR4+S2PgN2CjKV 4gLkRoe1HUAbp8yrPKMdqpwqIvtTaljIp1NIPdmIHIzs1HA1kUkrMm95m72+/zJYK3ez QxTEQnR2WXwyhcir0m0w6eJWtV0frI2uiBP2fqScpcnpY9zEVJSReyoetp7AT1LJxSzE +uE5Gt5DSssNfNeSx+4+fXxaKHm0LiPFme4RhxVcw/9RMK7rM626RzcX/BpwwI+tByCB ftCwmkdQVIUiacGZRl9Ew9TPFsOZptsrqOfpWYTZYRL7Pfgf5ZfZgTdM1vVOh28myLQq 3cgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=egZagWbZ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d124si4701442pfc.22.2018.04.08.19.16.46; Sun, 08 Apr 2018 19:16:47 -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=@microsoft.com header.s=selector1 header.b=egZagWbZ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757887AbeDICQm (ORCPT + 29 others); Sun, 8 Apr 2018 22:16:42 -0400 Received: from mail-dm3nam03on0093.outbound.protection.outlook.com ([104.47.41.93]:60032 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754661AbeDIAad (ORCPT ); Sun, 8 Apr 2018 20:30:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ieHOEZ8g270OBs8XgJ3xZjL/zqXl4yeze/4ddhKPFzI=; b=egZagWbZQH4I6vPUOOoOrXt/+XRwUtFx/7mhTvDSjxbUQLngsBtajMvCH5Cl5IrBBECuCKxFTkuF4o/l1mU63rtrQ2HiC0DVTEAtSFtqCMe9lJS/m8sZvGodOOzCKJrLRTOPo1FgJKF7jdrTe2QgzI4s3wL1el8BKeKyY+FvNUg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:30:27 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:30:27 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jonathan Corbet , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 137/293] Docs: Include the Latex "ifthen" package Thread-Topic: [PATCH AUTOSEL for 4.9 137/293] Docs: Include the Latex "ifthen" package Thread-Index: AQHTz5klQXgtZk7BT0a8KivKLz1YkQ== Date: Mon, 9 Apr 2018 00:24:39 +0000 Message-ID: <20180409002239.163177-137-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0807; 7:Ok9rdinNpoWEdU9mU3n1qt8Em+KwQxrx4/lRVXhh4fVNzgy2FpC/TWDyC7LXcOgAHecnp6UjTG/j7kWNtsdiEMckMzrCBD59fe5a01GZhgBg2kkzRpSUc6+PDovXARksmSf1ao4qpbM/Sy/fT57NRAq4xC15gBYGqpGH4rVmHXrSRAXilV752eBIn1flQBXqLPLJuDJhYXf3bbP+lsynPhGpL1Va3N7EIBnIv6gLZTIoRQDeHmXJqAKnRJkPSQAd; 20:WnSCFXtESzA5RwED7qDX5yoQluNUGi3tgWNx8hPjxTFS4GVUe0enV9vWoyoDA6MX6BM3/KhuEPG1riZI4XXvSEbLRo+8dJpMs1Ed6JDwc38eJje0Z1ePvCUJ9KNXH32dmB8A52YwP9ShkrmWa8PrFW55c71L8wPIaZAGW2o25uo= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 18b2ad94-80f1-4f15-90d1-08d59db1176e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR2101MB0807; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0807; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Is9fG+tGl1gEVNqnMndW4ohm2+LiJxT6LlMVJVujM5zacAiNwed7V6Or7n47fHzS3zE2s1j2IhUXYu1pGEBWIEJ2g1L/BvDih9RqkMKvI7HOexUGktVtYPsdmqZdiLQut76FvZhSMVfbwHNZeaTyCh8Tp39iT6vSaLPqo1nraJsL//+IPnDkQiuz2XgHgNsH5Mi7hqO/gYGUwR+qslchFKGTp+uA7r0R30Sh/+9Gju0RVUdjPz05PaBNAxqxvyfRK45wKB4iZE2PDIJ+fGuiZtZZwm5qX18vrN7wL22qjstvCRpIMJSA86vPxJSs4+S6jonANCRSd8txgZwNDPlM47Ztvq+TBKQ8R7Fubgs7DpOxWeOcRSn/03CvEiBDP62DFWPy2SymUbUPYRl6iiNrqG+OjWGZmgBK19v52hrW/i4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18b2ad94-80f1-4f15-90d1-08d59db1176e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:39.9250 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Corbet [ Upstream commit cc110221918d5564c9dd415cebe62cae4f8d5df5 ] Otherwise we get PDF build failures when LaTeX refused to acknowledge the existence of \ifthenelse Fixes: 41cff161fe99d1c6a773becc2250a1dc3ac035ff Cc: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet Signed-off-by: Sasha Levin --- Documentation/conf.py | 1 + 1 file changed, 1 insertion(+) -- 2.15.1 diff --git a/Documentation/conf.py b/Documentation/conf.py index d769cd89a9f7..6219b9a788f4 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -273,6 +273,7 @@ latex_elements = { 'preamble': ''' % Adjust margins \\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry} + \\usepackage{ifthen} % Allow generate some pages in landscape \\usepackage{lscape} From patchwork Mon Apr 9 00:25:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132978 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp704546ljb; Sun, 8 Apr 2018 19:06:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Dd0ayLfMO1dRGDNjB3RN+W3CudBk3Jtn/a7x/ZeyD53HDKIderHN1moEOcnnUlbF294yl X-Received: by 10.99.100.197 with SMTP id y188mr23380344pgb.277.1523239561016; Sun, 08 Apr 2018 19:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523239561; cv=none; d=google.com; s=arc-20160816; b=Afejy5hY2sexTLGof/W07fcGVjilou+oSvScoIIF2ESBAN+AdsaEZhI7yEragDkEUW 01TSjYXbvFjEObgcGb/uxANGw8jXWksIWS/xABH8NhdM17D4UpeD6b30uNJs9xnWuVFO G/hNUf3GgkywBakQpGfiWJ8ysRLrnVz+l02PorlL2XPuV937lreSBc7Gef3mXDS6O9xC zYgX4+cLs7RCisXN4/2pVQi6w+K/ZE0prn7HFydtGsZn51P6cIncbVUNl95Zwwu6qW1z rXvodMqgXn67V3FyaTO7PZYPniveRNTWf9Ht/j4k8E+YoH3LpEMHEOso6bp406NkKcXm ri4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oM5JRjnNOOvHiYlL/YkLYqPuwiH9qy+8TZmBlQ/mD7k=; b=YQ9aS6COnkrT8rWSmh9qp+FRAYHX4CepG1lErA7T9x8L9lIhMODHkmq46i8157kQSZ Osv/xolarDKI3sp4gqljbTHALyulHWVKqZ0WMazI1OIEwHRW4zz/ZkMPfk1Z+nwCyHgl 79D5Yli8qSnkc8cwcSYdnuZVwhLa9vlPvQ3uCtjmnM+/tBTPw2Joq1zayvVkvE13Qq1/ OwHvFc5wuX5Iscv2TJxUFrTPXZSRtBhmn2uvRNwb05+mkchbzE8I7dp+0JSVSXsM1Ig9 INNuYWcVzH3+WwWUnLQdiXYHv1rxgXUs6tW/5nxSj8t6HTvd6nSaZYQh0noAeo5YPqbz aB2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Ib58pE2+; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si8665129pgq.646.2018.04.08.19.06.00; Sun, 08 Apr 2018 19:06:00 -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=@microsoft.com header.s=selector1 header.b=Ib58pE2+; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757807AbeDICF5 (ORCPT + 29 others); Sun, 8 Apr 2018 22:05:57 -0400 Received: from mail-cys01nam02on0107.outbound.protection.outlook.com ([104.47.37.107]:40886 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756311AbeDIAba (ORCPT ); Sun, 8 Apr 2018 20:31:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=oM5JRjnNOOvHiYlL/YkLYqPuwiH9qy+8TZmBlQ/mD7k=; b=Ib58pE2+vfkYG5RHJIifrxJrsCKzkgz/ADauYJfBk75IadLSzDO7dJzzpAW88bbpB3hqhWGcvGuzrVNVMLKrghcHC3ydzSeauP/BSMbs11CjN6e6Hrw2PENqQwablHsTW+ogjIonrQqIPG9qEM/NHOE4BSrqJYBq+L5b7O8Udk4= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1126.namprd21.prod.outlook.com (52.132.132.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:31:24 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:31:24 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dave Martin , Will Deacon , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 180/293] arm64: ptrace: Avoid setting compat FP[SC]R to garbage if get_user fails Thread-Topic: [PATCH AUTOSEL for 4.9 180/293] arm64: ptrace: Avoid setting compat FP[SC]R to garbage if get_user fails Thread-Index: AQHTz5k7ATtWyuV53Uq5j1Zr0D3AAw== Date: Mon, 9 Apr 2018 00:25:15 +0000 Message-ID: <20180409002239.163177-180-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1126; 7:deJRSsX5qAQ4A/8WOaxFBYg85YTX5QBDakulVWXqV3Hb2ySg5mniuHNrQbw8B4HwYnh33qwk+tIi4sc+CPkw99kMwTMwCpd05MjUDNfTKXMBfvCo4lLC0aigZoh1sMh6vCeFhZ7f23+EBNVFC07xBo2/wd/wNQSmdorGVyq9zHRNd2vklXdxYSHjz9BKSHmXfV3Yrctz1e2NqsidsBoaxKfCmHY17UfY8QVQV3vKoiiUU8794pDmiU1TEuRc7tTw; 20:9HSx+7IT8BWqx6A1Ndpo5abtZuj1ZY8lXmMmd4CcKeKCGRcMUUU1wCt8FSjfLHKZLC/RUiq7vdTo2Y3Pmu+3La0kakYL6Fwu0Q9TN+Z0Ck1kcTkkNQYWM9WK2f5KNEUCRPLN7ztZU/gOZdEp7WGWzWfW4Gh2XIjVve7Wy+k89SI= X-MS-Office365-Filtering-Correlation-Id: f87fbee7-f379-48f4-1455-08d59db13974 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020); SRVR:DM5PR2101MB1126; x-ms-traffictypediagnostic: DM5PR2101MB1126: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR2101MB1126; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1126; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(2616005)(476003)(81156014)(8676002)(81166006)(3846002)(486006)(2900100001)(6436002)(186003)(478600001)(72206003)(110136005)(54906003)(2906002)(86612001)(6666003)(2501003)(26005)(10090500001)(102836004)(6512007)(6116002)(14454004)(5250100002)(10290500003)(1076002)(446003)(3280700002)(3660700001)(11346002)(8936002)(25786009)(6506007)(106356001)(4326008)(107886003)(36756003)(105586002)(53936002)(86362001)(66066001)(6486002)(99286004)(5660300001)(316002)(22452003)(305945005)(76176011)(97736004)(68736007)(7736002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1126; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9njMOfKEAOYAD0EQ8BNVRz9bBWTuEDwpbtwxE8wHjxXF8AdM+cMSsAoa4IpV0YEdkEzijIVtrhtfNsLpuOxtkSfkNd1FD3d4Xje8yMHTKC6Ibq+ZOUu7hp0shLJFuliX9FfQrd059sBAJ8cWykH8S4ewVWnYKdqE0fLFTvtOKeXgiMYfWNzmpgLsyEpAF5XpQFucnyQIhR7Gv1zPGJ8tF7aE3YGt3N4WSsBGTGO/qHpzJ6TZ18alz6obTSotPOMJNsyQ+FFncgu2XRvKM0TCkTvx8/IL7LgNTkI8PB/h0vF68YSJ90qoxUmHT+GZbww9ZhuOn6lQopCDlTvQkLnrjmGVsvyTKxvsYn+6NtIC9RmD2nJm+XHFwPhx3BBdM5HWVemZlyKNnfmuTX4RGdmAn01QKV+KLk5sUyoSitsnduo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f87fbee7-f379-48f4-1455-08d59db13974 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:15.3626 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Martin [ Upstream commit 53b1a742ed251780267a57415bc955bd50f40c3d ] If get_user() fails when reading the new FPSCR value from userspace in compat_vfp_get(), then garbage* will be written to the task's FPSR and FPCR registers. This patch prevents this by checking the return from get_user() first. [*] Actually, zero, due to the behaviour of get_user() on error, but that's still not what userspace expects. Fixes: 478fcb2cdb23 ("arm64: Debugging support") Signed-off-by: Dave Martin Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/ptrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 5c78b64369cf..cca95e75aaeb 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -938,8 +938,10 @@ static int compat_vfp_set(struct task_struct *target, if (count && !ret) { ret = get_user(fpscr, (compat_ulong_t *)ubuf); - uregs->fpsr = fpscr & VFP_FPSCR_STAT_MASK; - uregs->fpcr = fpscr & VFP_FPSCR_CTRL_MASK; + if (!ret) { + uregs->fpsr = fpscr & VFP_FPSCR_STAT_MASK; + uregs->fpcr = fpscr & VFP_FPSCR_CTRL_MASK; + } } fpsimd_flush_task_state(target); From patchwork Mon Apr 9 00:25:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132976 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp702635ljb; Sun, 8 Apr 2018 19:03:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5DixmmD4sGwiJWxs6miuYEOI6iTk8X/QeD3akF6wmduKa7uDatZvull4zzOuzt9WTUVZX X-Received: by 2002:a17:902:5a3:: with SMTP id f32-v6mr23132056plf.287.1523239401231; Sun, 08 Apr 2018 19:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523239401; cv=none; d=google.com; s=arc-20160816; b=vmbQyxFbEbTKm8YPoI74U2lZpMDmbSCRCL+L7STujsFraU4M0dPopEMEbjztbu0no0 +n2g2xycinaioJ0ew/NzYCcCnmobTUowhBOCr8BWKDQI4F7xuUZ01AEOY7Sskr2pXF7j XY7vqMy4cWKIlukh617/PB6VpQMAYK15ZTXFvsxUHuM4TjvPdC7CVYRM2vFbiHyFACda N8hcnGGYaWivgjVRlLQXkt8ZkQwd5madR/2BO+1Km24Lu4DnFdXNRRBl7sdiqwJKop3+ O4A8GubjeXuXeGlhEHK4gps+XSw3nhf8DNP1B5/QNHKFnBKt03RVtFhBk1YgRBpWCQwj vTdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=iQBo9/vsT4aZyQUNnFacVw/d1auuVqzWtzB1jcIxMdw=; b=kU9HVqt1KVW/ro0ADOCqngkKiH6PLa0NTUNMPhP8ArVtl/w2Icw+ghNbG+Hdbzx11A pE7+S3AjIZCREeAIpqWE8ApqQas4dRoFgXhFN0UYSERAEdazZzkeNbcIzu3O9kejMS9i U4bka+pYY2335FYOPQlw+THRlk/jLVDAAKeBcCB7KItDR+mFPlPIpVjj2QLuL+2AHKjm 54+eGwrTMJpGbxP5Cg+CYVfKe18Ib1oyCHzLjk2G+R4+FE20+abcIm2PpwBeGiwbY5P+ +ME2S0ovHMcwN17X33oc1uTnsNHdZcavdyh/hGd1VdMeuyo2BZJbdIXp1zQUnuqujDly 8ssA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OoRori0Q; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d185si10483510pgc.746.2018.04.08.19.03.20; Sun, 08 Apr 2018 19:03:21 -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=@microsoft.com header.s=selector1 header.b=OoRori0Q; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756395AbeDIAcD (ORCPT + 29 others); Sun, 8 Apr 2018 20:32:03 -0400 Received: from mail-co1nam03on0101.outbound.protection.outlook.com ([104.47.40.101]:32931 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755747AbeDIAb4 (ORCPT ); Sun, 8 Apr 2018 20:31:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iQBo9/vsT4aZyQUNnFacVw/d1auuVqzWtzB1jcIxMdw=; b=OoRori0Qz+PTOvesMJCNgMdbXQsM33m3+EiEU3KBc4PTPGjizLRUNM9eJ8SfDs/R96Bh/2QEBlHVm1xUDxOeoRrQRUxq23tw/HtLP3KriYK5G68vAUlTO1eVADrEgV/e6cTdH0L78d4MTsJ+qYAi+QDGmcVbFbO1n2Z7roYtN50= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1126.namprd21.prod.outlook.com (52.132.132.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:31:54 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:31:54 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dave Martin , Will Deacon , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 181/293] arm64: ptrace: Fix incorrect get_user() use in compat_vfp_set() Thread-Topic: [PATCH AUTOSEL for 4.9 181/293] arm64: ptrace: Fix incorrect get_user() use in compat_vfp_set() Thread-Index: AQHTz5k7Z0BmFY1nCkq/ubGLmB0ZXg== Date: Mon, 9 Apr 2018 00:25:16 +0000 Message-ID: <20180409002239.163177-181-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1126; 7:egZn9GEsHFoCYijPM+/T1gHJDzJJLuO53BARHXunUvrHMjsMrNSrcX3hb7lXeVbKoz4zv8q6PQojR0/uq7foaU+8TdpZKE7vjmVGnHq7IaK212uQilzAZfMZtLNpSiKDrkGjAjZyTdNp77xVnQC3bgpoupXzFnHl1EiFBHHqnpB+9JwS4of0Qhvqo5N/nrwcGhT8fTpvsPjdgkufZm84YZVAfVcARLe6sXXlkOUXcFcTBD5awuj9OYB4CLAme4fO; 20:QI7Ye1NX23+qM6vSBOJajoTtCi4Vv6ik0xn6ASRqchKRzY6s5t+8PzQe5t1r1q3v3boVjnRf3lVIIehqjZ9bzFqdvUw8Ut6aaF1eThTai6fZ0jd/fSmafcAwOWmmYw+QOVZgG5wUXzp1sT8O7mk+pCLLyvlgSnoAbXaYW3VvAyQ= X-MS-Office365-Filtering-Correlation-Id: b3069525-2f30-40ad-ab9a-08d59db14b9f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020); SRVR:DM5PR2101MB1126; x-ms-traffictypediagnostic: DM5PR2101MB1126: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR2101MB1126; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1126; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(2616005)(476003)(81156014)(8676002)(81166006)(3846002)(486006)(2900100001)(6436002)(186003)(478600001)(72206003)(110136005)(54906003)(2906002)(86612001)(6666003)(2501003)(26005)(10090500001)(102836004)(6512007)(6116002)(14454004)(5250100002)(10290500003)(1076002)(446003)(3280700002)(3660700001)(11346002)(8936002)(25786009)(59450400001)(6506007)(106356001)(4326008)(107886003)(36756003)(105586002)(53936002)(86362001)(66066001)(6486002)(99286004)(5660300001)(316002)(22452003)(305945005)(76176011)(97736004)(68736007)(7736002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1126; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 4e1SRd7zI+O08P/9pHEU+NCJSjdBlJ8V6wPXeii50EESGjuudTdMr7GvgTZMzchYRhWFA2p4qmaFWU1nxQ3ib8b/0J8o2fqviMktiAuNxE0VXTWF13+RGpAVy2s8RxFYBvoWg0rpEXEqsqiKIJqZ/d6eTwqm2Iy0zdhXnoqCZycxv5lprcqNR45H4JlC4C7whZmts3wnDhY2qCNlHnHw0RAGl5twkaOG1KSuJVhI0qscr1jyTsdYGSVkKbQx5eMW87gzhs3kYHS1VAunGNyMJwRsER3mjXv348KEmnGZoCn7f6ZqerAZSg8hCdZ2KcVII5Pp7PzZiCqGe/33gOR1Qtv9+qyg+DEDivG+PN/+C5tvQaLLGfhhXe2vUwpsYl4hSpT0CC4GmwL22MGVE1OlepesNyN4Eo9lxTgp2hUTSlY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3069525-2f30-40ad-ab9a-08d59db14b9f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:16.0189 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Martin [ Upstream commit 5fbd5fc49fc39ac8433da62d16682a1d0217ea4f ] Now that compat_vfp_get() uses the regset API to copy the FPSCR value out to userspace, compat_vfp_set() looks inconsistent. In particular, compat_vfp_set() will fail if called with kbuf != NULL && ubuf == NULL (which is valid usage according to the regset API). This patch fixes compat_vfp_set() to use user_regset_copyin(), similarly to compat_vfp_get(). This also squashes a sparse warning triggered by the cast that drops __user when calling get_user(). Signed-off-by: Dave Martin Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/ptrace.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.15.1 diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index cca95e75aaeb..df1addf104f5 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -926,18 +926,20 @@ static int compat_vfp_set(struct task_struct *target, { struct user_fpsimd_state *uregs; compat_ulong_t fpscr; - int ret; + int ret, vregs_end_pos; if (pos + count > VFP_STATE_SIZE) return -EIO; uregs = &target->thread.fpsimd_state.user_fpsimd; + vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0, - VFP_STATE_SIZE - sizeof(compat_ulong_t)); + vregs_end_pos); if (count && !ret) { - ret = get_user(fpscr, (compat_ulong_t *)ubuf); + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &fpscr, + vregs_end_pos, VFP_STATE_SIZE); if (!ret) { uregs->fpsr = fpscr & VFP_FPSCR_STAT_MASK; uregs->fpcr = fpscr & VFP_FPSCR_CTRL_MASK; From patchwork Mon Apr 9 00:25:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132977 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp703057ljb; Sun, 8 Apr 2018 19:03:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx48OR99Tggh/49EVR9jHzqMXvwG4e61M57A4UVz1dy2XWyyC5p/TwjtbCKLxwM7G0ZbJpu0k X-Received: by 2002:a17:902:20ca:: with SMTP id v10-v6mr37520090plg.9.1523239433875; Sun, 08 Apr 2018 19:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523239433; cv=none; d=google.com; s=arc-20160816; b=Ua+2nIrrrWKhUGAUYqsFh3/66VylM85hh6/m9zkfJCA0T/+dqcVWfPyCaO8cij3lSL cECHsTrjPGyhy/301VY8CE0Q7BLEFLDL2g6tBuNa+0lrpPBa2owT859HqExt4TLfeAph m6j1D7ohP+Uy0IPMJ3Lk3gj07tLu1ybvCXGdM6IJL5B9ga4jxIzXwpFxutjpr/55XLQ9 kxft8EnrwTkOKEwlSxwMKcq1FeKQVo1FVbnmxkqQfMRezl1YMKonvlJBD/wRZ1JFMRK+ wvP/40B4d9awbPyjhg0OXxEic5xmlLVtpm33ob1TfjDlqUkYgm/+jK6Ku02Ots5OjkiX reVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EtTI/C4wZ0VgGrlXFfebPVKjSr2A/v5vLKgx9rJ70nM=; b=O1zvlhddh4M4IFesNrEGcfdjZPg54PbzIm0rVtqC/XMdL1gLsyLKga+COpSQZnGxd9 EFm+Ce/VEUnaTKF7H4CnQ+2ZQ95sp0cWFDQBYkIItae8zgXEIBEDRfdNraR6A9YG49O1 Or3A0THFYy0KbXpJawjU4VZgiyiIrshCiyZlAtBC8miRnaM/OvLbjs7AhgITkCSM0Deu QJqOCUxVoXLLrTJD0Av+YfDZ8Qep7PS+XDrhiBpQCAbyS5CieKKZHLdjQeGJd0d8oRqo zUfoLhgDiEPkzajSCfpXOYcm7wmzLsuFWiZptbxU6hGS2dkyKCVS5y6sKZB0VFX2x2/I CgYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=apmqcHIi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f78si11852556pfa.79.2018.04.08.19.03.53; Sun, 08 Apr 2018 19:03:53 -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=@microsoft.com header.s=selector1 header.b=apmqcHIi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932355AbeDICDT (ORCPT + 29 others); Sun, 8 Apr 2018 22:03:19 -0400 Received: from mail-co1nam03on0101.outbound.protection.outlook.com ([104.47.40.101]:32931 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756357AbeDIAcE (ORCPT ); Sun, 8 Apr 2018 20:32:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EtTI/C4wZ0VgGrlXFfebPVKjSr2A/v5vLKgx9rJ70nM=; b=apmqcHIiJxgu/G/zVL0qFd6v+ajLcY8rofSm98rJGdj8/3mwMmbv06cX23aYWDyZby6hm62/US2vpmOWDL9Q6rb4XFtuuEJ9vddn8S77Ry03V8qK0zkIiTQx+v0C48kDLETW1C5L6XNzwrYBzK12TpbK8ypU6QxQouwfCzCL7QY= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1126.namprd21.prod.outlook.com (52.132.132.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:32:00 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:32:00 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jerome Brunet , Stephen Boyd , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 190/293] clk: scpi: error when clock fails to register Thread-Topic: [PATCH AUTOSEL for 4.9 190/293] clk: scpi: error when clock fails to register Thread-Index: AQHTz5k/y3OZZQ4X9Um+K//G7zkN7Q== Date: Mon, 9 Apr 2018 00:25:23 +0000 Message-ID: <20180409002239.163177-190-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1126; 7:WdC2j7nkqdX2aG8NKPN/APClE1PEco6QbWWJ2JPNhhzbUvHwfYBVh59loQJaaBC5AYVRML1mjTw97OWiFhZB81nEb805OyT+cQEn7cXy+BcXf+V1f7ihLSJHMn3QY8JFCq89pbBt2z23xG6xl+I/6myLOSzc+mnaZ/yEQF6za5C5XpAYdKdrxV7fKnzksllqmFwZ4q9LJ/H2ZA4OhvCJM9rSiAZXmbAAhpeMAatg2JK08R075rwugsw/nvGu1hVu; 20:aoZSYGwInTLByTqfAr7WQ5q91mRf+eE0e+t9IzsJG0O5yAjxrkTwKzmzHtm7AyT4FT8pELtVPOqb1s9R9c64Zoy9Zk/B+UhqHD/RI9JCyig++xGvwSDCq4pc6PqdY9nlp0dE54cTlqqVPIf2bcT0TmdJ+I2IKr2xqd68TxQtZlg= X-MS-Office365-Filtering-Correlation-Id: 399294e3-ae9c-46bc-0f3a-08d59db14f0d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020); SRVR:DM5PR2101MB1126; x-ms-traffictypediagnostic: DM5PR2101MB1126: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR2101MB1126; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1126; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(2616005)(476003)(81156014)(8676002)(81166006)(3846002)(486006)(2900100001)(6436002)(186003)(478600001)(72206003)(110136005)(54906003)(2906002)(86612001)(6666003)(2501003)(26005)(10090500001)(102836004)(6512007)(6116002)(14454004)(5250100002)(10290500003)(1076002)(575784001)(446003)(3280700002)(3660700001)(11346002)(8936002)(25786009)(59450400001)(6506007)(106356001)(4326008)(107886003)(36756003)(105586002)(53936002)(86362001)(66066001)(6486002)(99286004)(5660300001)(316002)(22452003)(305945005)(76176011)(97736004)(68736007)(7736002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1126; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: NCWlIy8MHdX4vLtKKWWl+kcH01HWVCcK1U2QQFa7Gd/KxFeniKa4KfUUAKfuu6v5bNJK4CIro5PZ5DfIPUYhcmRk6Dymnu26r03sf4ZKcTUkrcxz4E6GRlWQ28luaRc5/C/pGtrjmc2/wTQAquPhUDUckGJUtxj+zT3pD+0SjtBTLUUD4pJeWNHYNDPfXqF800/y1WXNiWGo1wG7awKjGlCDfQpdqdvzYcqjsrJQbXiNSKNH3AqwENvNHsyuuCjzzs6uZRPBmNMcP4oPJ6eQHcrkluQTInkGRmB2XBEvcc0acw0A4R7phX1Gam2ecrK4wVv06g56BXX4SFAFodEYqjDNWvvsc3sZ9fmXrgK2zE/S/6C3MOPDu5Gbts38jWNjWUs0iT4U8bipTLGJrdBog5h+FS4SdpZZj2+DUfhM62A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 399294e3-ae9c-46bc-0f3a-08d59db14f0d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:23.0346 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerome Brunet [ Upstream commit 2b286b09a048df80fd5f7dfc5057c2837679a1ab ] Current implementation of scpi_clk_add just print a warning when clock fails to register but then keep going as if nothing happened. The provider is then registered with bogus data. This may latter lead to an Oops in __clk_create_clk when hlist_add_head(&clk->clks_node, &hw->core->clks) is called. This patch fixes the issue and errors if a clock fails to register. Fixes: cd52c2a4b5c4 ("clk: add support for clocks provided by SCP(System Control Processor)") Signed-off-by: Jerome Brunet Reviewed-by: Sudeep Holla Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-scpi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.15.1 diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index 96d37175d0ad..e44b5ca91fed 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -245,10 +245,12 @@ static int scpi_clk_add(struct device *dev, struct device_node *np, sclk->id = val; err = scpi_clk_ops_init(dev, match, sclk, name); - if (err) + if (err) { dev_err(dev, "failed to register clock '%s'\n", name); - else - dev_dbg(dev, "Registered clock '%s'\n", name); + return err; + } + + dev_dbg(dev, "Registered clock '%s'\n", name); clk_data->clk[idx] = sclk; } From patchwork Mon Apr 9 00:26:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132975 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp694906ljb; Sun, 8 Apr 2018 18:52:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx490aY9xGEDJ9Vl/z/FFEJiVdZrwlwWEPmXWrmtrinGDiU1Uk5TQymWHpmueeePoizs2ydTh X-Received: by 2002:a17:902:7d10:: with SMTP id z16-v6mr6769795pll.79.1523238734999; Sun, 08 Apr 2018 18:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523238734; cv=none; d=google.com; s=arc-20160816; b=0v6G7mYZfA4SAKXAw3QdMgbGSGWfz0IbAJfpC+UXhn5kTNzYnFAblI9dM7NEvtV3Hs HWkJSR1DpQLjhiQqAo30d6kUJx+RSk9P4gkWjbOu4PzIFHXx3j2aQk/+hcS3VbKQtr2j pUpx7IlzPOnaiYKTFTApU0OxrGCIEA9EcBMkwDHzwQrf1tL7aiNy02+ciWcgqql4Amii I50xtkp5aHdUzhDfH1fL2uXWXHO6HEg5AIXPGSZHq/xnB3QWfWw3O7+ENdkCllNJADZP G5D58zFVoIXnxwA/CldDhz7n6nrtpaulRpoJtfMoa2F+KEza/ztJzzzVD6MtqbvX1BdD qKCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hzMZY3DaNp1nbYji6bW4VPw/geV/k1dXAuXCwXMydOM=; b=NL2BXo/mEKoYxsrjllux6i6OyOyeNj7by6Gggti+342W3a3G3V69gSKWRVechvfiMa OPbRlNd7CJo+ikYmvn+js+Nd0XXhikh3L8r6MvYHyAWZrVuL1nHFze8CTC0xlU93+Vo7 qatNQR+GAn4faxCRXjsQx+jVnuATE425UHWs05d6EGaFf4w0wtEROGoQ9IlaypdxFA9q OVIFO/0VDm5Igh7w/qxP7A0ZI+sVuNthtRBKauUKhCLF3tMI+asxW3MpsKqBQMLRQqwb A2kHIxmdlcGzW100bbvvRZ5Ojzfo8pNEULWe+LXtAb2/K/6Jmzy4xNXeqBNOw1etc4zm TzGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=PD6DbnXk; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si13623313plm.747.2018.04.08.18.52.14; Sun, 08 Apr 2018 18:52:14 -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=@microsoft.com header.s=selector1 header.b=PD6DbnXk; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932514AbeDIBwL (ORCPT + 29 others); Sun, 8 Apr 2018 21:52:11 -0400 Received: from mail-by2nam01on0111.outbound.protection.outlook.com ([104.47.34.111]:45024 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932314AbeDIAdq (ORCPT ); Sun, 8 Apr 2018 20:33:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hzMZY3DaNp1nbYji6bW4VPw/geV/k1dXAuXCwXMydOM=; b=PD6DbnXkNWN9z24QmZnKSUpZL3fe6Dl6rDi0qjdxUIMd6q47ZkRi1LbYkCIwVx0/nEyV8Yu0UmMHHxdzGvbK0yA1+N5N8lA3Xo638gmstAxv1YRv8/l5reBESPQFtAYSfcvMuxwCo+PYZe54p2EF4QQ2An5HtLPb94DhMOp10cU= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.0; Mon, 9 Apr 2018 00:33:41 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:33:41 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnd Bergmann , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 242/293] scsi: fas216: fix sense buffer initialization Thread-Topic: [PATCH AUTOSEL for 4.9 242/293] scsi: fas216: fix sense buffer initialization Thread-Index: AQHTz5lWAfCMa5Mec0+j7LDQ0b3ueA== Date: Mon, 9 Apr 2018 00:26:01 +0000 Message-ID: <20180409002239.163177-242-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0998; 7:fCmh6uljZ2wRqcouWNXS5kNp0fH5PqRwZofrawLe8JaYDKoY7v9UuuGb18JIdAKvi5NPhJCF2kivI9t+oZtFKmCt8Hr2i4Y/yGGhJ9UezZff8z2REk+nWYFOq4YA+B1BX5DuNpB4rNPn8OICb1yXcF2SrWTKNBrqIyLp6LoGU+bRLYvhQjLD6HLzy64zYFSrJWpRU7dUEeVk5kb9Dmn9vdXPigLWQw47EuPg1PTtixdP9oxlbK8H3pj4RLPPesDW; 20:ycYtFjhN8wzdwa+U9O+kAsCxVYgEB7hb6jvmXO4WE66MN/9fKYcuaxNoio/Lk8xFSMXS0ywAMwCoevXsLB8qPdkj5liUSulqAMEIwVwP2Jn+QmxTl+DxPm6QECq29oK1e6bDK9EJj53/DnSx5/KXeF9yJVqheM4ZRJQofORv5ls= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: c66edbea-979a-40fd-f808-08d59db18b81 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR2101MB0998; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0998; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(346002)(39380400002)(376002)(396003)(366004)(39860400002)(189003)(199004)(25786009)(59450400001)(105586002)(14454004)(76176011)(68736007)(2906002)(316002)(97736004)(8676002)(86612001)(3660700001)(3280700002)(102836004)(6116002)(4326008)(8936002)(36756003)(22452003)(81166006)(81156014)(54906003)(6506007)(10090500001)(2501003)(6512007)(186003)(6666003)(3846002)(486006)(5660300001)(26005)(7736002)(5250100002)(305945005)(99286004)(2900100001)(110136005)(1076002)(6436002)(53936002)(106356001)(107886003)(72206003)(86362001)(476003)(446003)(66066001)(11346002)(478600001)(10290500003)(2616005)(6486002)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0998; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: O6Zo/LxLhsnv0BKTawD1Euoq4+g8hcUQCHCGpNq+G0UH3fxSmCfN++n7jcFM3Hdj/sX9xkoNG2oFNrRSyxHEDDpX07IqryVr93FUDVbuPksB/PkHcnnbp9GYJjyCgqYwjD7PisrN9ewf77X4zGg9RFhdLvAmPuKP5BwDHnL4rE9Iug9AYTT6+6+yJnPlGUNHQrPsguH4NKFBPeBX2lbuosAZ4hCtUYRZcBR/768LSJS6MqCAXGnZvTx7235JMpBgaR/7drqTMmWIxd+brWDfLS6J7ai9eRrHUUbQgIIx35s+mPuARZBz6f5bpkMyzOmC3Fp25cOt5cYETIn9Wd2buP90b4DVk3Eu32wpUvNCzES5MkvvKiLVao/3ZHiCTLLEqIY3DW6D9aJZQv5Yq/jCNZCC3yEfqamrv3amSItiS9M= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c66edbea-979a-40fd-f808-08d59db18b81 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:01.7849 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit 96d5eaa9bb74d299508d811d865c2c41b38b0301 ] While testing with the ARM specific memset() macro removed, I ran into a compiler warning that shows an old bug: drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done': drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] It turns out that the definition of the scsi_cmd structure changed back in linux-2.6.25, so now we clear only four bytes (sizeof(pointer)) instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we actually need to initialize the buffer here, but it's clear that if we do it, we should use the correct size. Fixes: de25deb18016 ("[SCSI] use dynamically allocated sense buffer") Signed-off-by: Arnd Bergmann Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/arm/fas216.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.15.1 diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 24388795ee9a..936e8c735656 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2011,7 +2011,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, * have valid data in the sense buffer that could * confuse the higher levels. */ - memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); + memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); } /* From patchwork Mon Apr 9 00:26:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132973 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp689437ljb; Sun, 8 Apr 2018 18:43:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx49g9f79VBimbFgln4//X2H20VWe6tYZpSgl+ltUSLDH5Y9pdeRz0SzRaaDfnSYFxAYqb+3q X-Received: by 10.99.191.12 with SMTP id v12mr1362677pgf.54.1523238237974; Sun, 08 Apr 2018 18:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523238237; cv=none; d=google.com; s=arc-20160816; b=c0e2oU1+843iqSDThrHCjB7IISIQaMNRVu8UUsWIbJ7C9vj2wfVhqxSKcK7LStOCPs Wejq3Iq+2JtPFYawMe3CPWi/lzgN/pKNyOWYTPPBKT+W8GnvYIthCH/F5AztND41Yqvb scXBG2CnTgSVcqFzLBVhJ8qZofroCxJo4CAPjptQ1Ms/XAoJhlcFrI5MMqrkjshb7I9g 4cmxgRGsJ5uVPd6crWkXRbLR7wAwvmzCTPCDoxA8Kx17tQxAmOEk6x/pLHi77KFK8bAi 7QnZQMYO4g1Bq6POWYvtI3WMVTX7DaOmTkz0uoe2Rr2si3jJp7m3+4yYGhl71HI4EBS0 BGpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=riR9+2EfNDX+3EEEA5aHSc1bIT1AsXhBrF9Tc09yC2o=; b=YlZRwijqsz2BJKQLO2LEs06y5LtCf4jITpeKAY0EoLRQtaD0LcXBoEWIWATi7OAGHm 286zqblXpAAsnRrDSKine3Tw1w3sEmx5V6BgwaOPbvd9l8IU7tx8HvdHGxSPYmqgYib1 1+pBfDsep/y8M1zDxiZjDVpdEsIgRodAs7YlWszvT1vWbIzkeN437l7NRQ0X41ObIARZ naQBruQ761AMI+aqhdOfAAQICxf6VA70Uky/0TRnhQHsVOm7mDq2sW8AF5USMFsPj1Pb PKNIAaCMVISkKguutEgB7/MQ7eQ4yvfRv0HIxeFrrM949/2fHLGg0VDc01USvSrIQDjb q5RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JeFqNDS6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si1561688pgv.344.2018.04.08.18.43.57; Sun, 08 Apr 2018 18:43: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=@microsoft.com header.s=selector1 header.b=JeFqNDS6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933119AbeDIBnj (ORCPT + 29 others); Sun, 8 Apr 2018 21:43:39 -0400 Received: from mail-bl2nam02on0118.outbound.protection.outlook.com ([104.47.38.118]:14317 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932507AbeDIAeo (ORCPT ); Sun, 8 Apr 2018 20:34:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=riR9+2EfNDX+3EEEA5aHSc1bIT1AsXhBrF9Tc09yC2o=; b=JeFqNDS6XAvCu6nttZvCVhu7mccXAtfetBzwhVQL9Jzlx2HmMIG+rlt3ExcT1+VKIiEg2H5WJOicMmTusQcEoqz+fNOsRGgK1N7WKfgFCZtJ+Gh6/xASPF1tsjoJLD524hcz8cc0Q96vxSyu6+JVtOZwNJAgjbOIvHfBYvsPTjQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:34:39 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:34:39 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 278/293] arm64: spinlock: Fix theoretical trylock() A-B-A with LSE atomics Thread-Topic: [PATCH AUTOSEL for 4.9 278/293] arm64: spinlock: Fix theoretical trylock() A-B-A with LSE atomics Thread-Index: AQHTz5lpxhT3G2BR4E+4+YbtX90x+Q== Date: Mon, 9 Apr 2018 00:26:33 +0000 Message-ID: <20180409002239.163177-278-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0984; 7:OeMpJNifVrRG/4u2lSxZWiw0nMwwJ95VQO+qKkI0xsn+3ea5rKx6MeR7wgw2HWW9S7muE1mHl7T/ox02tdOe2v/qDuqEj6+lIfHaUxxmHuZxtNs/yFV5jR2TLZENGpd1j5m1FEHHhPhz2QRYNyRdGEIA1Za4kX0KZqp9+hsTYOhXsiblFFdxUnnVud97f1VURq/0eywEI0+e3XopGWVnAvsLHi5TYKRpKe63dGwzV72eyLkOupPadEbL0+YbBZGc; 20:PaaPPMK7PEoYROjjbRrHuWywT/tPt4wJ+AdYIEQvS2ZU0Sia1xf3a5EEeBH8pfuZqAB+qdkW7zHRPGBP3oybo/xqVIDeNpMZhHzvIphnRXCAaT7jt0ApgqqAbeXBAQRRT454kdjsx/0ekU0I4JZoZLeQfwtw9qNelysEcXgPY+Q= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 49ffd854-535a-4edf-72ec-08d59db1adf7 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0984; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0984; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(366004)(39380400002)(346002)(376002)(199004)(189003)(26005)(99286004)(2906002)(14454004)(97736004)(59450400001)(8676002)(81156014)(81166006)(8936002)(6512007)(106356001)(76176011)(186003)(3280700002)(10090500001)(36756003)(6506007)(66066001)(3660700001)(72206003)(478600001)(6666003)(53936002)(2900100001)(105586002)(102836004)(2501003)(110136005)(54906003)(5250100002)(486006)(1076002)(25786009)(6116002)(6436002)(11346002)(6486002)(22452003)(4326008)(446003)(7736002)(575784001)(86362001)(305945005)(2616005)(476003)(68736007)(3846002)(86612001)(5660300001)(10290500003)(107886003)(316002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0984; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XBWUnvs7v9zjHHSgihf5OmWbUYH+zzQPwUYL/WwxyS1x1faw2gwre3VCVt1NmKbZEZAEtz7s7pkURjxV0ia6Tem/DZENX9DZjIQqHpg4hBOdy1gql8ZdI4qscGII1TFxWnUmznME+7ELh4yQlCQ8P9xpomUyW4FmsQD9d3gqs4lx2Bd8zYew+lZ7+2lPuKmRWRQkur+rlp6yOtmvlK+PwGDEabQzef+5z9o4wCOBM3WscS1qNDcd95gW+64epEjsLayIYdzCTiFEpOyi25EJa3qss73WetB17oMmMMN0YCaLwdo7AbJO0wGMvXe9wKO355RMr2b491jXdIL45lgVpAZwLf8+d9y2eR+30KVpQS9dsV6i35RLSLNARTjzBHA5qQd3LeZz4oc066GR5lb1GqnaeBt7CDysWwUCnICRfx0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49ffd854-535a-4edf-72ec-08d59db1adf7 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:33.1289 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon [ Upstream commit 202fb4ef81e3ec765c23bd1e6746a5c25b797d0e ] If the spinlock "next" ticket wraps around between the initial LDR and the cmpxchg in the LSE version of spin_trylock, then we can erroneously think that we have successfuly acquired the lock because we only check whether the next ticket return by the cmpxchg is equal to the owner ticket in our updated lock word. This patch fixes the issue by performing a full 32-bit check of the lock word when trying to determine whether or not the CASA instruction updated memory. Reported-by: Catalin Marinas Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/include/asm/spinlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index cae331d553f8..a9d2dd03c977 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -141,8 +141,8 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) " cbnz %w1, 1f\n" " add %w1, %w0, %3\n" " casa %w0, %w1, %2\n" - " and %w1, %w1, #0xffff\n" - " eor %w1, %w1, %w0, lsr #16\n" + " sub %w1, %w1, %3\n" + " eor %w1, %w1, %w0\n" "1:") : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) : "I" (1 << TICKET_SHIFT) From patchwork Mon Apr 9 00:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132971 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp687940ljb; Sun, 8 Apr 2018 18:41:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+180A5R2wOzDAJpV4pKxbJ3+cHzIHr2XqubKiAv059XGlF6vTadpinctx3eCab6Dtx+1U0 X-Received: by 10.98.236.220 with SMTP id e89mr27311075pfm.173.1523238094522; Sun, 08 Apr 2018 18:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523238094; cv=none; d=google.com; s=arc-20160816; b=YBQkD9a/C/fqxQeFwUqNSxhkxqS+PD4X04OwD0f9S6YkVbFr/zDC+Tsefz138mp51A bccAdISzVxRxc8f74LMk+jXKz/sSqWSWUHjeCVLQFqstGS1HU4b4J6hioBOD8KZjIOrV 7vSc4NFEC4+QRjN9S4htSYUDdb9aa/6TxLIuAR8LRkBu/u7+DXw0E7zzO7IhBrtSiSFC MU1bI7pG4ZmyVN0orDaOUeN9Yv3hZBPb5zBM9JJ1BbgHjpHJgMXRkrcr+5Gf2GKGQyVO KVmAynTGz18WMFYcR1corVphgais21B8/HvJi13f2/cVR53AUTlykv8158MvaxFgoJp+ Is3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=b0O65XNpY45LzQofsOGQ0PkdJeWRCPgqKusEPbZzBOQ=; b=lrzr3kM9OEli7zyyH12St4TifU60fzM5Cedn4Bub7VLvvVjc9iaR8NvYaGA6EO0Cbi zpa/AMl8KsXbHOFSWyjcQQJ9Hfudg50iCbtN8b2zaK1WysuhMWMjujn6S3+TgBwwEct4 CLlkSNrMAP1ixM33xAK1kYxR/qtgi8VBU0H8WxVduJW0TCppt5J7tAJb4k9qJUYxKwwl vwh3oR+3wfhy45FpJvcUWaDkCvtkM/TteuhSca01jrpE3QnSmzYWm0d4GfBNH5eISpB7 Kj3zpFIjFxz3/tG2ZYHMZ2GV5zsIxjrbEjSYk/FtkcOLgpwj8tGVH3o8/RjUjBf1ukcf JwIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=W2YMmeVB; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si3328071pgr.421.2018.04.08.18.41.34; Sun, 08 Apr 2018 18:41:34 -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=@microsoft.com header.s=selector1 header.b=W2YMmeVB; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932852AbeDIBlO (ORCPT + 29 others); Sun, 8 Apr 2018 21:41:14 -0400 Received: from mail-by2nam01on0110.outbound.protection.outlook.com ([104.47.34.110]:2593 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755776AbeDIAe4 (ORCPT ); Sun, 8 Apr 2018 20:34:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=b0O65XNpY45LzQofsOGQ0PkdJeWRCPgqKusEPbZzBOQ=; b=W2YMmeVBtOPOJtCBNEHTD7q+pMhAC5gA+F0Nt1+lH4FK8DtnuZlxazJAG5ZfHR/2pUgPbnSKdqQ/bjS1p0i9Qrh2ZsdxKkmMOdWMeN+3wGP0kSw2W3ErJgSrp+8xtpjCoFfzB53+azACKfgmb+lKYOaB134XeRjoteoBI7HzZ6o= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0806.namprd21.prod.outlook.com (10.167.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:34:49 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:34:49 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Mark Salter , Marc Zyngier , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 293/293] irqchip/gic-v3: Change pr_debug message to pr_devel Thread-Topic: [PATCH AUTOSEL for 4.9 293/293] irqchip/gic-v3: Change pr_debug message to pr_devel Thread-Index: AQHTz5lxKiIW/GueLkOOVs/pa9/9Ag== Date: Mon, 9 Apr 2018 00:26:45 +0000 Message-ID: <20180409002239.163177-293-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0806; 7:Ng7t+e4nkRKteA7deOe0fYdXkR/pJ8wmP1oMwQSjak+r2p4bIqEqW60zdU4ihZD4xFb2Ay4vf0/5NjGRFgWGxCumuFSy3sZvn0tlazybz1DMgbsBP5PBjrTeMRODpZhB1+ui3juBH4bu4QiUpjGl+6YEO22nxRMkr0Ccy+L0sICuhmpHoz2tNFh7ONBMuToRr2+Tj2ewuuGHbekSLhBAkJxQmjlU69ZDTo/oeKcdQ3KI7xoQvbicwtEORC+FEx0e; 20:f+SlDMJqr7yT7sTUYzeOHk/KjFHGjRbz7vGSpaAxuUQ2y+X01N+eUTITj0vdigebTHd8/yPtqeR+VTwoEnEKJj3A7tb4VCB9pyvwpVr1MYr7FmzsreylaUZeqZmNWD23qHWEAwVONEd1z/rODFNMYkGauKKoccfLcnmfyDPS2+4= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 05e85e00-0295-4443-87bd-08d59db1b3d3 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0806; x-ms-traffictypediagnostic: DM5PR2101MB0806: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0806; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0806; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(39380400002)(199004)(189003)(2906002)(25786009)(2501003)(10290500003)(476003)(11346002)(446003)(97736004)(5250100002)(68736007)(2616005)(102836004)(6506007)(59450400001)(3846002)(3660700001)(486006)(3280700002)(305945005)(6666003)(99286004)(5660300001)(76176011)(1076002)(186003)(26005)(7736002)(6116002)(81156014)(81166006)(86612001)(4326008)(105586002)(15650500001)(10090500001)(2900100001)(54906003)(22452003)(316002)(36756003)(110136005)(107886003)(8676002)(6436002)(478600001)(53936002)(66066001)(6486002)(6512007)(86362001)(14454004)(72206003)(8936002)(106356001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0806; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0bLJ9mE36/0AFUWfwWzV2NFUra0vOD+3ePcrZXmcvSrUzGbMoVQSC04GYrHu8sZEbE856IqFwVTuVwmV3FVLlO+97TajrlyTpF+fzdvnPGlrg2AaAnqIIaB7JUu6zm5YWRbfWXKs0U5W04GE4+r39VQxQ3VvrsZsiNFqXP13sbVS8Nwz1hz7QJB/f8U7XIRGXM6tVC528amWgY6wvELdStqnYXUyHDECHTiPi8iTLdZQZkWsIFdhXpROkYAE0XdmW+vpmfAaCJpayRmO96YBiu9T+Wp4scPpi421sf9iPcx3JhC+CQl/NUEyywH2F1lDYFRHf1U8mnAMrClrZJv5GoZt2GvqQJNaywu2C6wPMktczlvlkxXfW6jorkpcoYK+NpRPXcJdWNjTmPyUHNXlK1ccumYvxk0VvY5mqtoKx7w= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05e85e00-0295-4443-87bd-08d59db1b3d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:45.8478 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0806 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Salter [ Upstream commit b6dd4d83dc2f78cebc9a7e6e7e4bc2be4d29b94d ] The pr_debug() in gic-v3 gic_send_sgi() can trigger a circular locking warning: GICv3: CPU10: ICC_SGI1R_EL1 5000400 ====================================================== WARNING: possible circular locking dependency detected 4.15.0+ #1 Tainted: G W ------------------------------------------------------ dynamic_debug01/1873 is trying to acquire lock: ((console_sem).lock){-...}, at: [<0000000099c891ec>] down_trylock+0x20/0x4c but task is already holding lock: (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&rq->lock){-.-.}: __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock+0x4c/0x60 task_fork_fair+0x3c/0x148 sched_fork+0x10c/0x214 copy_process.isra.32.part.33+0x4e8/0x14f0 _do_fork+0xe8/0x78c kernel_thread+0x48/0x54 rest_init+0x34/0x2a4 start_kernel+0x45c/0x488 -> #1 (&p->pi_lock){-.-.}: __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock_irqsave+0x58/0x70 try_to_wake_up+0x48/0x600 wake_up_process+0x28/0x34 __up.isra.0+0x60/0x6c up+0x60/0x68 __up_console_sem+0x4c/0x7c console_unlock+0x328/0x634 vprintk_emit+0x25c/0x390 dev_vprintk_emit+0xc4/0x1fc dev_printk_emit+0x88/0xa8 __dev_printk+0x58/0x9c _dev_info+0x84/0xa8 usb_new_device+0x100/0x474 hub_port_connect+0x280/0x92c hub_event+0x740/0xa84 process_one_work+0x240/0x70c worker_thread+0x60/0x400 kthread+0x110/0x13c ret_from_fork+0x10/0x18 -> #0 ((console_sem).lock){-...}: validate_chain.isra.34+0x6e4/0xa20 __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock_irqsave+0x58/0x70 down_trylock+0x20/0x4c __down_trylock_console_sem+0x3c/0x9c console_trylock+0x20/0xb0 vprintk_emit+0x254/0x390 vprintk_default+0x58/0x90 vprintk_func+0xbc/0x164 printk+0x80/0xa0 __dynamic_pr_debug+0x84/0xac gic_raise_softirq+0x184/0x18c smp_cross_call+0xac/0x218 smp_send_reschedule+0x3c/0x48 resched_curr+0x60/0x9c check_preempt_curr+0x70/0xdc wake_up_new_task+0x310/0x470 _do_fork+0x188/0x78c SyS_clone+0x44/0x50 __sys_trace_return+0x0/0x4 other info that might help us debug this: Chain exists of: (console_sem).lock --> &p->pi_lock --> &rq->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&rq->lock); lock(&p->pi_lock); lock(&rq->lock); lock((console_sem).lock); *** DEADLOCK *** 2 locks held by dynamic_debug01/1873: #0: (&p->pi_lock){-.-.}, at: [<000000001366df53>] wake_up_new_task+0x40/0x470 #1: (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc stack backtrace: CPU: 10 PID: 1873 Comm: dynamic_debug01 Tainted: G W 4.15.0+ #1 Hardware name: GIGABYTE R120-T34-00/MT30-GS2-00, BIOS T48 10/02/2017 Call trace: dump_backtrace+0x0/0x188 show_stack+0x24/0x2c dump_stack+0xa4/0xe0 print_circular_bug.isra.31+0x29c/0x2b8 check_prev_add.constprop.39+0x6c8/0x6dc validate_chain.isra.34+0x6e4/0xa20 __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock_irqsave+0x58/0x70 down_trylock+0x20/0x4c __down_trylock_console_sem+0x3c/0x9c console_trylock+0x20/0xb0 vprintk_emit+0x254/0x390 vprintk_default+0x58/0x90 vprintk_func+0xbc/0x164 printk+0x80/0xa0 __dynamic_pr_debug+0x84/0xac gic_raise_softirq+0x184/0x18c smp_cross_call+0xac/0x218 smp_send_reschedule+0x3c/0x48 resched_curr+0x60/0x9c check_preempt_curr+0x70/0xdc wake_up_new_task+0x310/0x470 _do_fork+0x188/0x78c SyS_clone+0x44/0x50 __sys_trace_return+0x0/0x4 GICv3: CPU0: ICC_SGI1R_EL1 12000 This could be fixed with printk_deferred() but that might lessen its usefulness for debugging. So change it to pr_devel to keep it out of production kernels. Developers working on gic-v3 can enable it as needed in their kernels. Signed-off-by: Mark Salter Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.15.1 diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 0ef240c64c65..4a9f26723783 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -601,7 +601,7 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq) MPIDR_TO_SGI_AFFINITY(cluster_id, 1) | tlist << ICC_SGI1R_TARGET_LIST_SHIFT); - pr_debug("CPU%d: ICC_SGI1R_EL1 %llx\n", smp_processor_id(), val); + pr_devel("CPU%d: ICC_SGI1R_EL1 %llx\n", smp_processor_id(), val); gic_write_sgi1r(val); }