Received: by 10.223.185.111 with SMTP id b44csp1139485wrg; Fri, 9 Mar 2018 22:43:09 -0800 (PST) X-Google-Smtp-Source: AG47ELtMpivfMzSFFV0g0B2jP8dpakmxWrHNhCE3ViQoqgbWlyFw+0I4NR7pZKHLQG9TdFda8aGC X-Received: by 2002:a17:902:6943:: with SMTP id k3-v6mr1178732plt.214.1520664188996; Fri, 09 Mar 2018 22:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520664188; cv=none; d=google.com; s=arc-20160816; b=tStc35rYyAuF/ONwHVvuOy19N9V7BJOKp01gBooBLjeFL8IfGl/FJTDFiuwneLPa7d djvQSdmufABYcoumKZXDkGZIsTxRQFkg4lfxZ6L4kYdYVyk8fCV7Med4DVcFSEVavlLJ 3iO4+rMpDjDyrTh5iVL4LuizZhMkRe/8bpTP3I7JgGxQKYWZl1Y8qy4Ufs5AWqFGcLby fNlFqFs9HAY2VaJButDV7EHRyLH15zINyHeyU+K1my36It9+ecXqbYLKXkon88xxL9Nq t3QtDRZJBicL0FAishtn8pncHrM+T6XCK8dXBq5zJkNen8Hyih85I5muGyDgCppd2Rg3 3WUw== 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 :message-id:date:subject:cc:to:from:arc-authentication-results; bh=6DG54/6NtFjptAO1iMN704UbU2ZHSp5KmmuFLSDvj5g=; b=ddDCTlVXfyPPZFNC1EYJxkvpoXvZV2qvZ7Ps7F2WFucVZJP8vWmAfZJkBL1hhVL0lg GstJCLU/m8CAcW0QF1SNi48i5kegZ8S+EdXDNV7pEId9YNMYYXmXcWO4JsaO4LvBZ9f4 Fee1ZzsbLoJGvQHvxAyD4RBgK0uUeM8zuydP50TAtZv38KEBdX7/T7vQJelWQAzm3ImJ /RBNdfBt8+8RPg8VfK5d+cWW1qZ0F5/IYZBqzuM0+w4sgixgXfzYNOOYu00+XvD4qTmx V+yCNMqlOY1wSQa17mt4SSAOl85Pk/SDk9bD0WOKMO5Y/qqj9XOuga2rAeWyFWFqUXZP fHDA== ARC-Authentication-Results: i=1; mx.google.com; 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 u15-v6si2364420plk.516.2018.03.09.22.42.39; Fri, 09 Mar 2018 22:43:08 -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; 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 S1751038AbeCJGlM (ORCPT + 99 others); Sat, 10 Mar 2018 01:41:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:55284 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbeCJGlL (ORCPT ); Sat, 10 Mar 2018 01:41:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 94994AD25; Sat, 10 Mar 2018 06:41:10 +0000 (UTC) From: Joao Moreira To: kernel-hardening@lists.openwall.com Cc: linux-kernel@vger.kernel.org, danielmicay@gmail.com, keescook@chromium.org Subject: [PATCH] vgacon: fix function prototypes Date: Sat, 10 Mar 2018 03:40:59 -0300 Message-Id: <20180310064059.12720-1-jmoreira@suse.de> X-Mailer: git-send-email 2.13.6 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 It is possible to indirectly invoke functions with prototypes that do not match those of the respectively used function pointers by using void types. Despite widely used as a feature for relaxing function invocation, this should be avoided when possible as it may prevent the use of heuristics such as prototype matching-based Control-Flow Integrity, which can be used to prevent ROP-based attacks. Given the above, the current efforts to improve the Linux security, and the upcoming kernel support to compilers with CFI features, fix prototypes in vgacon console driver. Another similar fix can be seen in [1]. [1] https://android-review.googlesource.com/c/kernel/common/+/602010 Signed-off-by: João Moreira --- drivers/video/console/vgacon.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index a17ba1465815..f00b630f6839 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -1407,21 +1407,29 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b, * The console `switch' structure for the VGA based console */ -static int vgacon_dummy(struct vc_data *c) +static int vgacon_clear(struct vc_data *c) { return 0; } -#define DUMMY (void *) vgacon_dummy +static void vgacon_putc(struct vc_data *c, int a, int b, int d) +{ + return; +} + +static void vgacon_putcs(struct vc_data *c, ushort *s, int a, int b, int d) +{ + return; +} const struct consw vga_con = { .owner = THIS_MODULE, .con_startup = vgacon_startup, .con_init = vgacon_init, .con_deinit = vgacon_deinit, - .con_clear = DUMMY, - .con_putc = DUMMY, - .con_putcs = DUMMY, + .con_clear = vgacon_clear, + .con_putc = vgacon_putc, + .con_putcs = vgacon_putcs, .con_cursor = vgacon_cursor, .con_scroll = vgacon_scroll, .con_switch = vgacon_switch, -- 2.13.6