Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8678719rwl; Sat, 31 Dec 2022 09:47:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXsq6wqzRD11pMA2LdXWMVECHYuGeYmpFFpLrAul29t9epbs7JHbKpLsEYut5NpTDeSmBJ0e X-Received: by 2002:a17:906:c0ce:b0:7ad:d7a4:4346 with SMTP id bn14-20020a170906c0ce00b007add7a44346mr37510991ejb.66.1672508840590; Sat, 31 Dec 2022 09:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672508840; cv=none; d=google.com; s=arc-20160816; b=beFsh2g2JcwGhS9A3zEfiQ+tomkV1oh5kSeVVbozQWpMFtx0lPkMNPqoq1CWRdjqay HIv9O3O4PsA6SI1KJMVAosHH0EcpDBN43aPgCcJRcy8uZUtChkxEVoWD6t7YwVKQPf/P pDZxEhYX/OMqoX+x+OmjVTHEALjzt2UE0y3mtTx4OevtgO1+M9LI19ilYVrDmuqJ9bcT AW2lfQ/JWHwb/LM8J6rsd/mn+5olu2zHbhw/V/r1DHJkUs2DlCdzYi4/3mNcjs1oCdz1 J3KDIPOhkFUEk7feAlFnwiOzOVczK8VfQoMA/UqkS++KAaZIgOLFJuCV+tSUT2DkYYKR tpRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BieIGO6AoMbifiT3OopKcMneZqgdjWyAWyEUYPxXF0g=; b=IIgbPq5bJuB1aelx2xNMVTR0sRQe6mHjC+39sEq0PsiJ/EV+GY3nGqW1Mnr+/IstdS pFA+Nl3K/+duiUjBmTgk8iZoD1stItMz253fFLJTRJp1l+aB6HBSoqx8vUDjZRn97Zby 3AlASkKVaCM03nUNi2wvCVdkwoQtSmLbGzHayVOlGjOZOoMexitmdvn6XvlIPadRZk3p p2GwSIVYrjW+1xhqEJbAj3uK9AJzBFtFkbeKU9p4ajEHkZ+kF3lw5uY5NN+LG5pXDgn9 kQGGqIbRUeXLaGfECM8g03s5Xh4kdj1ozaFMV+4ZGGiLegvzhGYQm9iMcXBNEAWY74E2 YApw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht11-20020a170907608b00b007c0ce331e13si19838123ejc.703.2022.12.31.09.47.06; Sat, 31 Dec 2022 09:47:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235678AbiLaR2J (ORCPT + 62 others); Sat, 31 Dec 2022 12:28:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbiLaR2H (ORCPT ); Sat, 31 Dec 2022 12:28:07 -0500 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 34F4A2724 for ; Sat, 31 Dec 2022 09:28:04 -0800 (PST) Received: (qmail 14259 invoked from network); 31 Dec 2022 17:28:03 -0000 Received: from localhost (HELO pvt.openwall.com) (127.0.0.1) by localhost with SMTP; 31 Dec 2022 17:28:03 -0000 Received: by pvt.openwall.com (Postfix, from userid 503) id B080EAB3A4; Sat, 31 Dec 2022 18:27:58 +0100 (CET) Date: Sat, 31 Dec 2022 18:27:58 +0100 From: Solar Designer To: David Laight Cc: 'Shawn Webb' , "oss-security@lists.openwall.com" , Alejandro Colomar , Michael Kerrisk , "linux-kernel@vger.kernel.org" , "linux-man@vger.kernel.org" Subject: Re: [oss-security] [patch] proc.5: tell how to parse /proc/*/stat correctly Message-ID: <20221231172758.GA10297@openwall.com> References: <1a1963aa1036ba07@orthanc.ca> <20221228152458.6xyksrxunukjrtzx@mutt-hbsd> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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 Hi all, Let's wind this oss-security thread down as it relates to brainstorming and commenting on totally new designs - no more of that, please. Many things were said, but realistically the interface isn't _that_ broken (this can be parsed correctly, and procps-ng manages to) and is (hopefully) not going to change much (in my opinion, and I know I'm not alone in this, most of the proposals would make things worse overall). Somewhat realistically, one possible change is replacing the most risky characters, such as braces and anything <= ASCII 32, perhaps with '?' to match what procps-ng is doing. Perhaps do this either on all updates of "comm" or in all places where "comm" is reported to userspace (including procfs and kernel messages, by calling a common function). "comm" isn't the full process name anyway - it's often truncated - so it can reasonably be made safer in other ways as well. As an option, the replacing of whitespace (ASCII 32) and braces could be limited to the "stat" file, but the control characters are (even more) problematic with other interfaces where "comm" is exposed, so replacing them should probably be global. Happy New Year! Alexander