Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2035648rdh; Tue, 26 Sep 2023 10:17:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpBvoUs9YnonOrPgJLapIGcOVAK8teMliOHSg+/1mX/R1YZm/UFdtSkpkbGAAgAhksFNwF X-Received: by 2002:a05:6830:4d8:b0:6c4:a127:9ff2 with SMTP id s24-20020a05683004d800b006c4a1279ff2mr10806099otd.11.1695748662319; Tue, 26 Sep 2023 10:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695748662; cv=none; d=google.com; s=arc-20160816; b=mkNtK/g1akInntBDzNRGBNev23/PVqjPQKU+Od+sWnx+mxwBSjwEyxwTJqrSArXbNf XZht06nEFJR2z/X3KcTIUVq7UB2o7pytvzzr9PeC8Okx4qVfKlSsyeYsIkiypySeHA+7 L9M080JbrkfAAhxU7Z8eKQ5UB9npLGpb4ycHLBuTC+FAVtjEavYEtaPq2iDhc1ySTfEc CZWauRIt8pZZuYPFpCwtgX2iq4ojj+GKqrMlnZTurXgc+nOzEGvx9a2NzPnY3ubkm19W yUBGyUfGHN0L9V0w2qAkxoHlc7ObGIIHXbnJnQr/84H92Gq1Oz/EPMiAueGomCpIHIv/ JXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uRwJs6LGdBPmfL+586hFfECrrSIQE+7lECzp/i1r0Oo=; fh=ii1wDhy1SnSrvv5E1TsrWN692ttf1PCgsHP4OwL81FY=; b=PgFJZgLsCQuasqZInLWTjyUZGoXkAfglqAmM45m072OBH1WbjvQt3YJOPbVA5EVaS1 18uox2+skdlHay8kmvMR4rIvean9AADnK4/U/Kr0SuH62m9j6zCzjgXy16EYXwLbR51T nYGgPBs5ofcEm/nLZ+apLiIDOrLS5g2SgUuWsEOW2eKK+CVvU1U4NttK9QZdHUKnUPax HiPSf9YHYlaJ8Wu8aNFFIaeQl1KakHMw9ra2gU3ltNTUJJYEqjWD7mrRK2nR3z2ZMniv 3btPMCSVxPsMKlmw2WhtoZiDZF2PZRfrFAohj6rkH4eM6hhJbdZZtaZIY9RzLeHl2aci H5MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=RlRbx2NH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x27-20020a63171b000000b005789abf4414si12925685pgl.399.2023.09.26.10.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 10:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=RlRbx2NH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A398980898F1; Tue, 26 Sep 2023 07:06:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbjIZOG3 (ORCPT + 99 others); Tue, 26 Sep 2023 10:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjIZOG1 (ORCPT ); Tue, 26 Sep 2023 10:06:27 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C7A311F for ; Tue, 26 Sep 2023 07:06:19 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9adca291f99so1087104466b.2 for ; Tue, 26 Sep 2023 07:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1695737178; x=1696341978; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uRwJs6LGdBPmfL+586hFfECrrSIQE+7lECzp/i1r0Oo=; b=RlRbx2NHhjAn/pAuWXI2fytFzd4stg+4X3dZdI+3MrnGaxJlPL5xPXiGP5/kJlsavo W2DEsZ4G/sOjTXKZpFjIqQ82v5TXzzovwoWrIeeexbVRzpxtSX9TKejisI0oF98gQIgV cK/VFBNImURPzGTaMf3rheRCHLetCkbWoZ1nk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695737178; x=1696341978; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uRwJs6LGdBPmfL+586hFfECrrSIQE+7lECzp/i1r0Oo=; b=sjxCGdpjq6+wBuh76K72NsozgpNS4pRsqe0fVbkUuXvL7WWwVfz8Y+UO/iT3eu1Ug8 OFhppsIPvEglb1BQdnSNVGAOwN4XKWov5EikBhhNRsTlLNRKAnSnsJ+aWvYPOmKqggF/ XYlZuPLSZGH9T7NBv8PNYzCyrz9TL4ZzsPrY/1y2ZAgMRjiPdh2cr6rtN/VNT7C6OQgo Lq/S+JpbeLQ1rFhdjlCaq1WUtKrjUdcJziYkVVFbwguk7gTGGwYiN7dCD8ri/IlwZJqk xs1r7lpSe6HhVsIl+wEueRmf6I7hqAcNBzhkAKAsOz0I29hUZz9l5U7ejNfCf2yEsue7 lJjQ== X-Gm-Message-State: AOJu0Yx8NhPnW8LroOY1mThFhpHuOcU8Almaqnm7dLBEs+IVFx4537DG HGIZwJmMNF8RoeYlG6gbkXDCn71UsiuzHipWHcBVew== X-Received: by 2002:a17:906:3299:b0:9ae:6196:a4d0 with SMTP id 25-20020a170906329900b009ae6196a4d0mr8739793ejw.17.1695737177221; Tue, 26 Sep 2023 07:06:17 -0700 (PDT) MIME-Version: 1.0 References: <20230913152238.905247-1-mszeredi@redhat.com> <20230913152238.905247-3-mszeredi@redhat.com> <20230914-salzig-manifest-f6c3adb1b7b4@brauner> <20230914-lockmittel-verknallen-d1a18d76ba44@brauner> <20230918-grafik-zutreffen-995b321017ae@brauner> <871qeloxj0.fsf@oldenburg.str.redhat.com> In-Reply-To: <871qeloxj0.fsf@oldenburg.str.redhat.com> From: Miklos Szeredi Date: Tue, 26 Sep 2023 16:06:05 +0200 Message-ID: Subject: Re: [RFC PATCH 2/3] add statmnt(2) syscall To: Florian Weimer Cc: Miklos Szeredi , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , Ian Kent , David Howells , Al Viro , Christian Brauner , Amir Goldstein Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 07:06:35 -0700 (PDT) On Tue, 26 Sept 2023 at 15:49, Florian Weimer wrote: > > * Miklos Szeredi: > > > On Mon, Sep 18, 2023 at 3:51=E2=80=AFPM Christian Brauner wrote: > > > >> I really would prefer a properly typed struct and that's what everyone > >> was happy with in the session as well. So I would not like to change t= he > >> main parameters. > > > > I completely agree. Just would like to understand this point: > > > > struct statmnt *statmnt(u64 mntid, u64 mask, unsigned int flags); > > > > What's not properly typed about this interface? > > > > I guess the answer is that it's not a syscall interface, which will > > have an added [void *buf, size_t bufsize], while the buffer sizing is > > done by a simple libc wrapper. > > > > Do you think that's a problem? If so, why? > > Try-and-resize interfaces can be quite bad for data obtained from the > network. In this particular case it's all local information. > If the first call provides the minimum buffer size (like > getgroups, but unlike readlink or the glibc *_r interfaces for NSS), > this could at least allow us to avoid allocating too much. In > userspace, we cannot reduce the size of the heap allocation without > knowing where the pointers are and what they mean. Does it matter if the heap allocation is say 32k instead of 589bytes? The returned strings are not limited in size, but are quite unlikely to be over PATH_MAX. E.g. getdents apparently uses 32k buffers, which is really a tiny amount of heap these days, but more than enough for the purpose. Not sure if this is hard coded into libc or if it's the result of some heuristic based on available memory, but I don't see why similar treatment couldn't be applied to the statmount(2) syscall. > I also don't quite understand the dislike of variable-sized records. > Don't getdents, inotify, Netlink all use them? And I think at least for > Netlink, more stuff is added all the time? What do you mean by variable sized records? Thanks, Miklos