From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425FEC41513 for ; Mon, 14 Aug 2023 11:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbjHNLlR (ORCPT ); Mon, 14 Aug 2023 07:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234812AbjHNLlJ (ORCPT ); Mon, 14 Aug 2023 07:41:09 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2054510C0; Mon, 14 Aug 2023 04:41:02 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D643F1F383; Mon, 14 Aug 2023 11:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1692013260; 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=1EwJnpDzSZ9Tq3Xj5sEIz1mrOXITnbkSLBxYcSSAIHU=; b=VmxuValf5Fwxkz7hUuJ61A9Gvfy9sooXGrvxm9KrVHDWcHELWVvrxuN1vRKAVUxJW7xXkT /gNFDY44YN3fit1KwlOLDEcjb41FA3htMqEqsKoH7aix2AGYE4Ex7det+uM87jI4imO0r1 9xNuvisDHI3GauYqLGeLBZTbiHgypxY= Received: from suse.cz (pmladek.tcp.ovpn2.prg.suse.de [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4E5DF2C143; Mon, 14 Aug 2023 11:40:59 +0000 (UTC) Date: Mon, 14 Aug 2023 13:40:57 +0200 From: Petr Mladek To: Kees Cook Cc: Sergey Senozhatsky , Steven Rostedt , John Ogness , Vijay Balakrishna , stable@vger.kernel.org, Tony Luck , "Guilherme G. Piccoli" , "Paul E. McKenney" , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] printk: ringbuffer: Fix truncating buffer size min_t cast Message-ID: References: <20230811054528.never.165-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230811054528.never.165-kees@kernel.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Thu 2023-08-10 22:45:32, Kees Cook wrote: > If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in > copy_data() was causing writes to truncate. This manifested as output > bytes being skipped, seen as %NUL bytes in pstore dumps when the available > record size was larger than 65536. Fix the cast to no longer truncate > the calculation. > > Cc: Petr Mladek > Cc: Sergey Senozhatsky > Cc: Steven Rostedt > Cc: John Ogness > Reported-by: Vijay Balakrishna > Closes: https://lore.kernel.org/lkml/d8bb1ec7-a4c5-43a2-9de0-9643a70b899f@linux.microsoft.com/ checkpatch.pl suggested that "Link:" should be used instead of "Closes:". > Fixes: b6cf8b3f3312 ("printk: add lockless ringbuffer") > Cc: stable@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Petr Mladek Thanks a lot for tracking this down. The patch has been comitted into printk/linux.git, branch for-6.6. I though about pushing it for 5.5-rc7. But it is pretty old issue. It does not break the system. I wanted to give it some spin in linux-next. And I leave for vacation on Thursday. I will not have internet connection until Aug 28. Best Regards, Petr