Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752905AbaFIHY5 (ORCPT ); Mon, 9 Jun 2014 03:24:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58914 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbaFIHY4 (ORCPT ); Mon, 9 Jun 2014 03:24:56 -0400 Date: Mon, 09 Jun 2014 09:24:53 +0200 Message-ID: From: Takashi Iwai To: "Wang, Xiaoming" Cc: vinod.koul@intel.com, jeeja.kp@intel.com, dhowells@redhat.com, arnd@arndb.de, tglx@linutronix.de, mtk.manpages@gmail.com, paulmck@linux.vnet.ibm.com, davej@redhat.com, linux-kernel@vger.kernel.org, dongxing.zhang@intel.com Subject: Re: [PATCH] ALSA: compress: Fix the mismatch size of struc between share lib(32bit) and kernel(64bit) In-Reply-To: <1402346792.30956.17.camel@wxm-ubuntu> References: <1402346792.30956.17.camel@wxm-ubuntu> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Mon, 09 Jun 2014 16:46:32 -0400, Wang, Xiaoming wrote: > > > The size of struct snd_compr_avail is 0x1c in 32bit kernel, > while it is 0x20 in 64bit kernel 0x4 bytes added because of > alignment. It is OK when 32bit kernel met 32bit user space. > There exist stack corruption if 64bit kernel met 32bit user > space, because the size of struct snd_compr_avail is 0x1c > in 32bit user space which is smaller than it will get from > kernel. The extra 4 bytes can corrupt the stack, and > introduce unpredictable error. > > Signed-off-by: Zhang Dongxing > Signed-off-by: xiaoming wang This would break the existing 32bit systems, so I don't think we can take this approach. Either break the 64bit systems (which aren't deployed yet much, so far) by adding packed attribute, or implement 32/64 bit conversion in compat_ioctl fop. thanks, Takashi > --- > include/uapi/sound/compress_offload.h | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h > index 5759810..766b416 100644 > --- a/include/uapi/sound/compress_offload.h > +++ b/include/uapi/sound/compress_offload.h > @@ -70,6 +70,7 @@ struct snd_compr_tstamp { > __u32 pcm_frames; > __u32 pcm_io_frames; > __u32 sampling_rate; > + __u32 reserved[1]; > }; > > /** > -- > 1.7.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/