From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796297776; b=rJJLgKBfKyMVaNgVftFMcF6BYROU1DqGLj0A0sv7S8m5yRs1ui+TFwJzm04f2ZDzkTuB BwYWfI+AmAU8pjgCidyxwU0JKDQNbz2G4mPbX6VXzzf8a4XVQjwzpUDtlvcL7ssGOVFZb 3nw7B4pPDstGqwCm31XJhQcjQ+V4aW/e/VkpFJmaMwwkHEqha8N998JOpVULf2hVq2Od3 GeGsOmnvxASw696k8ZcGZaotBXnZ9ERCylZ3+Z8d+o2jWzX08vUyPvDf2F8GGTEBdgkPP DpCOGDua/0XvT528R/tzt6UaxNpSJbXBEI01S73lanTLLRw9KrMgfvLdZnxmK3etSaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796297776; h=DMARC-Filter:Received:DKIM-Signature:DKIM-Signature:DKIM-Signature: DKIM-Signature:Received:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-Spam-Flag:X-Spam-Level:X-Spamd-Result:X-Spam-Score; bh=E/1fq8b3ju4NpIH1JCwVEVzCzxAImkmtS6bqEfadC9M=; b=LZJUDgubcjRIDd5MhLZLc82OCYqG5/FRCQv5QMN846DERMw/sNcO3lUNpuPDIZLZgUTF IHVvyvl+8LQH7FHpHe9lX+z29yV5DW3UOjPqf8vv30yT0f98xnPQM92r5VvpWyqXw+D4C oKQSmivL1a+tiHetMvw9E5pTWNoBjY3pfBRQFFk8iez4llIm0H0LjO6OfR499+AL6Cyze ge1MazLs8rgIB3bvMU3DFINshAwrs/mTWALrq6qqWbGRZxoQS8sp3MSYqftl+D3gO+4gX X3W+s/6Cgv9BrHxbfu8Jv780FSMu+H0n9r53bAjwaxT8AY4knegOLVnK/YdaDIlVp1g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b="S3Zna/6g"; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ys101pwd; dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=XAuuWCMF; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=8TIbsVDu; arc=none smtp.remote-ip=195.135.223.130 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E31606A338; Thu, 3 Dec 2026 11:36:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 22E31606A338 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=S3Zna/6g; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ys101pwd; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=XAuuWCMF; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=8TIbsVDu Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 280FC34FCE; Thu, 3 Dec 2026 11:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796297773; 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=E/1fq8b3ju4NpIH1JCwVEVzCzxAImkmtS6bqEfadC9M=; b=S3Zna/6g4IkOjhqjBJwXudOrMx/OAf3W5BTAlsIybkUxf6K3VF6mZ+DjxrU3yYridUxG0i l0wc/8WjCgjl2FpZAUdHRr9g5aaO0x15brdfR00z4r7do6I6S8Ns6OCswPa3sTU6hH65bl id/9WhN4GVAbENGhsKjtt78UWOpRrXM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796297773; 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=E/1fq8b3ju4NpIH1JCwVEVzCzxAImkmtS6bqEfadC9M=; b=ys101pwdYZqy8jUMoSzqcsAklRHfmNe0RXxhIXvxbeh/rSVDAQnFWWBc0sFfXlh8Op+w8s SBGuOTrfyntf3VCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796297772; 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=E/1fq8b3ju4NpIH1JCwVEVzCzxAImkmtS6bqEfadC9M=; b=XAuuWCMFg5Vzx654A1I1jb8Fa6acbwPS4CVtRWHN/6FHddU79ux+6xiH2m6G3W5aRhgt0o V4kPpU5oVQS/O3tpxKV5PY29E/xuAaRPf5w0OSd1iPnUNXdpvCnAMEnimfT3QLJllJ2tT6 RIt9+iN4qehGR4H1VRfxNtHQpYSYqdI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796297772; 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=E/1fq8b3ju4NpIH1JCwVEVzCzxAImkmtS6bqEfadC9M=; b=8TIbsVDuwGwbeoNgkcjlBAmfCCb4zCpwH+Y2jvNsmwCXwILzbzTL60Wa6WwmGu8Rh7iRfk dKkT/lCMdPHRF8Dw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C7F1D1348F; Thu, 3 Dec 2026 11:36:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id K0QFJitUEWugZgAAD6G6ig (envelope-from ); Thu, 03 Dec 2026 11:36:11 +0000 Date: Thu, 03 Dec 2026 12:36:11 +0100 Message-ID: <87ecbyvbo4.wl-tiwai@suse.de> From: Takashi Iwai To: Hao Ge Cc: Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] ALSA: pcm: derive the audio timestamp for the DEFAULT type In-Reply-To: <20261203100109.170640-1-hao.ge@linux.dev> References: <20261203100109.170640-1-hao.ge@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Flag: NO X-Spam-Level: X-Spamd-Result: default: False [-12.30 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[linux.dev:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -12.30 On Thu, 03 Dec 2026 11:01:09 +0100, Hao Ge wrote: > > snd_pcm_update_hw_ptr0() calls ->get_time_info() only when > audio_tstamp_config.type_requested is not DEFAULT, while > update_audio_tstamp() derives the timestamp from the buffer position > only when audio_tstamp_report.actual_type is DEFAULT. The two > conditions do not line up for a stream that requests the DEFAULT > type. The callback is never called for such a stream, so actual_type > stays at SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT, the zero value a > kzalloc'ed runtime starts with, and update_audio_tstamp() reads the > local audio_tstamp that was never written. This path never reaches a > driver, so it cannot be fixed driver-side. > > BUG: KMSAN: uninit-value in update_audio_tstamp+0x728/0x880 [snd_pcm] > update_audio_tstamp+0x728/0x880 [snd_pcm] > snd_pcm_update_hw_ptr0+0x189c/0x1c50 [snd_pcm] > snd_pcm_delay+0x258/0x890 [snd_pcm] > snd_pcm_common_ioctl+0x2ef/0xbc0 [snd_pcm] > snd_pcm_ioctl+0x72/0xd0 [snd_pcm] > __se_sys_ioctl+0x1be/0x340 > do_syscall_64+0x138/0x4b0 > entry_SYSCALL_64_after_hwframe+0x76/0x7e > Local variable audio_tstamp created at: > snd_pcm_update_hw_ptr0+0x9f/0x1c50 [snd_pcm] > > The reports come from a PipeWire stream querying > SNDRV_PCM_IOCTL_DELAY and SNDRV_PCM_IOCTL_STATUS64, and from the > period elapsed interrupt. > > Also take the requested type into account in > update_audio_tstamp(), and derive the timestamp from the buffer > position when the caller asked for DEFAULT, which is what the type > means. > > Fixes: 3179f6200188 ("ALSA: core: add .get_time_info") > Cc: stable@vger.kernel.org > Signed-off-by: Hao Ge Applied now. Thanks. Takashi