Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp817961imu; Tue, 11 Dec 2018 08:03:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9jE7pzeu/Sll9vHHsjNZ5CPcGyn857BOvgSrUUegBYjMYLl/qoJlK7wiuKtyks9rI+lZ9 X-Received: by 2002:a65:55ca:: with SMTP id k10mr14919546pgs.448.1544544209682; Tue, 11 Dec 2018 08:03:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544544209; cv=none; d=google.com; s=arc-20160816; b=tNa8nediUvB5GP1z5FH1QnB2nkUeb9s/5rlxF3Jd0nVWzdNpZsmuPqJ8s5ojTGa+F0 BJcO7D5j+cX2VVCDGAj8gIIluGwkJl82/Qf0bT1eJvPxj/UiLxmpWNZZRjmakflUKqla n1vaWmQkG8egTciOsvnj79W+WR7IOCNIsdGU6rg3CUP3fGk3/9vUuTgueLuUHw7IhFVo jQPIXpHqyi3/Z+EFe7xa11fVCuRiBVswyTPGYw86LGS6xEQOjgOxCQq6W9E8TsFsw9mE dWc5ZTycsM8/0IzG4sCGLc+DokOrSIItKd+nSayduyHgTzfRR8irm96vv96S0YXHnnUm lqwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sGLEft9MD25hKTl7KDGGjg2eJU0kTWW0cU2o7RQWvnA=; b=LeVEVlkb7ViT9s7N6rQDuNOaMkBAVxqXrNGHncB17djh4jKSByQUv+UmQCyznHaS26 aXI5a4WI6GqSX5StXQAw9G1fE7CU1nFjQ4rJmIPEPliaUWn9+2kAfx7vfWUXqcIYLzJm p78FaL/SjqgV71BDwGoQT+bDfuXItqTmG9TiSk7P9DfspJe4FR0s4B8dlJIOtOu/lmrZ IyJGwn288/OJugdZbFa3o0cBI+K1OHRvVua3dsHLg0fMkH712+w0YpL6n7vKm1pNz1tz 7ujMoYJ9LR87OcKgHOVoCKczyZwIqqbYV3XF30Zga56dkIuTOfrHIijGvB8MYnXXikM0 QaoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SEhe3wU8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si12106724pgq.197.2018.12.11.08.03.15; Tue, 11 Dec 2018 08:03:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SEhe3wU8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730825AbeLKP5c (ORCPT + 99 others); Tue, 11 Dec 2018 10:57:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:46502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730810AbeLKP53 (ORCPT ); Tue, 11 Dec 2018 10:57:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED93F205C9; Tue, 11 Dec 2018 15:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543848; bh=sIiJv8f773/KtXrqifesFxWZo52tXbRoN97aCtG6sSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEhe3wU8iInNL318AzntcJFKEbqNdk1G7zXDQ8WNaRWB42adUM6kMPsJe/XKLIPfj JVZMnCMlPBIWBZByIi6i6MHbluITyHrJ7PFL2XKSfTQKWW7LXjGKlAFtnYPHqq5tw6 xAND1mbYXoo4qZVC8lGbm4D2GUFAdIRSI8YeQoOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Cohen , Laura Abbott , Masami Hiramatsu , Kees Cook , Russell King Subject: [PATCH 4.19 088/118] ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE Date: Tue, 11 Dec 2018 16:41:47 +0100 Message-Id: <20181211151647.822266181@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151644.216668863@linuxfoundation.org> References: <20181211151644.216668863@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kees Cook commit e46daee53bb50bde38805f1823a182979724c229 upstream. The arm compiler internally interprets an inline assembly label as an unsigned long value, not a pointer. As a result, under CONFIG_FORTIFY_SOURCE, the address of a label has a size of 4 bytes, which was tripping the runtime checks. Instead, we can just cast the label (as done with the size calculations earlier). Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1639397 Reported-by: William Cohen Fixes: 6974f0c4555e ("include/linux/string.h: add the option of fortified string.h functions") Cc: stable@vger.kernel.org Acked-by: Laura Abbott Acked-by: Masami Hiramatsu Tested-by: William Cohen Signed-off-by: Kees Cook Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/probes/kprobes/opt-arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/probes/kprobes/opt-arm.c +++ b/arch/arm/probes/kprobes/opt-arm.c @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct } /* Copy arch-dep-instance from template. */ - memcpy(code, &optprobe_template_entry, + memcpy(code, (unsigned char *)optprobe_template_entry, TMPL_END_IDX * sizeof(kprobe_opcode_t)); /* Adjust buffer according to instruction. */