From patchwork Mon Apr 9 00:28:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132952 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp648183ljb; Sun, 8 Apr 2018 17:36:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+U6JKFbzeVvWJlfSe+vLfmSrRebyqwljI9eSIQmOcmoWT6x6Occj0n+gDkG936sXEr6eiQ X-Received: by 10.98.62.71 with SMTP id l68mr26964190pfa.98.1523234213062; Sun, 08 Apr 2018 17:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523234213; cv=none; d=google.com; s=arc-20160816; b=bf4PCVxo8JLY7J/4tB429wEvPiGfupBKeSuQYr70QgItBNkUuObovnxpEYNiBitayt PxjzHMjDGu6KCg4uzjGlCpeuNzZi6631xRPZseN8IDk3PbgPfZ5finD735GC5BEX2Hgk WSZFx/gmUHGSz9PgJG6xbSIk5UYJyuHoHD8aIxdRoE7ilcxvj8OYxCXABcu0zAyONv9P VuJ8uLrMhuUADdw9RqRxEaYIIeX1D7zkwFQCOcUTHnd/WveUoDNC23VWY00wFsOJMLB4 16dvo64eBz47b7LjYINItZrQ0QQWmMkxbNfxG3nBOugHeSa1cPOXqItZCFHT7sWAVE45 9q1A== 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=ys872/B69uTbolxfIuU4mmtiX5KsHZJsyIs9I3ggGCw=; b=NKdMydjQqHhl+HlDcSFgzN7qryQMSyiAB31rck9y3/Cx1q+Nso5ceVkqt2WRztUHlr 1cCaSgmRa2tI/K+cppEFhNTSC8T1sJpW3xk6BSDhkp4VmLMj/9aUV++YMMMKfNxaFMtP J7MirJF5I9sA3km60XXSz7pTMg/s0+YNgu2NIVkw+ZaMlObkP1K4DY6Md/WRKqU0jDGN FMO7FES1oXP0PNaAPuLHfJ1IaKsuLvbTPxHP5k+cIIGMof111GuylM1ihtkPoaYbl01T Cr7B70xkYqZERoOWR9OS9UCP322AxfiXeb4AJDnE4IdW3JjEZq4OXyfDv5vfDftZ+VTy SfTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=h16zL0Rl; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 g1si10024742pgq.743.2018.04.08.17.36.52; Sun, 08 Apr 2018 17:36:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=h16zL0Rl; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S932676AbeDIAgv (ORCPT + 11 others); Sun, 8 Apr 2018 20:36:51 -0400 Received: from mail-sn1nam02on0127.outbound.protection.outlook.com ([104.47.36.127]:39469 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932665AbeDIAgt (ORCPT ); Sun, 8 Apr 2018 20:36:49 -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=ys872/B69uTbolxfIuU4mmtiX5KsHZJsyIs9I3ggGCw=; b=h16zL0RlPJEZogsVW8ypv+piRP3j02+7pQJSExl/wL4tBQTB+44oK+kG0Ux0gR47dG7RlYkrbvvvJziMXO8w1GjEMNqBmSkY235PT4hIkMwUcKDhUuBugEoAGkpqk+IL17ymRerVqnhAfL259NiMH9XaFY8qIjvIVozVDg2dzd8= 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:36:46 +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:36:46 +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.4 064/162] arm64: ptrace: Fix VFP register dumping in compat coredumps Thread-Topic: [PATCH AUTOSEL for 4.4 064/162] arm64: ptrace: Fix VFP register dumping in compat coredumps Thread-Index: AQHTz5muW+y4xslqkke6D4XIhA6m+w== Date: Mon, 9 Apr 2018 00:28:28 +0000 Message-ID: <20180409002738.163941-64-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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:5hYA6rL4zuHrPKnYQ9F+yfEzOStqofsGAql8cfwBOsvXqvhisEgmnEQofcBATitLO1V0uu4RBqsiXJb1ux6M6gymAFcXYtSNLXKeP/MyXyDd1AeCSgc6Ldt6GYja7mxG+QCm9BO4MxIN8TeCalNAmJmBaV2QJEeKRysUUUeht0coN+azbwX+HYVxnWnVd5NXdiAbx4ShJyhyLgLB29hIqvKSatgjHHIXBVI+HX2jCdyeSWuM9TCzNqLmB5cKNO2K; 20:AoNzqhKj3FiSe3RCymiL3lpZOEDWX3XiBHY2mNYkHfJSFM1ysMt0VQ1R5uuGSZp2FzKnAvuRe+QClTYMQch2fk8LOfvz6SG8tlRF/uFhiNlx8OBs5872m+2HsMTU4+ceZE62uogpaQpuGAcuyOlYkOis9CYDTnmyndxIMzSmW5k= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: acdb73aa-38e6-401d-8cfa-08d59db1f99e 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)(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:DM5PR2101MB0885; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39380400002)(396003)(376002)(39860400002)(366004)(346002)(199004)(189003)(66066001)(3846002)(6116002)(86362001)(305945005)(10290500003)(6436002)(5250100002)(3280700002)(10090500001)(3660700001)(6506007)(2501003)(107886003)(446003)(53936002)(11346002)(2616005)(26005)(76176011)(7736002)(478600001)(476003)(81156014)(25786009)(8676002)(81166006)(186003)(8936002)(4326008)(97736004)(102836004)(99286004)(14454004)(36756003)(6512007)(316002)(2906002)(22452003)(68736007)(54906003)(110136005)(486006)(6486002)(6666003)(5660300001)(2900100001)(1076002)(72206003)(86612001)(105586002)(106356001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0885; 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: sLfM48Ndq1Km1LYT+tiATOzNPluRwGa1Dc+PSuTKWvLY8GOg28MV6JHxcFuE0sm0D/3hGDv1gAuOXXXJIdMHwvVI/keUQaeiM3kfD9vUGPKPeQGjgx47ArU6QlmxJEylVXp9/BWZWfGtAmw2BO9Udw0KRUvptcUZOiohkS9CU2XK5MH1ihaVru5VOkP/clW/vYtWdDBy57IMVNJgQ5Bnxmj2O+BjzQal1KP+/1DPZJCPNr5XdDepS+rKy+AVLryoVWj6W2rb5DCT+lgHrx9SAazXgIRru/fjyqEopB5X09vS/2YSekoUHmlAu7NUTyp/8sMZ5NAKzVnO9PtU1ahL/+6/4PeJMzvG7UuxzFYrTofYXXMjLzShsMQTVvdYwd9khmycKclqDPO5Shrn9hLhunumtbNMwBhgp2tiUlm4FX4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: acdb73aa-38e6-401d-8cfa-08d59db1f99e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:28.9582 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dave Martin [ Upstream commit af66b2d88a76574d55e81d712292abd34beb6178 ] Currently, VFP registers are omitted from coredumps for compat processes, due to a bug in the REGSET_COMPAT_VFP regset implementation. compat_vfp_get() needs to transfer non-contiguous data from thread_struct.fpsimd_state, and uses put_user() to handle the offending trailing word (FPSCR). This fails when copying to a kernel address (i.e., kbuf && !ubuf), which is what happens when dumping core. As a result, the ELF coredump core code silently omits the NT_ARM_VFP note from the dump. It would be possible to work around this with additional special case code for the put_user(), but since user_regset_copyout() is explicitly designed to handle this scenario it is cleaner to port the put_user() to a user_regset_copyout() call, which this patch does. Signed-off-by: Dave Martin Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/ptrace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.15.1 diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 55909b2208cc..183f39384e4c 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -792,7 +792,7 @@ static int compat_vfp_get(struct task_struct *target, { struct user_fpsimd_state *uregs; compat_ulong_t fpscr; - int ret; + int ret, vregs_end_pos; uregs = &target->thread.fpsimd_state.user_fpsimd; @@ -800,13 +800,16 @@ static int compat_vfp_get(struct task_struct *target, * The VFP registers are packed into the fpsimd_state, so they all sit * nicely together for us. We just need to create the fpscr separately. */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, 0, - VFP_STATE_SIZE - sizeof(compat_ulong_t)); + vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t); + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, + 0, vregs_end_pos); if (count && !ret) { fpscr = (uregs->fpsr & VFP_FPSCR_STAT_MASK) | (uregs->fpcr & VFP_FPSCR_CTRL_MASK); - ret = put_user(fpscr, (compat_ulong_t *)ubuf); + + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &fpscr, + vregs_end_pos, VFP_STATE_SIZE); } return ret; From patchwork Mon Apr 9 00:28:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132953 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp648711ljb; Sun, 8 Apr 2018 17:37:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9iHxTqyig4yAcSh8e9TYqnJoOUxHfHcNUAgr6Pb7/FnaAC11zgs42mpSPiq5lHn/NCjhw X-Received: by 2002:a17:902:7611:: with SMTP id k17-v6mr3025072pll.244.1523234268797; Sun, 08 Apr 2018 17:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523234268; cv=none; d=google.com; s=arc-20160816; b=hFeJOt9rR1iDc7QSgPKfh8YtD7J6qBWBJ0aPVt40i+gFE2nRa5xVKDnmBPV8UbABeK 17iZin0gJUYcalZgQk4479+Dy0M6/jeQfFQryvrtm6PJDfSOgQkbDIv0TUd9YJrLM1x4 FBCl6gntHDuMDrxPrhFLrou5oLpXmgfZ2/KtrFBHgaDT2bg+92nv6rMFNapqjHTAIxPY 8wtP7TBRd0vDBI59W6xHxRdl4CfwO2wQ/p4+LrwulO/sApQYNnov240ZSKAdnMSNoPdU PZXGJ8ASKpuW/IKcKWN1xCr3s74QPnjXx3dDayfr2i2Y3ih7Uak9cYVUm0+V3wRFI9ep EeqA== 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=JHtEn1VXtQ+Z13mENNLagRXSk7uqP2t6QvvXoK3MZIE=; b=kVbKDcTCo/gqPbqei3F4kGRM6dSRJ0CbHDzKBDJCDcL6FeoF1GZLr12pkDXiDHBK0z SCrudNOk7aeK9cA5cFL7pDaCXi+cNlj9HbJ+s9rnhDownFIKf0E6wuDF7lUfktnfq5Yb ZOsr+zLx6D4/USo6nLaGj01gKNsQGHAoTsMxoqPNQS4SMes899HKfd+UavGM1ZpCX3NH 6D8d7l86N682vTy9n6EzJ9MJnKuuW2pfMZKxWu690cNuMitYK3FH/VWiBf5irwvTetla ByVreItN3I3i6PS4/jUJQWhhhtwmZ1CBwhvfaInISsd9J3sjM7KPY64TlGPbEybILtrj 27ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=npT9xW7D; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 h64si1561404pgc.731.2018.04.08.17.37.48; Sun, 08 Apr 2018 17:37:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=npT9xW7D; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S932821AbeDIAhp (ORCPT + 11 others); Sun, 8 Apr 2018 20:37:45 -0400 Received: from mail-sn1nam02on0135.outbound.protection.outlook.com ([104.47.36.135]:3040 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754315AbeDIAhk (ORCPT ); Sun, 8 Apr 2018 20:37:40 -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=JHtEn1VXtQ+Z13mENNLagRXSk7uqP2t6QvvXoK3MZIE=; b=npT9xW7Djd68+GjBKlDLyQSJcoiJ9rCxP7WabER2QeRdv2C8SzL9+PODqxZ5+xPRILGYfIfqCwkYhPGN27XD/+Y5KcBTzZ7gm81PXei2S2oaebKuE82pTb4IOzR4u08NmbvcnS7zesoJREm7dk1UYPoFzEmzfu/5VrPjAP0eI0k= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) 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:37:38 +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:37:38 +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.4 091/162] arm64: ptrace: Fix incorrect get_user() use in compat_vfp_set() Thread-Topic: [PATCH AUTOSEL for 4.4 091/162] arm64: ptrace: Fix incorrect get_user() use in compat_vfp_set() Thread-Index: AQHTz5m7WV/WP7Q+FEy1WfSfCQyAmw== Date: Mon, 9 Apr 2018 00:28:50 +0000 Message-ID: <20180409002738.163941-91-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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; DM5PR2101MB1031; 7:LbvF8G003+ZAKzSE9bl8BZcBHK/inbHKMht26wiNfEjOZ8S/poBdrT/J/gsMuze8XDbPbuG6EEHjVgRDrkrPtygjkWIlDENjpwxVptX+Sp3fHR4gzpuBc3YoSGWexYyGyc5BNubjqUZ9ElMZ/fQHoeQTQsEHSTgcM4zvxpq0T3cQy+XB8cgWZ6PD/5LBPLNJn2WIXUrEmNdvDL628amnhOYwMJtKFmd2/NOo3l9qry9B6cVIfUfZYKkn16PAvpGB; 20:T51gm/VqXrSqX+nQWOZwA+G9GG84IrVZGT8rhPLJOglVelZYMGIOlemV1NX5wvYlATGJQhk5u/a53vGNkKdIUD0lWqFzdBUjgLVd5n7P/EQj2E0hCATtpIgbn3HEF64Mm77aljZSF3qpqMTDkXBsmYCDrWqIBrdtye0oWykGct0= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: be7a7a8b-41bb-4c1d-ade3-08d59db218a6 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: 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)(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:DM5PR2101MB1031; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1031; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(2900100001)(10290500003)(99286004)(76176011)(14454004)(7736002)(11346002)(26005)(6666003)(86612001)(72206003)(478600001)(36756003)(106356001)(66066001)(2616005)(186003)(22452003)(86362001)(68736007)(305945005)(54906003)(102836004)(486006)(59450400001)(110136005)(316002)(6506007)(446003)(107886003)(53936002)(4326008)(105586002)(6436002)(6486002)(476003)(6512007)(5660300001)(5250100002)(25786009)(3846002)(6116002)(1076002)(97736004)(3280700002)(2501003)(2906002)(81156014)(8676002)(10090500001)(81166006)(8936002)(3660700001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1031; 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: rMEpHUP6az/HMJuM3hv4ZBB+JqN4e1sFt5daxnleEcMIJfg0O2GXwkMujTpr11WTQfjbSx1M9cFJ70zFaRKaFVv1iSU4rWMPSTvoprgcgs/8vaOJ2724CNZpQDg7E7S1wjgPFIIpFQy5jc1aTO1MS8KdPLlgqq60hvlygHHasSkeYgq0bjaKENpfIVqblw/IDofHory7c8f4DoapR3sPX1eDmJjoh8Xt7FwFuC5yq5RfCHB609oqWZbclCwNGBjVwD8XZj/1prAPweraPFdJuPn9YPBCIyBvXpDXqmxalJpQMNl6KlMHX7Ynhg5OhPz6SHvjELgIPH4fpvcSNUloyFAG3uKpRq0Kqn1kQZA+UL5rebY0uhWmALEgWbTc0SwCiMjhfnEUye7vgkRqFjOnEB2gXA7bJCJBwarxfUqHXcY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: be7a7a8b-41bb-4c1d-ade3-08d59db218a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:50.8646 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 b81fa63bc834..f67bb64d2640 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -822,18 +822,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:29:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132965 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp666052ljb; Sun, 8 Apr 2018 18:06:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+9TanVwkY0D9U4uzYKzG6LhGXQtTn5isNwyXYYWSQloqOCGFIhPw6+reft+w4xoHCz8Rvg X-Received: by 10.99.164.82 with SMTP id c18mr4967602pgp.101.1523236005553; Sun, 08 Apr 2018 18:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523236005; cv=none; d=google.com; s=arc-20160816; b=sUyhQNRyyqMGEaBiAZdIBe9aQ9PsYfGU9UJXBewtJBHqni9dq6jKenigQZgb+5XtdK ibbwtx7sfl8keixrMLitFtY2c0ISJQUq9mV7YBAbd5mNiLdbY+MWZQ0+1hEkT+rA6vKp NPQvp9/7kDGBfH/h2PykVA3/wKQyoaXxIJx8nTN9bKZu8Jl/Ggw2IcfBHw5JCmLMNMiN mpTaDV0LZL+D7EWFfV+1hO1KmBS/vUBtqRmAikQej+Jep1u7cMkPfkeBKq+uWdjHhhh8 E/pSYZ5dwLHpbyCo2W3Ngc2lKJIq27khpNJ7t4edblWQT3Wgt1n4TnIlJCInhq+t57eV kLpA== 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=G50suyWCq4jrPJwrGRblhAqNnwoaTEAf5gIOmutCFlA=; b=KMYRdAIcVCRnIJa31u+g/PScR7KHRPiND3PI7jf8johyAXRTR10yAuvmQLEVTJkiCl uhi6dO6sXdYrR3eR7hSLJf9oadJbLUnW5886BKgt8TNmFAqy7aHt1MGIpkE4kMyajHMc FV3vX+32KQMj0Sh6e9GaAD36IRJQD7efu03wwI8+YD9GDfFQkdUZAioV2CX0XOE71wRl ky2pOE3ygo36Lx3K/pDPbmg7yf1v2Aly1whmvoZn6MwwmJow2p27DdDFj9SX5bkRvIGe 28CZ5HBzRtVLXrOwAnBPBumYVUck0ZzIbgzRY9i/6jNxXsYrDtPdqxnZsi6lKclBDPlm cBNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=mcIg8nOg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 z18si9620139pgc.207.2018.04.08.18.06.45; Sun, 08 Apr 2018 18:06:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=mcIg8nOg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S1756730AbeDIBGm (ORCPT + 11 others); Sun, 8 Apr 2018 21:06:42 -0400 Received: from mail-co1nam03on0104.outbound.protection.outlook.com ([104.47.40.104]:37663 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932263AbeDIAjW (ORCPT ); Sun, 8 Apr 2018 20:39:22 -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=G50suyWCq4jrPJwrGRblhAqNnwoaTEAf5gIOmutCFlA=; b=mcIg8nOgyvDhFq17acoYQTagUbhQtS2/B/7Yshw2piG35S243d4Yzo2/yRQV1E412zJjXRdpUpV+Ixztto+emZDqdBFmWntPQ8qWQE0m81XMmPcDbYnYpqvdZ6F49KRK22nG39fn/asv5OPWhn7aXCBw89jhZPqHPiHAGMWHTj0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1125.namprd21.prod.outlook.com (52.132.130.150) 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:39:19 +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:39:19 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnd Bergmann , Steve French , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 154/162] cifs: silence compiler warnings showing up with gcc-8.0.0 Thread-Topic: [PATCH AUTOSEL for 4.4 154/162] cifs: silence compiler warnings showing up with gcc-8.0.0 Thread-Index: AQHTz5nf1BbOJSfLDkaVAZGgk0RNFQ== Date: Mon, 9 Apr 2018 00:29:50 +0000 Message-ID: <20180409002738.163941-154-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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; DM5PR2101MB1125; 7:hhAw2Un+YuRgkfYz8yBvrRhygxR5qsIIDUVKKmjerLJAk7RspWM/pKIUOgSwPmRcYN6QtsJtgvLVgz0ajftvAQB/nmuI42jcVBaN4b6Z5OxQEyrxyM8Ehf5bt+CxQyv6H/JLRuAVEGji72M57sRy311L47LSJULAQD9vi/OdB8H34x7gsosZoqGJD5L7iDU3pQpeg5ZXxzJ7qmnBAeW1XPUMmptgt2gY30dYaaO4ypP+8ZLMfMZ44I39n7KcJJII; 20:IVduZpkp7PU+4zpt9uR5OrfljT6zdUTLh8hUTD++J+b4md2UhWrbiIoi+tIJ8RHXTB4u7uZQsmcnX8h3qAvNJ2a2bmMipVeOrrAk5NQuVgKi+kgoBhwR7a1envTkD0mKnG5Xt7RTAp+WbYg+/gHtZs/qXapoESqD2c4Pa4kjaPw= X-MS-Office365-Filtering-Correlation-Id: b8b37dbe-8fd5-4433-b68f-08d59db254d7 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:DM5PR2101MB1125; x-ms-traffictypediagnostic: DM5PR2101MB1125: 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)(85827821059158); 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:DM5PR2101MB1125; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1125; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39860400002)(39380400002)(366004)(376002)(396003)(189003)(199004)(2906002)(25786009)(6512007)(10090500001)(3280700002)(10290500003)(6666003)(3660700001)(316002)(110136005)(54906003)(11346002)(107886003)(39060400002)(2616005)(476003)(446003)(36756003)(99286004)(86612001)(53936002)(4326008)(486006)(6436002)(3846002)(81156014)(305945005)(5250100002)(1076002)(102836004)(14454004)(66066001)(7736002)(105586002)(81166006)(106356001)(8676002)(97736004)(6116002)(6506007)(6486002)(5660300001)(186003)(76176011)(22452003)(72206003)(478600001)(2501003)(2900100001)(26005)(86362001)(8936002)(68736007)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1125; 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: 4sfC7dAVR8hqJgKU70OVNg+mpwYCmxHL1ndWTiOV9RtC/emygY6gyuoEZj5SDDKndhoPRftoUTcnQKWsNmxfupe9G9z9bwBI1zA/p6gamK/ikoVYdUXfKzguGLg2/945ltiQvL4tKbFHFFFaqqW+JzjXa+pPtuStdXfef/kuN9MTYVaW5l4KmkIZ+KZGTMbqpM0xjpVjrHTQhx/xKnmCdHiPnFIlBXD4Tyqux/EWJ9RZVx+HdCDk0rG0yeeUvaXF63JC1PJ0h4mShfyXKmvxvltiq8CSGfwAo+WEQknfJjvyzxHJhAX9YOgMWcZMEnSa8a953L2p2HxZb5tXNtxLz8ru5lj9SdXBYC5z5cAF0APfS4uozXSV0QhgarZiUrrfBjF0s6/GTqmVyxbkevgBZAs98b/zvipnhTqp405tVVU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8b37dbe-8fd5-4433-b68f-08d59db254d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:29:50.3027 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1125 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit ade7db991b47ab3016a414468164f4966bd08202 ] This bug was fixed before, but came up again with the latest compiler in another function: fs/cifs/cifssmb.c: In function 'CIFSSMBSetEA': fs/cifs/cifssmb.c:6362:3: error: 'strncpy' offset 8 is out of the bounds [0, 4] [-Werror=array-bounds] strncpy(parm_data->list[0].name, ea_name, name_len); Let's apply the same fix that was used for the other instances. Fixes: b2a3ad9ca502 ("cifs: silence compiler warnings showing up with gcc-4.7.0") Signed-off-by: Arnd Bergmann Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/cifssmb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.15.1 diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 0c92af11f4f4..8632380d2b94 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -6421,9 +6421,7 @@ SetEARetry: pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_EA); - parm_data = - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset; pSMB->ParameterOffset = cpu_to_le16(param_offset); pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1;