Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7089469imu; Wed, 14 Nov 2018 11:31:34 -0800 (PST) X-Google-Smtp-Source: AJdET5d7Rzfyd1iUdrAilV++dkHjj87/T85LAQ+3NOHi+WtqEeTt1BC5M4PRrtWpnHlOMXzirqls X-Received: by 2002:a63:6c4a:: with SMTP id h71-v6mr2952286pgc.326.1542223894214; Wed, 14 Nov 2018 11:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542223894; cv=none; d=google.com; s=arc-20160816; b=pEiV/eoxOgb4BjCXPaAePpJcKJb80gcMK0moUh3WeAL3ga26+Fi+EisHa2jY9jeVid PDAld2+u0PUXxs1XpZtCo9w4m/wOHX485zerB+8PyUCfvMj6wrEuXeoeAraQAQyHowgC fpfY5lGe0kJIkH8gDrrYAHGNhcQmFEtfczHfHQAplUYdtv23DBdJtufASEKDASIBm3NV W8G4S5gPwW/UZJ8J8E2iG7KiIOmmckJhtXz3o19BaHssRt8Bj8lp+E0USIsD4nuwtl4s RSStbnSQI5Ob9HsxbL0GSuoyoJqloInQM+PK1127YJ4zDVcIHAAoOjNOdIGCJ+uvqzbK F83A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=oi0TCS8gun0s2zkNmbMTEflut3MzevT7Z8cNItMsbrY=; b=lbQSeRtOGW7i79z3ft/bBRU6uoGuJM+auw2pb1beA2K0LJ/FvRP1gHsfKi299v2KVq 0CDXzS8CvR+jZTXA3U1MYIQnY1qaVxiYYMG8fCO3bKWoB2jBFgWD4XDBYP+/xPRNCDit TSQfqOXYXyUxYgt/NbrpT3bclSmkgcNQnH2RCSyoDDhoLF3svUzrbTEZHZmHmjHsZ1fh +KmQ/dkU1+Aesn8mCxjKj+CR/BfM5lX8puW4PIdI6sN4jut46H34EHiFpTwHunk1KOo4 eSh8YLM8gJ+B+rmB9m7IZBZH59x6oznYGLquRQ/SKOFB3gJ0fu4Ur01a747Jotgz+CmF JAsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19si18951453pgf.573.2018.11.14.11.31.18; Wed, 14 Nov 2018 11:31:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726427AbeKOFeH (ORCPT + 99 others); Thu, 15 Nov 2018 00:34:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:55130 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725756AbeKOFeH (ORCPT ); Thu, 15 Nov 2018 00:34:07 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4B434AEBC; Wed, 14 Nov 2018 19:29:35 +0000 (UTC) Date: Wed, 14 Nov 2018 20:29:32 +0100 From: Petr Mladek To: Andy Shevchenko Cc: Steven Rostedt , Qian Cai , linux-kernel@vger.kernel.org, "Tobin C. Harding" , Geert Uytterhoeven , Rasmus Villemoes Subject: Re: WARNING: CPU: 26 PID: 64391 at lib/vsprintf.c:2193 set_precision+0x84/0x90 Message-ID: <20181114192932.uir4fuuteer7bqtm@pathway.suse.cz> References: <1542128132.12945.19.camel@gmx.us> <20181113172920.GI10650@smile.fi.intel.com> <1542135498.12945.20.camel@gmx.us> <20181113142317.379dbaf7@vmware.local.home> <20181113230511.5di75uyht7ecdcvl@pathway.suse.cz> <20181114093819.GL10650@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181114093819.GL10650@smile.fi.intel.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2018-11-14 11:38:19, Andy Shevchenko wrote: > On Wed, Nov 14, 2018 at 12:05:12AM +0100, Petr Mladek wrote: > > On Tue 2018-11-13 14:23:17, Steven Rostedt wrote: > > > On Tue, 13 Nov 2018 13:58:18 -0500 > > > Qian Cai wrote: > > > > > > > > Care to print the len and name parameters before this line? > > > > len = 60612; name = > > > > > > How big are pages on arm64? Because we shouldn't get to this path if > > > the string is bigger than PAGE_SIZE. But I know that on PPC64, > > > PAGE_SIZE can be 64K, and 60612 is less than that. Thus, if we get > > > there, the test is against signed int:16 (16 bit signed integer) that > > > can go up to most 32768. If the string size is bigger than that, you > > > would get this error. > > > > > > I would just say to ignore it. > > > > I tend to agree. > > > > > The only thing that can happen if > > > someone does this is to trigger the warning. Unless if it is considered > > > a form of DOS, where userspace just bombards the console by triggering > > > this waring. > > > > We are actually on the safe side because it is WARN_ONCE(). > > > > > But I don't see a problem with the actual design. There's > > > no reason we should be processing string variables bigger than 32768 in > > > vsprintf. > > > > It is not even needed in this case. The string is limited also by > > MODULE_NAME_LEN. > > At least not in this code. > > Are you proposing to replace strlen(name) with strnlen(name, MODULE_NAME_LEN)? It might be a solution. Well, it looks like a wrong design when we would need to use MODULE_NAME_LEN outside module loader code. Also it does not handle other request_module() users that might be affected. On the other hand, I am not sure how a proper solution would look like. request_module() should not limit printk format before the arguments are substituted. The most clean solution probably would be on the vsprintf-level. I mean to limit the precision by the overall string length limit. But it looks a bit weird as well. I still tend to ignore it. The code is safe from the security point of view. The warning would trigger only when completely misused. Best Regards, Petr