From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752092AbcF1JHv (ORCPT ); Tue, 28 Jun 2016 05:07:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32872 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118AbcF1JHt (ORCPT ); Tue, 28 Jun 2016 05:07:49 -0400 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: <20160628073742.GA15496@gondor.apana.org.au> References: <20160628073742.GA15496@gondor.apana.org.au> <1eeb00c5098d8096cdb61dc7ee1ddc61b3e80f9e.1466974736.git.luto@kernel.org> <32026.1467099166@warthog.procyon.org.uk> To: Herbert Xu Cc: dhowells@redhat.com, Andy Lutomirski , x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Borislav Petkov , Nadav Amit , Kees Cook , Brian Gerst , "kernel-hardening@lists.openwall.com" , Linus Torvalds , Josh Poimboeuf , Jann Horn , Heiko Carstens Subject: Re: [PATCH v4 02/29] rxrpc: Avoid using stack memory in SG lists in rxkad MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5181.1467104864.1@warthog.procyon.org.uk> Date: Tue, 28 Jun 2016 10:07:44 +0100 Message-ID: <5182.1467104864@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Jun 2016 09:07:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Herbert Xu wrote: > Huh? If you can't write to csum_iv_head without clobbering others > then by the same reasoning you can't write to csum_iv either. So > unless you're saying the existing code is already broken then there > is nothing wrong with the patch. Ah, for some reason I read it as being in the normal packet processing. Need tea before I read security patches;-) Since it's (more or less) a one off piece of memory, why not kmalloc it temporarily rather than expanding the connection struct? Also, the bit where you put a second rxrpc_crypt in just so that it happens to give you a 16-byte slot by adjacency is pretty icky. It would be much better to use a union instead: union { struct rxrpc_crypt csum_iv; /* packet checksum base */ __be32 tmpbuf[4]; }; Note also that the above doesn't guarantee that the struct will be inside of a single page. It would need an alignment of 16 for that - but you only have one sg. Could that be a problem? David