Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1998416pxb; Mon, 13 Sep 2021 09:44:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWLRH2h+nvP4oF88mJdsvvokYCOt7h3k3cEs4Yx23J/6uVl35RuxRFDiyGOh/NH2ePB5Uk X-Received: by 2002:aa7:c0c7:: with SMTP id j7mr14113695edp.58.1631551480310; Mon, 13 Sep 2021 09:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631551480; cv=none; d=google.com; s=arc-20160816; b=TR92sFcrB5QBGb8w4svrg5QF5TnY67hlr3y759iPAxcSoyZyBkZ1TQ3RDPz9CPGqAv 32YyWruimb23bqq8Otw8DFg6iaAclWh8Eqknk4cfQL1TFawsvnkl2kGVgc4UlUvHijMS gEIDkV4Qwn4Eq26tFCTzWeDcxHxlKCXcbkAuVbak32vsu2ywS4uDqDOcQJIi0PArOXu/ VMeQgCIlwDDnQMv4sz1v5H/6ty17sBABN8g2juRgvzwsmFimzQSOrKVbkkSyUvGJCPbP c2miRrXgry90tGAwQbfWnGKTC/NkpHyoiIZY3/KGQ80dbtfD3xt8L+gCEXNqKzVLBsAB md1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=9etkatJg5nKShmGZklzZahxT3ZNU9cZVwDepK9BODww=; b=OWk/qj9iyNwP8jTaRostcfayZTtdQiicCFDaYlFIrKKaILFjAgOyn8qIje/U8hD49x epxt7qLCy2MGj+iHUUwmX+kdbGcJ3Nd9Gj2kx68nO2eYrkL64WbM6OVbVe380ENtYCfr X53dXcqaSQTkSFnz7b8AuMIDNY8jHr0GHwe729I9ORSyWGwz6GbMyw0eQgutmdxIUtmQ 6jlO4Mj6Hu3p53fE4UzGFTlAyQ6XaC5HdkLm6Ugl6tfFyO+ao2xq+/DebxOPco151Tn1 bjbVn9k/gqR6Mdh/BXNMJsghoK7ZpjrPhWJ3Tw4L9Qghtk6r1erEBEOne0tD1q8oTR7l RSJQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd14si7653233edb.36.2021.09.13.09.44.14; Mon, 13 Sep 2021 09:44:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238502AbhIMQlQ (ORCPT + 99 others); Mon, 13 Sep 2021 12:41:16 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:39846 "EHLO mail-pl1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237242AbhIMQlP (ORCPT ); Mon, 13 Sep 2021 12:41:15 -0400 Received: by mail-pl1-f174.google.com with SMTP id c4so4664756pls.6; Mon, 13 Sep 2021 09:39:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9etkatJg5nKShmGZklzZahxT3ZNU9cZVwDepK9BODww=; b=B3TfVpA1EEK9sAMKSwTPCioRAPKtCvvCFLZlPhfhq2yVQVQHbaqj36CAuzaK3U2IX6 yRhFV2nZZyO5dq1hLDQnWIpgxDuLSLgOZCXxcqweZfQyPEh1Fx9TSnKusBsznecj0BQk KhqkHjn/8Qxf8PQ/lvNAWsr/92jehYc4YoktsloLmV7rPvQsITL9ANbC0hFOJ1plwNHf IALSgNzl6BHtRl1if6ouAKWcb269rGpz+9D15Y5a0yFHc9dZH0F7M9QeLVOHy/nH3Vi3 D7gV7B308YqIGfqgOL17wEuV91qqi8LokMFaRjckX6bIeA2znJo/lBBIWjiGIvRSB4rv cMjA== X-Gm-Message-State: AOAM533awpgPSIQKxGvhcIMRaFAzcTSAJGrbaLrn+Tx6OIqdzzRpSdL9 AuCgx0CluACnv07Lqhv0jolp7dR8ckc= X-Received: by 2002:a17:90b:3e87:: with SMTP id rj7mr383019pjb.73.1631551198378; Mon, 13 Sep 2021 09:39:58 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:6765:113f:d2d7:def9]) by smtp.gmail.com with ESMTPSA id i8sm7634077pfo.117.2021.09.13.09.39.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Sep 2021 09:39:57 -0700 (PDT) Subject: Re: start switching sysfs attributes to expose the seq_file To: Christoph Hellwig , Greg Kroah-Hartman , "Rafael J. Wysocki" , Alexander Viro Cc: Jens Axboe , Tejun Heo , linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210913054121.616001-1-hch@lst.de> From: Bart Van Assche Message-ID: <21413ac5-f934-efe2-25ee-115c4dcc86a5@acm.org> Date: Mon, 13 Sep 2021 09:39:56 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210913054121.616001-1-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/12/21 10:41 PM, Christoph Hellwig wrote: > Al pointed out multiple times that seq_get_buf is highly dangerous as > it opens up the tight seq_file abstractions to buffer overflows. The > last such caller now is sysfs. > > This series allows attributes to implement a seq_show method and switch > the block and XFS code as users that I'm most familiar with to use > seq_files directly after a few preparatory cleanups. With this series > "leaf" users of sysfs_ops can be converted one at at a time, after that > we can move the seq_get_buf into the multiplexers (e.g. kobj, device, > class attributes) and remove the show method in sysfs_ops and repeat the > process until all attributes are converted. This will probably take a > fair amount of time. Hi Christoph, Thanks for having done this work. In case you would need it, some time ago I posted the following sysfs patch but did not receive any feedback: "[PATCH] kernfs: Improve lockdep annotation for files which implement mmap" (https://lore.kernel.org/linux-kernel/20191004161124.111376-1-bvanassche@acm.org/). Bart.