Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6964268rwb; Tue, 22 Nov 2022 23:30:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4e79siGCy4PQtx7ua/iXSrdgqTj8fSuPXvaU+bAUUibCavhSixCKIJuCqTJ0sIG+/E2ehX X-Received: by 2002:a17:90a:bd11:b0:206:64cd:4797 with SMTP id y17-20020a17090abd1100b0020664cd4797mr29274694pjr.103.1669188602568; Tue, 22 Nov 2022 23:30:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669188602; cv=none; d=google.com; s=arc-20160816; b=fDL2xTfgl5wZEWJRJWc4codEdWJ6kvz9zivvIlseIxA9jqID6ccIs4cQevDTyQ/FOf Qk5FQQSg5rvsPOVbNKgd4QWdAfePj+ZO3XXDMfAMf/ktmp4PzQBsvdJz0vPaf21vbRZd T9BW/Gfl02OKLWVGSG70KMsOepKCm7CS5+9tvXfEttx8BFZG9hNIE5A2N6mkxfJLcD9S U85ERwZMZJa+a/s4nuyY4GJmRh3D3woJ7LWt78h2iyrbXVV5UH6SdOgaV6qK9BUx8Yuc d1kTeoN+SAAzWMAi26BpNvBMX3ykioFbzddcQA8/MLWnA1SYBr4qZM3f5BssVmhuxBev 714Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=DWIEFciCRBJZr4QjejGTJsTfwg2gOtGq8bBxtqG2n8Y=; b=XND02/AGPTvGkLcoRfxhpm/dhd92StOkTt5Ob80RIRSHTXsdeg1phEFGR/dhvZ9nC2 HE0PUjPOHLKsqB1tu34Jx9l053wWPnBRLgEm6uZkZ5KFYa+679yjLvbsfelAIkvCokLi h+sF1X7ilbWJlZ5K4Rffdx8Qq89bn5olzQmaYYx2LHf8J0pZlquu7/5V7f1m2vdXBYQG j6lUo1m3r7q82apMiVD4m/jCHE0bIBBacBmYhRJCLziKLwIZL+di9annQKxi2575kAnJ uwjlDkzctpqUV4/atebtGH8ZgWMKT5tr9cTrTFUY/82jAtaylCQ2WEUKw+V8zpRrERnT JvAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wfmbIv8J; dkim=neutral (no key) header.i=@suse.de header.b=GFRPrWkE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b00477bdc1d5desi798557pgd.330.2022.11.22.23.29.51; Tue, 22 Nov 2022 23:30:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wfmbIv8J; dkim=neutral (no key) header.i=@suse.de header.b=GFRPrWkE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiKWG4B (ORCPT + 89 others); Wed, 23 Nov 2022 01:56:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236072AbiKWGz7 (ORCPT ); Wed, 23 Nov 2022 01:55:59 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14094F41A7 for ; Tue, 22 Nov 2022 22:55:57 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8003D220D5; Wed, 23 Nov 2022 06:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669186556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DWIEFciCRBJZr4QjejGTJsTfwg2gOtGq8bBxtqG2n8Y=; b=wfmbIv8JpgkhaZK8IIXmc5hWdRBRECNB1gXH6/QkPtm9Wo3WSygKkxZqNqy8O8FVv9VXNg GY++2ZG1C9iM2Q/aamtiCsmgpXQAt9sjfUKXYBqEgWKddynrY6Dn7S3OlHkQcKmFiU4HT4 q5uIGt359H+869VsnU8MsYPHvDtx+rA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669186556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DWIEFciCRBJZr4QjejGTJsTfwg2gOtGq8bBxtqG2n8Y=; b=GFRPrWkEHgYQbiDNPXUQHVtuSEx0ietQjcKiXG9GwaQasQCLjXIXUYPQkDqo7wmo/Gn9T8 6pOIeDfor7etEDAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5114913A37; Wed, 23 Nov 2022 06:55:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id krdFEvzDfWO2RQAAMHmgww (envelope-from ); Wed, 23 Nov 2022 06:55:56 +0000 Date: Wed, 23 Nov 2022 07:55:56 +0100 Message-ID: <87mt8i5fcz.wl-tiwai@suse.de> From: Takashi Iwai To: Xiaolong Huang Cc: perex@perex.cz, tiwai@suse.com, baolin.wang@linux.alibaba.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH] ALSA: rawmidi: fix infoleak in snd_rawmidi_ioctl_status_compat64 In-Reply-To: <20221123050911.1045190-1-butterflyhuangxx@gmail.com> References: <20221123050911.1045190-1-butterflyhuangxx@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Nov 2022 06:09:11 +0100, Xiaolong Huang wrote: > > The compat_status is declared off of the stack, so it needs to > be zeroed out before copied back to userspace to prevent any > unintentional data leakage. > > Fixes: d9e5582c4bb2 ("ALSA: Avoid using timespec for struct snd_rawmidi_status") > Signed-off-by: Xiaolong Huang > > --- > > Reason for resend: > 1. add Fixes line. > --- > sound/core/rawmidi_compat.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/sound/core/rawmidi_compat.c b/sound/core/rawmidi_compat.c > index 68a93443583c..6afa68165b17 100644 > --- a/sound/core/rawmidi_compat.c > +++ b/sound/core/rawmidi_compat.c > @@ -80,6 +80,7 @@ static int snd_rawmidi_ioctl_status_compat64(struct snd_rawmidi_file *rfile, > if (err < 0) > return err; > > + memset(&compat_status, 0, sizeof(compat_status)); > compat_status = (struct compat_snd_rawmidi_status64) { > .stream = status.stream, > .tstamp_sec = status.tstamp_sec, Here at the line just after your addition, compat_status is fully initialized by substitution, so I believe the memset is superfluous. Or have you verified that it really leaks the uninitialized memory? thanks, Takashi