From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752036AbdJRNuy (ORCPT ); Wed, 18 Oct 2017 09:50:54 -0400 Received: from mout.web.de ([217.72.192.78]:53516 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbdJRNuv (ORCPT ); Wed, 18 Oct 2017 09:50:51 -0400 Subject: Re: Adjusting further size determinations? To: Julia Lawall , "linux-integrity@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" Cc: David Laight , Joe Perches , Jason Gunthorpe , "kernel-janitors@vger.kernel.org" , Stefan Berger , Alexander Steffen , Nayna Jain , Jerry Snitselaar , "linux-kernel@vger.kernel.org" , Jarkko Sakkinen , James Bottomley , Corentin Labbe , Kenneth Goldman , Paul Mackerras , =?UTF-8?Q?Peter_H=c3=bcwe?= , Andy Shevchenko , Dan Carpenter References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> <026d582729b849b780fbaa06fb8bc79e@infineon.com> <1508322510.6806.3.camel@perches.com> <1508327383.6806.7.camel@perches.com> <0fc1f522-8772-d859-a9b0-cb3b6931c862@users.sourceforge.net> <063D6719AE5E284EB5DD2968C1650D6DD009ACE3@AcuExch.aculab.com> From: SF Markus Elfring Message-ID: Date: Wed, 18 Oct 2017 15:50:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:BDumP38gLRQfsDi1CapSd9Y0H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E/VIlKZaGqKkkKQ/X1iStNbVlZl3Ftc8LthIiqgfQ3nuI= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> If you want 'security' for kmalloc() then: >> >> #define KMALLOC_TYPE(flags) (type *)kmalloc(sizeof (type), flags) >> #define KMALLOC(ptr, flags) *(ptr) = KMALLOC_TYPE(typeof *(ptr), flags) Such an approach might help. >> and change: >> ptr = kmalloc(sizeof *ptr, flags); >> to: >> KMALLOC(&ptr, flags); >> >> But it is all churn for churn's sake. > > Please don't. Interesting … > Coccinelle won't find real problems with kmalloc any more if this is done. The corresponding source code analysis will become different (or more challenging) then. Are you still looking for related solutions? Regards, Markus From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Wed, 18 Oct 2017 13:50:04 +0000 Subject: Re: Adjusting further size determinations? Message-Id: List-Id: References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> <026d582729b849b780fbaa06fb8bc79e@infineon.com> <1508322510.6806.3.camel@perches.com> <1508327383.6806.7.camel@perches.com> <0fc1f522-8772-d859-a9b0-cb3b6931c862@users.sourceforge.net> <063D6719AE5E284EB5DD2968C1650D6DD009ACE3@AcuExch.aculab.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: Julia Lawall , "linux-integrity@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" Cc: David Laight , Joe Perches , Jason Gunthorpe , "kernel-janitors@vger.kernel.org" , Stefan Berger , Alexander Steffen , Nayna Jain , Jerry Snitselaar , "linux-kernel@vger.kernel.org" , Jarkko Sakkinen , James Bottomley , Corentin Labbe , Kenneth Goldman , Paul Mackerras , =?UTF-8?Q?Peter_H=c3=bcwe?= , Andy Shevchenko , Dan Carpenter >> If you want 'security' for kmalloc() then: >> >> #define KMALLOC_TYPE(flags) (type *)kmalloc(sizeof (type), flags) >> #define KMALLOC(ptr, flags) *(ptr) =3D KMALLOC_TYPE(typeof *(ptr), flags) Such an approach might help. >> and change: >> ptr =3D kmalloc(sizeof *ptr, flags); >> to: >> KMALLOC(&ptr, flags); >> >> But it is all churn for churn's sake. >=20 > Please don't. Interesting =E2=80=A6 > Coccinelle won't find real problems with kmalloc any more if this is done. The corresponding source code analysis will become different (or more challenging) then. Are you still looking for related solutions? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.web.de ([217.72.192.78]:53516 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbdJRNuv (ORCPT ); Wed, 18 Oct 2017 09:50:51 -0400 Subject: Re: Adjusting further size determinations? To: Julia Lawall , "linux-integrity@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" Cc: David Laight , Joe Perches , Jason Gunthorpe , "kernel-janitors@vger.kernel.org" , Stefan Berger , Alexander Steffen , Nayna Jain , Jerry Snitselaar , "linux-kernel@vger.kernel.org" , Jarkko Sakkinen , James Bottomley , Corentin Labbe , Kenneth Goldman , Paul Mackerras , =?UTF-8?Q?Peter_H=c3=bcwe?= , Andy Shevchenko , Dan Carpenter References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> <026d582729b849b780fbaa06fb8bc79e@infineon.com> <1508322510.6806.3.camel@perches.com> <1508327383.6806.7.camel@perches.com> <0fc1f522-8772-d859-a9b0-cb3b6931c862@users.sourceforge.net> <063D6719AE5E284EB5DD2968C1650D6DD009ACE3@AcuExch.aculab.com> From: SF Markus Elfring Message-ID: Date: Wed, 18 Oct 2017 15:50:04 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Sender: linux-integrity-owner@vger.kernel.org List-ID: >> If you want 'security' for kmalloc() then: >> >> #define KMALLOC_TYPE(flags) (type *)kmalloc(sizeof (type), flags) >> #define KMALLOC(ptr, flags) *(ptr) = KMALLOC_TYPE(typeof *(ptr), flags) Such an approach might help. >> and change: >> ptr = kmalloc(sizeof *ptr, flags); >> to: >> KMALLOC(&ptr, flags); >> >> But it is all churn for churn's sake. > > Please don't. Interesting ... > Coccinelle won't find real problems with kmalloc any more if this is done. The corresponding source code analysis will become different (or more challenging) then. Are you still looking for related solutions? Regards, Markus