From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartlomiej Zolnierkiewicz Date: Mon, 12 Mar 2018 14:06:12 +0000 Subject: Re: [PATCH] vgacon: fix function prototypes Message-Id: <4831767.IeJWIvYDSU@amdc3058> List-Id: References: <20180310064059.12720-1-jmoreira@suse.de> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Kees Cook Cc: Joao Moreira , Greg KH , Kernel Hardening , LKML , Daniel Micay , linux-fbdev@vger.kernel.org Hi, On Saturday, March 10, 2018 07:27:21 AM Kees Cook wrote: > On Fri, Mar 9, 2018 at 10:40 PM, Joao Moreira wrote: > > It is possible to indirectly invoke functions with prototypes that do n= ot > > match those of the respectively used function pointers by using void ty= pes. > > 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 u= sed > > 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=E3o Moreira >=20 > Whoops, I missed this one. :) Thanks! Greg, do you need this resent > directly to you? I would prefer for drivers/video/console/ changes to go through fbdev tree (like suggested by scripts/get_maintainers.pl).. However since Greg has already merged your CFI patches: Acked-by: Bartlomiej Zolnierkiewicz > Acked-by: Kees Cook >=20 > -Kees >=20 > > --- > > 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/vga= con.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, un= signed 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, i= nt d) > > +{ > > + return; > > +} > > > > const struct consw vga_con =3D { > > .owner =3D THIS_MODULE, > > .con_startup =3D vgacon_startup, > > .con_init =3D vgacon_init, > > .con_deinit =3D vgacon_deinit, > > - .con_clear =3D DUMMY, > > - .con_putc =3D DUMMY, > > - .con_putcs =3D DUMMY, > > + .con_clear =3D vgacon_clear, > > + .con_putc =3D vgacon_putc, > > + .con_putcs =3D vgacon_putcs, > > .con_cursor =3D vgacon_cursor, > > .con_scroll =3D vgacon_scroll, > > .con_switch =3D vgacon_switch, > > -- > > 2.13.6 Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics