Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4605489rwb; Sun, 13 Nov 2022 09:18:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7uwDbzluIzSvixdFwjO4t1G5oGd6yjdT3+o/oGlwLwHOQGIVEqVphMAqWShrZo8oypX3CC X-Received: by 2002:a63:316:0:b0:470:f0c:1aa7 with SMTP id 22-20020a630316000000b004700f0c1aa7mr9154265pgd.373.1668359908362; Sun, 13 Nov 2022 09:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668359908; cv=none; d=google.com; s=arc-20160816; b=dGtSEwXkCm+4FM1AfBUBSql2Ty6X+WowgTiBOFxx30PEqyGbkNp8bfMmAlJs9chzDx FfDere4xHHDWuGv3WYLmz+ghMIuYb77z68aKAp49hdyBcBYMIsZybwSFZBgkt8fk82Mp x2ksXEU4wi/oXwlBtdm+B3CRnMg/6eL07YypL8En7Gt1hKBRb51IT2zJWqrhwEPa4g8S uJPRZqYDJ7AKwNXrGYLxz5rQf/JuHGGSs2KncvdI8zNDC0aRsrUZx8cg2qICEX8PqF3C BD0LyF/ywT+nT4W887ro1WZXXQgRc3dA6jgWV3DinXXqSRV0Ix3w6UH/bRfgZE8bdtbn sMew== 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=eB/hC3tGZeJADbPXtdKZGPPgu/jWHckff1IDi4hbfsg=; b=VXm99JG3YbGzJdRffjqvRDrPtoXyyGGAxKy03XJ1GAqmoxasCa3ehMbwTDYK6BcvUr OfC6FBAyM/u4OmcPMxgdpcnDLremUsaX19bNH6DKrO8J20+T31DM5FFJPytEcLFEWHzw 3QSVYR8mFGQwKOGWUlqUw4kF6cS+8sBNJQ6Lhh9oX+rl7FZ9Vgfs85uJnCwdMXW6lqim UKe8+94m4yNGN9LmQCmAdBxt3c1a/hiPpxlOUXYFRy1IzM5KVjBDhKzAcwXXqaHDPGo+ INjyPNDMhYR7T0S0VF6Jdb4nqyZgDtTu/O9R63w/xPeIMhsA4T7tGkyC4lZrmLn1doAR cEqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Ji4HYYYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902a38800b00187204e13fcsi6975077pla.516.2022.11.13.09.18.16; Sun, 13 Nov 2022 09:18:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Ji4HYYYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235286AbiKMQ6a (ORCPT + 89 others); Sun, 13 Nov 2022 11:58:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235014AbiKMQ60 (ORCPT ); Sun, 13 Nov 2022 11:58:26 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751D724F; Sun, 13 Nov 2022 08:58:24 -0800 (PST) Received: from zn.tnic (p200300ea9733e71a329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e71a:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id D58EF1EC008F; Sun, 13 Nov 2022 17:58:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1668358702; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=eB/hC3tGZeJADbPXtdKZGPPgu/jWHckff1IDi4hbfsg=; b=Ji4HYYYbpsV4WMX6qTt/HajNGQTw5Ysj4UBgFSfemcuXmmV3RTigUJS37NepjYccA4XA0S RCkwnsSQab6YU3XqZse5KIhGkKiAA5f0AEnjXjmiytImR0eICK361NCiJi+7zJ0fAzToCE fVOtbbnVzNiMcBN72B83JjFBbFv31gU= Date: Sun, 13 Nov 2022 17:58:17 +0100 From: Borislav Petkov To: "Joseph, Jithu" Cc: "gregkh@linuxfoundation.org" , Thiago Macieira , "Luck, Tony" , "hdegoede@redhat.com" , "markgross@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "Raj, Ashok" , "linux-kernel@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" , "patches@lists.linux.dev" , "Shankar, Ravi V" , "Jimenez Gonzalez, Athenas" , "Mehta, Sohil" Subject: Re: [PATCH v2 12/14] platform/x86/intel/ifs: Add current_batch sysfs entry Message-ID: References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> <20221107225323.2733518-13-jithu.joseph@intel.com> <5e65889d-d68c-b29d-6cea-7b4ce4c87b4a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5e65889d-d68c-b29d-6cea-7b4ce4c87b4a@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 13, 2022 at 08:41:47AM -0800, Joseph, Jithu wrote: > Do you think it is better to restrict filename input to confirm > to ff-mm-ss-xy. format rather than accepting any string and > treating it as a file-name and trying to load it, if it is present ? Yap, that way you pre-filter filenames. Yeah, the header checks *must* absolutely happen too but it would be a simple first test. Also, you can check for: ff-mm-ss-X. where X is a [0-9]+ of arbitrary length and this way won't have the artificial 256 limit you have now. > (Given that, before loading, We do intel_find_matching_signature(), > which validates if the signature/pf entries in header confirms to the > machine we are on before loading) > > We did accepting file-name as input before [1] (except for validating > if the filename confirms to ff-mm-ss format) Yeah, except now you want to do multiple sets of scan files. But yeah, you can extend the interface even more: echo /sysfs/file * if f/m/s matches, you execute if still within the timeout, you return -EAGAIN from current_batch_store() to tell userspace, take a nap and try again. * if the f/m/s doesn't match you return -EINVAL to say, wrong filename, try the next one. And this way, the user script can simply look at the retvals and act accordingly - it won't even need to parse dmesg or wnatnot. For example. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette