From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752493AbdEHWBB (ORCPT ); Mon, 8 May 2017 18:01:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42402 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbdEHWA7 (ORCPT ); Mon, 8 May 2017 18:00:59 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE636C04B31F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CE636C04B31F Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20170508214324.GA124468@beast> References: <20170508214324.GA124468@beast> To: Kees Cook Cc: dhowells@redhat.com, James Morris , "Serge E. Hallyn" , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] key: Convert big_key payload.data to struct MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10234.1494280856.1@warthog.procyon.org.uk> Date: Mon, 08 May 2017 23:00:56 +0100 Message-ID: <10235.1494280856@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 08 May 2017 22:00:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook wrote: > There is a lot of needless casting happening in the big_key data payload. > This is harder to trivially verify by static analysis and specifically > the randstruct GCC plugin (which was unhappy about casting a struct > path across two entries of a void * array). This converts the payload to > the actually used structures (one pointer, one embedded struct, and one > size_t). I'd really rather not do this as this moves the definition of an individual key type into the general structure (I know I've done this for the keyring type, but that's a special part of the keyring code). That's the start of the slippery slope into moving all of them in there. I'd rather you defined, say: struct big_key_payload { u8 *key_data; struct path key_path; size_t key_len; }; in big_key.c and cast &key->payload to it. David