Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2828687pxb; Mon, 19 Apr 2021 15:20:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5EQz0f1kfUkGCjqQmdvhS1ga4LyyiMEMfFqLhZoAaIKH3WSiDx7a3wrApfkgTQ0Zhcu3z X-Received: by 2002:aa7:87d5:0:b029:25a:b5f8:15ab with SMTP id i21-20020aa787d50000b029025ab5f815abmr15522728pfo.22.1618870811828; Mon, 19 Apr 2021 15:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618870811; cv=none; d=google.com; s=arc-20160816; b=SyV9NPEzJ240ldZVhRyXNLr+aexRXh/9hkdSoQFgqPfBepKnNZDZTXGRSgcasEfB4y F6FQaugYwM97cbq9bN1FEbhRFS4EXSVSwqx/eWMlP1YeAmWzv9f6ZDokp5zySG2odwhx xHsfxOrs117kwc4U++yk5Rd+G2ClVxOICj0W/scQnAVkSHIkJQ5ftKWxEhkEwdyJPH9e 3TnQSu/C1cMmud4rLCLtWsaizWE5wg/WN4SohH1nRldXf/PLGCOLZ8AGiyczwgCLLR+n BOGep0jzUozVXiQBl6fqWP/B9oCrybfVD2FVbLrGi6M/XYQ6/IjVRgf62a4o5/VqaEo/ qSng== 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=jFcfADdReYDV23uSItauKX3LP1+td5MJJyNjkvs+t+E=; b=L7/OHpy+Q8os0pbACa55kRQPflsDgKWwsUKgswowm/W61Qk6LgwgDN5gUQ0j/r38CJ tErQnQe3MDq3CEehXFenPMrGQV6umgKaw3w9xYuBevqsx6F4mRKgUeHCu81ZTABL/8mx 7RFRN8VDMDFJBIsrRBlFP2iyO9r6rtZ12tgapYKuEgWbtbjp6lH7EwQFbV4/1dSm/7kT XLRVQSMV+8hedr/sR1+E4RhtpNJMUDXXMN4Fx8EbUNbbyHCYDCglUMZOnxJckHaP4Mvy hV4ExJvdKt8YrVwp5udaemut6RtrQH5ncZnpA+dWtV2M57bW/zzEf/Howrzhmc3yQkX0 RCwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d2jy4Xdz; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si19269117pld.334.2021.04.19.15.20.00; Mon, 19 Apr 2021 15:20:11 -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=@redhat.com header.s=mimecast20190719 header.b=d2jy4Xdz; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbhDSUjb (ORCPT + 99 others); Mon, 19 Apr 2021 16:39:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55764 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbhDSUjb (ORCPT ); Mon, 19 Apr 2021 16:39:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618864741; 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=jFcfADdReYDV23uSItauKX3LP1+td5MJJyNjkvs+t+E=; b=d2jy4XdzOQMsHaN+DVyMWoaGVbu9RAzC3Ru0FISb1VhgL2UQ1sELP1bAvsDWVFyISj4KAa cYAZXZi4RwakQWI5cK3bPiBh/0V+kO/S1snSWiz279ZSD7iKlo79jCGn1zqFxv3l66ZslP 5ybuSBmxfToI53iqhYoU5J6vuyQWMSY= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-34uGC0NWOyCVNRA477tCUw-1; Mon, 19 Apr 2021 16:38:59 -0400 X-MC-Unique: 34uGC0NWOyCVNRA477tCUw-1 Received: by mail-qk1-f197.google.com with SMTP id g184-20020a3784c10000b02902e385de9adaso5159313qkd.3 for ; Mon, 19 Apr 2021 13:38:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jFcfADdReYDV23uSItauKX3LP1+td5MJJyNjkvs+t+E=; b=a4PB3PlCNDjaD52LLMlCwsUfN9dUrnVCNI/NvDNl0YmLVVlLOElAVvG5KsJvplg2uw rdyeW3BD29dIGd1/GGmj2Mwblsoww/nh74+2D3Ax6NHf+2Ubr/tmXgqK5Os8CFh70Owi qR0+QZnielmhi378qyI0rw1j0ggffNIR0ET7dueqeOPZWOJ5xcFTz59DMQu060bJQCT2 u6lbg5T+b48EYNrJJSLWWgRFZ41UN1fY0FxR7BpT+S2K7LIWRwsV9K4q1CaTbmyphEf4 WogCZcs7LKKdhteqL5Up+dNpxxAUgJ4X1PaYvHD5mxusSW1XXOFOU3AwtInarHEdycw9 hcFw== X-Gm-Message-State: AOAM532n3GWfzo6vYwIcNUSrKYpbGMMO9dWo8l1FM8yZ/s3jwK+vTnpP QGqnsjTs1cHvr0RjFJpn1FG4jBGyhB2TXJhQR6jLQBPscpXopetQyzzNLRlPoD0gdwIVuKL6rgS IVDiDF0gH735pOTy+qfq40ajA X-Received: by 2002:ac8:109a:: with SMTP id a26mr13180000qtj.156.1618864738303; Mon, 19 Apr 2021 13:38:58 -0700 (PDT) X-Received: by 2002:ac8:109a:: with SMTP id a26mr13179972qtj.156.1618864738015; Mon, 19 Apr 2021 13:38:58 -0700 (PDT) Received: from xz-x1 (bras-base-toroon474qw-grc-88-174-93-75-154.dsl.bell.ca. [174.93.75.154]) by smtp.gmail.com with ESMTPSA id m2sm10622082qkc.14.2021.04.19.13.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 13:38:57 -0700 (PDT) Date: Mon, 19 Apr 2021 16:38:55 -0400 From: Peter Xu To: Paul Gortmaker Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker , Marcelo Tosatti Subject: Re: [PATCH] sched/isolation: don't do unbounded chomp on bootarg string Message-ID: <20210419203855.GX4440@xz-x1> References: <20210418215426.1086941-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210418215426.1086941-1-paul.gortmaker@windriver.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 18, 2021 at 05:54:26PM -0400, Paul Gortmaker wrote: > After commit 3662daf02350 ("sched/isolation: Allow "isolcpus=" to skip > unknown sub-parameters") the isolcpus= string is walked to skip over what > might be any future flag comma separated additions. > > However, there is a logic error, and so as can clearly be seen below, it > will ignore its own arg len and search to the end of the bootarg string. > > $ dmesg|grep isol > Command line: BOOT_IMAGE=/boot/bzImage isolcpus=xyz pleasedontparseme=1 root=/dev/sda1 ro > isolcpus: Skipped unknown flag xyz > isolcpus: Invalid flag pleasedontparseme=1 root=/dev/sda1 ro > > This happens because the flag "skip" code does an unconditional > increment, which skips over the '\0' check the loop body looks for. If > the isolcpus= happens to be the last bootarg, then you'd never notice? > > So we only increment if the skipped flag is followed by a comma, as per > what the existing "continue" flag matching code does. > > Note that isolcpus= was declared deprecated as of v4.15 (b0d40d2b22fe), > so we might want to revisit that if we are trying to future-proof it > as recently as a year ago for as yet unseen new flags. Thanks for report the issue. Is cpuset going to totally replace "isolcpus="? It seems most hk_flags will be handled by nohz_full=, and HK_FLAG_DOMAIN can be done by cpuset. However it seems still the only place to set the new flag HK_FLAG_MANAGED_IRQ. If one day we'll finally obsolete isolcpus= we may need to think about where to put it? When I looked at it, I also noticed I see no caller to set HK_FLAG_SCHED at all. Is it really used anywhere? Regarding this patch... > > Cc: Peter Xu > Cc: Ingo Molnar > Cc: Thomas Gleixner > Cc: Peter Zijlstra > Cc: Frederic Weisbecker > Fixes: 3662daf02350 ("sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters") > Signed-off-by: Paul Gortmaker > > diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c > index 5a6ea03f9882..9652dba7e938 100644 > --- a/kernel/sched/isolation.c > +++ b/kernel/sched/isolation.c > @@ -188,7 +188,8 @@ static int __init housekeeping_isolcpus_setup(char *str) > } > > pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par); > - str++; > + if (str[1] == ',') /* above continue; match on "flag," */ .. wondering why it is not "str[0] == ','" instead? Thanks, > + str++; > } > > /* Default behaviour for isolcpus without flags */ > -- > 2.25.1 > -- Peter Xu