Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp595714pxu; Thu, 15 Oct 2020 11:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrXMvAIIV48tpb1AY+HBqyLGVrbsOYy7XN0SFX+vWH0iJABUbcf4zzgfTV8MgMK70X0b3l X-Received: by 2002:a17:906:e2d1:: with SMTP id gr17mr5832387ejb.433.1602786453224; Thu, 15 Oct 2020 11:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602786453; cv=none; d=google.com; s=arc-20160816; b=gMKMcUmqVhwPT74sjj4K5HcV6kBlxyTFj2M7eCemoQ1JeXR3HUoQtG7UkCnleXiMTH Yq1NwVAXWW9RSr49IgAzz9LFvfyHcjr3ag1YMVBm5CEnmNGIW5s//Edk96xl9Y3l+kRK tcgMOwQZOilv6H07UdBEriJX57Yz4xGrnD6dj5I21gnv9TWN+cmZqPnkCBfe8K/Ms8+G 5WwS6Bc4G6zFrf3LWqrlRXuJ5bxlHRCqO58zjeeTwyynUV9dU58jQ/YUHoWDMJzF5C+q wvThQvQyXuNipN1iL4i53fJJysXhAPicBEbAA6c+6hLEIuOj4f2n+6HRNz5e6l23b1Ak oGZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O3E1pC9UGTTt4nprLSiUqABd2GQPiIsCgYSgfRuYliQ=; b=RHiG/zdxhL4cg/jBtHFf6anTkpOf46pJxRzB8yF0mGFQs59LMGLWmkWDjKJOrERjQ4 GffClNecBZBuCpBXQW5EiOtULrDgfO6PTRIkdQY/JorOS9vaIBNvRna5xJ2duM3OC1L+ mgWtZ6R6ExeCO3a9Rb7hHJ4WXOALXyJSs3LO+8QTT/xgwMYzsRZuAPp+Q9EAzeDyfZg4 I6JVxUdkWRbXqZCeM7GtsnDpREY6ohOijOBBxWr1JabbLgNduo9hanPeCJW5CB8cCa7f CumagT3B/kC7aomTXiS2DnJ1DWSa7+K+sLRvYz15khiyWcPqqCeIriO/DxTTeRJyPr0Y t/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Ykf3d86Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si2629901edt.456.2020.10.15.11.27.02; Thu, 15 Oct 2020 11:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Ykf3d86Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbgJOMWt (ORCPT + 99 others); Thu, 15 Oct 2020 08:22:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:35552 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728009AbgJOMWt (ORCPT ); Thu, 15 Oct 2020 08:22:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602764568; h=from:from:reply-to:subject:subject: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=O3E1pC9UGTTt4nprLSiUqABd2GQPiIsCgYSgfRuYliQ=; b=Ykf3d86Z3+f9jbCUC7X8f0cbnMTdZA65/bvHBAhZVj869a4ZulOk456qdgRS3OqXlSMU4/ c6/z9DPUQcllBbXn4AVwCwcs7bPT9SKG3wIm7O39X4m3IDoGXjO/aGjszNcn4TsFeE7bvP +fB2bScxULYBI2EiImGUd/IV4zGsiUk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EC176B27B; Thu, 15 Oct 2020 12:22:47 +0000 (UTC) Date: Thu, 15 Oct 2020 14:22:46 +0200 From: Petr Mladek To: John Ogness , Sergey Senozhatsky , Steven Rostedt Cc: Linux-Next Mailing List , linux-mm , open list , lkft-triage@lists.linaro.org, LTP List , Andrew Morton , Mike Rapoport , Stephen Rothwell , Rasmus Villemoes , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , Naresh Kamboju Subject: Re: [PATCH] printk: ringbuffer: Wrong data pointer when appending small string Message-ID: <20201015122246.GD8871@alley> References: <20201014140514.GB17231@alley> <20201014151311.GB13775@alley> <20201014175051.GC13775@alley> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201014175051.GC13775@alley> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-10-14 19:50:54, Petr Mladek wrote: > data_realloc() returns wrong data pointer when the block is wrapped and > the size is not increased. It might happen when pr_cont() wants to > add only few characters and there is already a space for them because > of alignment. > > It might cause writing outsite the buffer. It has been detected by LTP > tests with KASAN enabled: > > Link: https://lore.kernel.org/r/CA+G9fYt46oC7-BKryNDaaXPJ9GztvS2cs_7GjYRjanRi4+ryCQ@mail.gmail.com > Fixes: 4cfc7258f876a7feba673ac ("printk: ringbuffer: add finalization/extension support") > Reported-by: Naresh Kamboju > Signed-off-by: Petr Mladek The patch is committed into printk/linux.git, branch for-5.10-fixup. I am going to send a pull request with it tomorrow unless something happens in the meantime. Best Regards, Petr