Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1286120rdb; Wed, 20 Sep 2023 05:16:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlVJ8pdGATxhqBBGePFe06XentFudjpCAvixXHNRB6imv3/X8ZJRIjJJ/raA6pzUqu3NKQ X-Received: by 2002:a17:90b:4a0c:b0:269:46d7:f1db with SMTP id kk12-20020a17090b4a0c00b0026946d7f1dbmr2555888pjb.32.1695212192455; Wed, 20 Sep 2023 05:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695212192; cv=none; d=google.com; s=arc-20160816; b=c4fXa3Ly9Vvj4jR7CR+zCVs9HPmKydHD8T1XX82BaA6eUbiin5CTIEUklQG3RMeE3m ERsXF/ERQqMw6Oi6pVLy1SzC7wPhca2qKBeQHwLD0cGWWV9lld6awY2B99ygW7aGMgUq 0nDEs+xKBAzuMJSVnWSLr8FmiZjI9U6ff1wuh5H90QsjtWQtXs9NtEmU8Ir9NJ9A70zk KDHb6lrpolFm90w7rmZFv5/a+Er/OjGGR7ybnHq1xKQwyHO0v1Z0LsR6ePFz2W8xZ85p twEloD2Yu34PcRfGAOKvkfLDk1bpEr2vSwTnyaAUW/yYPXjRLjN3T/DNEw71XLnKxy1d qXsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mCwVe8KpOpCfcH7OtboVsrBBV5wJbNiJa5LJSES+O00=; fh=Qb7xHkRfHqfmCdu9G/nMGf4TidaSTY0tVFBKzgs17Vs=; b=vdT4UuulilCZX2ZnTXG8RXPs06S1wMI/S6Ygsw6Ib4CJ+i6jsfGOQHz42b8/Y1CPO0 jy/aCWI0eqMGBTB7b0/5Dp1Bw2EI4wDX2QaLf9hWrMUXvmlV/xfkitLyVCn8v8kyrzdj WshswwDLSoT5ybEknBVU+Yv+0DG87X4uxuvyn+i/qCAHHggeCaIb2PyClqwIVlLV3QpC aFhMRY3KbMfd6CC9v0lmQ+yg7Hj5NX3MsGxwRuPv9TqfN9sjsii3gtMGj7KfzPEZCnx+ RKOJb4jrDH7GoltsH/8r1JuPTBt0tVSotV6Ak5mfHQIMKkapGHzEXC2c+n4qyKofeq/u h8og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b="p+n/Pj6f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id o8-20020a17090ad24800b00262ffca5a31si1411924pjw.161.2023.09.20.05.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 05:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b="p+n/Pj6f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 4B634802F7C5; Tue, 19 Sep 2023 06:00:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbjISNAP (ORCPT + 99 others); Tue, 19 Sep 2023 09:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbjISNAN (ORCPT ); Tue, 19 Sep 2023 09:00:13 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE99D11A for ; Tue, 19 Sep 2023 06:00:06 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-99c3c8adb27so745890966b.1 for ; Tue, 19 Sep 2023 06:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1695128405; x=1695733205; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mCwVe8KpOpCfcH7OtboVsrBBV5wJbNiJa5LJSES+O00=; b=p+n/Pj6fr8fjEaTIQSufW8KDCkYxN9h54wJ18ZAKBy9HIKLLg5OJ4BRHlknSvJ7blX 7O+tW+VEFciYb2CyqXoCxptMv82IocM3L4HfGjwtMNPJwGff+GPfGmEVcAJkMg6Uml5O 2JpNMQwo6Mb1qDDuyEeet502BBgcWlF98418o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695128405; x=1695733205; h=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=mCwVe8KpOpCfcH7OtboVsrBBV5wJbNiJa5LJSES+O00=; b=L6Om7bFtCvnuRc4MUWnlxXbHi5mjJyta8jAaVRNDkdES2lydksPqi8nL3VWqGg0Ewa h22yA02aziVMgzYstimDpwCNYQt9m7D12Al4Ie4JTYRIYXx0nxv+1UAQ8UqmGDH0iEjv HxF8ThwTVslxBQKVSoX1LCOB4TkE5YqwRZogDrXcHI8InXuqMlUQ7Si+O+OSLbEHplW+ 1e/Gt3NmaFNKVJy5myLo7AhTZ2XITdz9hwOTopmG0wCINnTJ7QuVzVqLmPqdsDeKFRXv rsYsec3pYfTT1kIGUbPCkQH60ooO8LCFQEj3VLTRwoA1BRRMutCnYeth4EcmxnR0k7hW A3QQ== X-Gm-Message-State: AOJu0YwkcctRt0DCT/dCSjCEQS8sPEWE0VOXZUF7ezpybnCxZVK8Y2Sp sybG6MEJCE+ZR8ReMRzhC5C8WKSfNPMdVELshxvmNw== X-Received: by 2002:a17:906:519b:b0:9ad:e298:a5d with SMTP id y27-20020a170906519b00b009ade2980a5dmr10879940ejk.19.1695128405076; Tue, 19 Sep 2023 06:00:05 -0700 (PDT) MIME-Version: 1.0 References: <20230918-hierbei-erhielten-ba5ef74a5b52@brauner> <20230918-stuhl-spannend-9904d4addc93@brauner> <20230918-bestialisch-brutkasten-1fb34abdc33c@brauner> <20230919003800.93141-1-mattlloydhouse@gmail.com> <20230919-abfedern-halfen-c12583ff93ac@brauner> <20230919-hackordnung-asketisch-331907800aa0@brauner> In-Reply-To: <20230919-hackordnung-asketisch-331907800aa0@brauner> From: Miklos Szeredi Date: Tue, 19 Sep 2023 14:59:53 +0200 Message-ID: Subject: Re: [RFC PATCH 2/3] add statmnt(2) syscall To: Christian Brauner Cc: Matthew House , Miklos Szeredi , 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" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 06:00:34 -0700 (PDT) On Tue, 19 Sept 2023 at 14:41, Christian Brauner wrote: > > > > with __u32 size for mnt_root and mnt_point > > > > Unnecessary if the strings are nul terminated. > > All ok by me so far but how does the kernel know the size of the buffer > to copy into? Wouldn't it be better to allow userspace to specify that? > I'm probably just missing something but I better ask. Because size of the buffer is given as the syscall argument. long statmount(u64 mnt_id, u64 mask, struct statmnt __user *buf, size_t bufsize, unsigned int flags); If you are still hung up about this not being properly typed, how about this: struct statmnt { __u64 mask; /* What results were written [uncond] */ __u32 sb_dev_major; /* Device ID */ [...] __u64 fs_type; /* [str] Filesystem type */ __u64 __spare[49]; char __string_buf[]; }; Such variable length structures are used all over the place, this isn't some big invention. The only new thing is that we set pointers to within the tail part of the buffer, to make the interface work for the multiple strings case. Thanks, Miklos