Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbdG1RKU (ORCPT ); Fri, 28 Jul 2017 13:10:20 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:37507 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbdG1RKS (ORCPT ); Fri, 28 Jul 2017 13:10:18 -0400 MIME-Version: 1.0 In-Reply-To: <04db0bba-bf20-27dc-06ec-b99ce2df7fc8@amd.com> References: <20170725214756.GA102262@beast> <04db0bba-bf20-27dc-06ec-b99ce2df7fc8@amd.com> From: Kees Cook Date: Fri, 28 Jul 2017 10:10:15 -0700 X-Google-Sender-Auth: NRH5-MxkBWNdkkqsUB7wp6WFqGg Message-ID: Subject: Re: [PATCH] drm/amd/powerplay: rv: Use designated initializers To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Alex Deucher , David Airlie , LKML , Maling list - DRI developers , amd-gfx list , Alex Deucher , Rex Zhu , Hawking Zhang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v6SHARRe025022 Content-Length: 1578 Lines: 49 On Fri, Jul 28, 2017 at 2:13 AM, Christian König wrote: > Am 28.07.2017 um 03:43 schrieb Alex Deucher: >> >> On Tue, Jul 25, 2017 at 5:47 PM, Kees Cook wrote: >>> >>> As done for vega10 in commit 3ddd396f6b57 ("drm/amd/powerplay: Use >>> designated initializers") mark other tableFunction entries with >>> designated >>> initializers. The randstruct plugin requires designated initializers for >>> structures that are entirely function pointers. >>> >>> Cc: Rex Zhu >>> Cc: Hawking Zhang >>> Cc: Alex Deucher >>> Signed-off-by: Kees Cook >>> --- >>> If I can get an Ack for this, I'll carry it in the gcc-plugins tree, >>> unless >>> you think this is worth landing for v4.13, in which case, please take it >>> now. :) >>> >> Acked-by: Alex Deucher >> >> I'm happy to take this through my tree if that is ok with you. > > > I'm wondering a bit how the plugin detects that it can randomize a structure > layout? > > We have a couple of structs where this would be fatal. Automatic randomization only happen on struct that are entirely function pointers. See: https://git.kernel.org/linus/313dd1b629219db50cad532dba6a3b3b22ffe622 And: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=914e2dfc61195a95868ae5c750690a7f1c87bc66 If you have any structures that are shared externally from the kernel, I can mark them with __no_randomize_layout. -Kees -- Kees Cook Pixel Security