From patchwork Fri Jun 28 00:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715204 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76ECE17F7 for ; Fri, 28 Jun 2024 00:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534391; cv=none; b=paCn8rIeMeFS41qZ7R8etoo6HJZ8dKu1ybE7legYq/dOMfyg1Hhh+d2xg6fLk+CGTJjkCZBTFXD0HCyMb5o95kwVcXAw6BIRRuFX3AI7pDy/5KjZoPQ1oSGzgkZUjJ3kZVLK2xRmPGf0Wsd3Ha/BdvX/KN+lJv5Xh/LzoqV/oFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534391; c=relaxed/simple; bh=hh11G/iodh5iWE0DKtFfqmVHr22By8Ulh9rirP+ZYcQ=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=WANPDu+d1NH8Xm73KKzHuphHGmNYQ/h3v1utjbO/5pOiMGIvYSv8ainwP185LuZNTftZqvx+Fo4FVqlKpOWblERvBQ0Ol1yJO8mWH7325Y865I5uJnl9yFoFO+Z+bVsVAKsVflpD5/TmfCn6juCPOQZkbwQxTAxrKrFFo0Ddc4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MqkCs1vE; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MqkCs1vE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534388; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F920R5yaBE3PsuRdteKVNVN6MSLZBpfM90SMj8g8nmA=; b=MqkCs1vELpBXue/wzqbDkxiCkET4JDzLp+A0PCGAJ/eWIUog8Uv9BByus4U8hcydGZewNn J0U+dE/SeBwB8YUnQs2UAOgOPHDTDc3/imI6cm92A0jYtpmCJb/l+nRiXDPeq84G65oA/c Tcush1T+oKaqiX7WYCwwttQgqlqBzRY= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-DM-LmOfbPWWzDTtNU9l69w-1; Thu, 27 Jun 2024 20:26:27 -0400 X-MC-Unique: DM-LmOfbPWWzDTtNU9l69w-1 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-7e1fe2ba2e1so2903139f.3 for ; Thu, 27 Jun 2024 17:26:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534386; x=1720139186; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F920R5yaBE3PsuRdteKVNVN6MSLZBpfM90SMj8g8nmA=; b=uQPUBP8uV9aTOg7aEiBaz9Xdaqpc42C5xwnDf62rTGPZ8cxavJ16AOf50wLrAoA9Om pqMA81MViaqAz7Wwj+lB1jUkxjXulqpQCcOKTVW38RajCvt0Tdf4bpVdeYJX3MAZwX5D ZjbasnM/Vc02ZCl0j71z1wn2e0CA4zkyUeXiZc5oJQ1LkULUpba9VLJ70SL3pAadz5kW AU8V9OxN1RkJymsT/no9iApkoL23tjElcl/Dfn/I9Armg8C0WPL36JDMlZO4iRYeTUqX XaYXfN80B6Wtq0QOzU0NLaebpGc5Fw/a6OFQq5bnYM1Nel5N1E/ZM6xGOUX8po5yjYAh KA9Q== X-Gm-Message-State: AOJu0YziXVSR3aW19AkyNWSt47+BE2o3sX1TDpKf4ZRfMx4OkqpiXL1S Uf2VUYG1EGC40B6JbUvLJzNCa3h20r3E7SqyHSezS5fKcnPiatI7blUL977VhXJyZZWY68afigJ nUTD9a7qeq+y7CaiCoQs+qmaDqzRq7K2zbalAaf1YMngFzeDNXomcEz4hAR/BM+mBwpe4/PNamj zP3E0uIcGjNo9o5LRHX8d0nTirjGLEWs6G2fQ25orJeD7Wxh9U X-Received: by 2002:a6b:730e:0:b0:7f3:d863:3cf8 with SMTP id ca18e2360f4ac-7f3d8634018mr415332339f.4.1719534385904; Thu, 27 Jun 2024 17:26:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLQ+evTqW23iP2xMhQPr9hw69BKkkeaSh3vRZVLP5nIJpjBkoHrAggDlvkHwnRujUOQkyNmA== X-Received: by 2002:a6b:730e:0:b0:7f3:d863:3cf8 with SMTP id ca18e2360f4ac-7f3d8634018mr415329439f.4.1719534385516; Thu, 27 Jun 2024 17:26:25 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73dd541dsm219330173.55.2024.06.27.17.26.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:26:25 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:26:24 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 01/14] fs_parse: add uid & gid option option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: autofs@vger.kernel.org, "Rafael J. Wysocki" , linux-efi@vger.kernel.org, Namjae Jeon , linux-ext4@vger.kernel.org, Miklos Szeredi , linux-mm@kvack.org, Jan Kara , ntfs3@lists.linux.dev, linux-cifs@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Hans Caniullan References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Multiple filesystems take uid and gid as options, and the code to create the ID from an integer and validate it is standard boilerplate that can be moved into common helper functions, so do that for consistency and less cut&paste. This also helps avoid the buggy pattern noted by Seth Jenkins at https://lore.kernel.org/lkml/CALxfFW4BXhEwxR0Q5LSkg-8Vb4r2MONKCcUCVioehXQKr35eHg@mail.gmail.com/ because uid/gid parsing will fail before any assignment in most filesystems. Signed-off-by: Eric Sandeen --- Documentation/filesystems/mount_api.rst | 9 +++++-- fs/fs_parser.c | 34 +++++++++++++++++++++++++ include/linux/fs_parser.h | 6 ++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Documentation/filesystems/mount_api.rst b/Documentation/filesystems/mount_api.rst index 9aaf6ef75eb5..317934c9e8fc 100644 --- a/Documentation/filesystems/mount_api.rst +++ b/Documentation/filesystems/mount_api.rst @@ -645,6 +645,8 @@ The members are as follows: fs_param_is_blockdev Blockdev path * Needs lookup fs_param_is_path Path * Needs lookup fs_param_is_fd File descriptor result->int_32 + fs_param_is_uid User ID (u32) result->uid + fs_param_is_gid Group ID (u32) result->gid ======================= ======================= ===================== Note that if the value is of fs_param_is_bool type, fs_parse() will try @@ -678,6 +680,8 @@ The members are as follows: fsparam_bdev() fs_param_is_blockdev fsparam_path() fs_param_is_path fsparam_fd() fs_param_is_fd + fsparam_uid() fs_param_is_uid + fsparam_gid() fs_param_is_gid ======================= =============================================== all of which take two arguments, name string and option number - for @@ -784,8 +788,9 @@ process the parameters it is given. option number (which it returns). If successful, and if the parameter type indicates the result is a - boolean, integer or enum type, the value is converted by this function and - the result stored in result->{boolean,int_32,uint_32,uint_64}. + boolean, integer, enum, uid, or gid type, the value is converted by this + function and the result stored in + result->{boolean,int_32,uint_32,uint_64,uid,gid}. If a match isn't initially made, the key is prefixed with "no" and no value is present then an attempt will be made to look up the key with the diff --git a/fs/fs_parser.c b/fs/fs_parser.c index a4d6ca0b8971..24727ec34e5a 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -308,6 +308,40 @@ int fs_param_is_fd(struct p_log *log, const struct fs_parameter_spec *p, } EXPORT_SYMBOL(fs_param_is_fd); +int fs_param_is_uid(struct p_log *log, const struct fs_parameter_spec *p, + struct fs_parameter *param, struct fs_parse_result *result) +{ + kuid_t uid; + + if (fs_param_is_u32(log, p, param, result) != 0) + return fs_param_bad_value(log, param); + + uid = make_kuid(current_user_ns(), result->uint_32); + if (!uid_valid(uid)) + return inval_plog(log, "Invalid uid '%s'", param->string); + + result->uid = uid; + return 0; +} +EXPORT_SYMBOL(fs_param_is_uid); + +int fs_param_is_gid(struct p_log *log, const struct fs_parameter_spec *p, + struct fs_parameter *param, struct fs_parse_result *result) +{ + kgid_t gid; + + if (fs_param_is_u32(log, p, param, result) != 0) + return fs_param_bad_value(log, param); + + gid = make_kgid(current_user_ns(), result->uint_32); + if (!gid_valid(gid)) + return inval_plog(log, "Invalid gid '%s'", param->string); + + result->gid = gid; + return 0; +} +EXPORT_SYMBOL(fs_param_is_gid); + int fs_param_is_blockdev(struct p_log *log, const struct fs_parameter_spec *p, struct fs_parameter *param, struct fs_parse_result *result) { diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h index d3350979115f..6cf713a7e6c6 100644 --- a/include/linux/fs_parser.h +++ b/include/linux/fs_parser.h @@ -28,7 +28,7 @@ typedef int fs_param_type(struct p_log *, */ fs_param_type fs_param_is_bool, fs_param_is_u32, fs_param_is_s32, fs_param_is_u64, fs_param_is_enum, fs_param_is_string, fs_param_is_blob, fs_param_is_blockdev, - fs_param_is_path, fs_param_is_fd; + fs_param_is_path, fs_param_is_fd, fs_param_is_uid, fs_param_is_gid; /* * Specification of the type of value a parameter wants. @@ -57,6 +57,8 @@ struct fs_parse_result { int int_32; /* For spec_s32/spec_enum */ unsigned int uint_32; /* For spec_u32{,_octal,_hex}/spec_enum */ u64 uint_64; /* For spec_u64 */ + kuid_t uid; + kgid_t gid; }; }; @@ -131,6 +133,8 @@ static inline bool fs_validate_description(const char *name, #define fsparam_bdev(NAME, OPT) __fsparam(fs_param_is_blockdev, NAME, OPT, 0, NULL) #define fsparam_path(NAME, OPT) __fsparam(fs_param_is_path, NAME, OPT, 0, NULL) #define fsparam_fd(NAME, OPT) __fsparam(fs_param_is_fd, NAME, OPT, 0, NULL) +#define fsparam_uid(NAME, OPT) __fsparam(fs_param_is_uid, NAME, OPT, 0, NULL) +#define fsparam_gid(NAME, OPT) __fsparam(fs_param_is_gid, NAME, OPT, 0, NULL) /* String parameter that allows empty argument */ #define fsparam_string_empty(NAME, OPT) \ From patchwork Fri Jun 28 00:27:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715211 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09C041860 for ; Fri, 28 Jun 2024 00:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534461; cv=none; b=JrFHuRHlepNuXD4cIhsiNWhLLANuDd5rpAHojV64niShBvU3K5DMGgFdawc+pH6w1qglbhlL0S3QUpFRPsZ8O/IQDcAxhNfO+QOucFwB3m3BbElwspH4Kk9TCQ+vVqJQYGdjT+q52B3wvYBD7fhHdVReao3aTL6sOFF+czwceyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534461; c=relaxed/simple; bh=6cKqtCpH8bqxXYQecoEwGzK0ITdWxgDV+Gl1s1fVe9Y=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=ZJD4SshVLye0ALxXRsLmcYYpWs7TjAkWrnOUyvRmhxNEPOa7lR9E2F8DNGSbAOvulE+x8b0MOtPrg87izRh1+f/0/LgCcnxxJ4HSIzOrcDeQ7zJ2Fu12Np4pjENIi8sBpRBlnmMWRZHSUMDhVss5+fCQox46wURwOa5SLV6JbQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=R46wQbfx; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R46wQbfx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534459; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AAKbKmRLSwctjf83mRn6yEmbgLL+aa60ltLEMmxDMiQ=; b=R46wQbfx2D7NWpMZxwXaxcGjYixxlhEswZo4lejJ3/53deIWQlo5bvPvWDTnVOPJav9541 WesKOFHoSoPrROvZmH+dg6er/lmFde4b0m8yBzwCG3cJhr+noJdg6Rdm7D23sBQWulCJop BREpy3mmHWAu/MzTxpyQTzqjE2dacL8= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-205-4W4jugC1N1C0RpqoJOntVw-1; Thu, 27 Jun 2024 20:27:37 -0400 X-MC-Unique: 4W4jugC1N1C0RpqoJOntVw-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7f3cb65d1bbso7370539f.1 for ; Thu, 27 Jun 2024 17:27:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534456; x=1720139256; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AAKbKmRLSwctjf83mRn6yEmbgLL+aa60ltLEMmxDMiQ=; b=qKZq3ReVhszDFKxB35geJ/tGPlR4g1P+zdMi5Vqq2kcsidSzu4benPqbI4LRxRGg8y U0PraTFVcaluWzIcAeGi7CHzzeif5bTXnZCR1q6Ag6nDynuzkeNzu8UAUbRpmWQEAWDu mfi4BZLChfusMuD5tFEqmqzZ4n0lPIYYg8aVOmS+Yvxu6OwZVdG1Ft2EUrzLayoyqi1z oMEYe79aS6P9VCEqQyvGDJVFKMWZcFhUXW4/87nT9TTLXdMhpLajqIFAeanxWEpit1/C 7HqywkkHZs0ormjNwjEpdUoOKnLjyOMWINRN3grC0mZ5zBbtkfeS0xoaUuetRT+Zr+7y 8/vg== X-Gm-Message-State: AOJu0YxQmivYzaP9GXLCuXWFVb2oyqNlJdi6NWklOcr6x+y/z2Ix3fU+ +UQNpiGZ3KXt68rKdp0Vr+TlN0LDVqmYcXuAR2gNoElJuqJaxswfl3J7WX/0fgZwiqUsW4pJfcw AX5J3HWm9GYbJw+1DIYB7l9Y7wehImzQqMvidYHDBASMA5/TDsolZH8GUNauNKR+Xnwe9f2wAp8 4o3ypIAffbmxDEAHoBRY6hC4ZWzWQxqt1YGp/ZZkWAaNjlww== X-Received: by 2002:a6b:5018:0:b0:7eb:71bb:6f6b with SMTP id ca18e2360f4ac-7f61f4c37b1mr7866539f.3.1719534456588; Thu, 27 Jun 2024 17:27:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEx110DNHxTSreLctRcWiK2JHDrIX02c4cFkG8VQlm/XKUsIS+lOqf2FRUbQYTrkIFM5D53jg== X-Received: by 2002:a6b:5018:0:b0:7eb:71bb:6f6b with SMTP id ca18e2360f4ac-7f61f4c37b1mr7865439f.3.1719534456175; Thu, 27 Jun 2024 17:27:36 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb742f1774sm214540173.160.2024.06.27.17.27.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:27:35 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:27:35 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 02/14] autofs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: autofs@vger.kernel.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen Acked-by: Ian Kent --- fs/autofs/inode.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index 1f5db6863663..cf792d4de4f1 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -126,7 +126,7 @@ enum { const struct fs_parameter_spec autofs_param_specs[] = { fsparam_flag ("direct", Opt_direct), fsparam_fd ("fd", Opt_fd), - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_flag ("ignore", Opt_ignore), fsparam_flag ("indirect", Opt_indirect), fsparam_u32 ("maxproto", Opt_maxproto), @@ -134,7 +134,7 @@ const struct fs_parameter_spec autofs_param_specs[] = { fsparam_flag ("offset", Opt_offset), fsparam_u32 ("pgrp", Opt_pgrp), fsparam_flag ("strictexpire", Opt_strictexpire), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), {} }; @@ -193,8 +193,6 @@ static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param) struct autofs_fs_context *ctx = fc->fs_private; struct autofs_sb_info *sbi = fc->s_fs_info; struct fs_parse_result result; - kuid_t uid; - kgid_t gid; int opt; opt = fs_parse(fc, autofs_param_specs, param, &result); @@ -205,16 +203,10 @@ static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param) case Opt_fd: return autofs_parse_fd(fc, sbi, param, &result); case Opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - return invalfc(fc, "Invalid uid"); - ctx->uid = uid; + ctx->uid = result.uid; break; case Opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - return invalfc(fc, "Invalid gid"); - ctx->gid = gid; + ctx->gid = result.gid; break; case Opt_pgrp: ctx->pgrp = result.uint_32; From patchwork Fri Jun 28 00:29:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715212 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ED4417F7 for ; Fri, 28 Jun 2024 00:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534594; cv=none; b=DyqnsxzoTGU0lPQ8RcMxkh5Qmt66c5uoRZ9UOvIoDYiF7kEmUO3JolTxBG62VNLc2XzgPtQP+w2tHLkVFikwJkaZdlJrvBt87oNTN2Q+VDszOJJ+3WhlP1nskddszNm7OazDK9qFvcqPZ8b1c3mv/f68jUmTH8JM/nZJWiPK8Go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534594; c=relaxed/simple; bh=8VoF2X4B0jZD0zDxyfbRc7nZTqlYgEYQgw983ZWV+2E=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Ub7zACoTcxlLJ5aGoY8nLp2KR4FTpIrGR7e/sh93L4E5u3E4r9hZPTegjhElMTdPmJImy/Ngq3ULi7AjHHaEYglbx8hXNAa5ylm1qJZfuIJt5fSyGszQWenoV8nqtzwglFMd0VE/usEa33vYK951zegRGa9E0ATuep3X7005Y8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jBoki0ob; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jBoki0ob" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534591; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eSv7i0qDIEkS+ppeR43TIf3B4nv0jOxW4hW0qfrZQMI=; b=jBoki0obUk0w764dBjc5XaySLzuJTJVAwOzWfyFvseO2g4ErL372RK6TlFhYcm/NR+ptRu arcSe4sTTOpPdrMC+NDjrWxd0TyhAq15It53Oroj3lAHpn5jvt/UjtX7HJQTm9B/UMsRyv j5jCOBv00O+mS0UQZckiQPT9do3ROis= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-h68YM_YKNIOhQOlIgdqv1Q-1; Thu, 27 Jun 2024 20:29:48 -0400 X-MC-Unique: h68YM_YKNIOhQOlIgdqv1Q-1 Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-375e4d55457so1278225ab.0 for ; Thu, 27 Jun 2024 17:29:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534587; x=1720139387; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eSv7i0qDIEkS+ppeR43TIf3B4nv0jOxW4hW0qfrZQMI=; b=P3dFnM/BHKNfCx9bdhmN1eiD3eE702KEQcbR9agDWxb9A3X0rwFE8bafL2rtdfQR15 qUeG48yqA6NEJWWwE32mm7kbIm0rmJdL9RElHQVkAMeT2gFWrU4w3lcvFhkfziPyqel3 KvxS48XX8HS2tW0lblwgjF7V9F3w0GMMvMlXkLAxaOtZ7mOvfRKwjOwrtP56OaaQo0mI GgS4IAC1id5ku9US4BlzxCyP1GIAnqcRLNEFBko2O+PxsEj0M7W57t9ceDThevH+3nR7 bz1uUERmE7/cowh0ZnNkNCTSu1njwJSIRMd5hMSd+MS4FsxkP3c1DD6ytwCwZ9EzGuRQ 4xdQ== X-Gm-Message-State: AOJu0Yw3/j83ilCiFuWT3ZYc0IjwaPsmwreDp33Sc5oqNEp6ISfB9CUT rCbLsnCPIAc1c3VGxEZ5RQjaNs/dlhZL0avob6X5j8EwFNc4CpWM8WnC+cpxgaijPRJXpynkzMf RnVHw15xzyD8Lbn/wkOwZPRS7Zg6PySDAr4cM7jnqE3iOtZHR+7FtX3Vz1dz/RVYAswnPzH5ZVX +xmzcAapcklbkJ5zpC9mSswOrc7+PZfNJf/Nl8Yfv6clTvPg== X-Received: by 2002:a05:6e02:1d01:b0:375:9e3f:5f6 with SMTP id e9e14a558f8ab-3763f5a3e26mr190746685ab.6.1719534587278; Thu, 27 Jun 2024 17:29:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGyhFrtW+EJajjBfiX272bZcWNrR62s3O/d/YHQ+hO8rjrB/feEFoBk5FjDgW4A4xT01w6rw== X-Received: by 2002:a05:6e02:1d01:b0:375:9e3f:5f6 with SMTP id e9e14a558f8ab-3763f5a3e26mr190746555ab.6.1719534586928; Thu, 27 Jun 2024 17:29:46 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-37ad483bfe1sm1692835ab.80.2024.06.27.17.29.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:29:46 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:29:46 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 03/14] debugfs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: "Rafael J. Wysocki" References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/debugfs/inode.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 8fd928899a59..91521576f500 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -92,9 +92,9 @@ enum { }; static const struct fs_parameter_spec debugfs_param_specs[] = { - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_u32oct ("mode", Opt_mode), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), {} }; @@ -102,8 +102,6 @@ static int debugfs_parse_param(struct fs_context *fc, struct fs_parameter *param { struct debugfs_fs_info *opts = fc->s_fs_info; struct fs_parse_result result; - kuid_t uid; - kgid_t gid; int opt; opt = fs_parse(fc, debugfs_param_specs, param, &result); @@ -120,16 +118,10 @@ static int debugfs_parse_param(struct fs_context *fc, struct fs_parameter *param switch (opt) { case Opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - return invalf(fc, "Unknown uid"); - opts->uid = uid; + opts->uid = result.uid; break; case Opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - return invalf(fc, "Unknown gid"); - opts->gid = gid; + opts->gid = result.gid; break; case Opt_mode: opts->mode = result.uint_32 & S_IALLUGO; From patchwork Fri Jun 28 00:30:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715213 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CD781860 for ; Fri, 28 Jun 2024 00:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534662; cv=none; b=l/G6OigvQqe+A32vEC9FRFlOiuA2rqGC+7Wp9ImwCCS0i8jB5eajw190rwH8pMvgkAnFVJZ7rtzsK2S9TfYwrULDDjvp/eGahrSn+RThaw81ZGu7XJHc4LsSN1+edJ+Y4MmzXsbPjS7lSEDOcDa72Px1NKjYGJRscrBqwkR6++8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534662; c=relaxed/simple; bh=mGi3br9UC13i+sut16sB/CwEKVX820m4gMw5RVfumsA=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=f8KwXKbTGrnCU/fBZykRRSUXZNFYU14UWrko9n6C79vfadkselfc18QbtvFr6pOD9A5AHMrHj/r8ntqr6WRgxobSjrbvoRJltA71Id+09/NhXZkiSSYoyuNZ1J1Ba1RWPVhbZlWtmLmHcl3hA0I/JVvWaj9EK1QejsFzNQCivKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MzpnJNF6; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MzpnJNF6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534660; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UD0TZhFgnFh0fbg8+VW4LR/vmzomGaI+4ExHpGhlqJs=; b=MzpnJNF6LBSsyjnN9/kFhh7EnIb3ScdZhxRe+gMbYFZnHxtw9u6oNCLDCj1WRxU7xXnGN7 vG2GtdXTZRv0Px8oj1n/IlpenatL8PVJ3t3/mLDFKOnNrO2hsf/Cvxl+HEmTAT6RB6ma52 IxufPsjQN2G1Z8v5TrH+OwYeE+/SSEM= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-plSMTt70OrGFh0hBUXMhgQ-1; Thu, 27 Jun 2024 20:30:58 -0400 X-MC-Unique: plSMTt70OrGFh0hBUXMhgQ-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f61da4d7beso3590139f.2 for ; Thu, 27 Jun 2024 17:30:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534658; x=1720139458; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UD0TZhFgnFh0fbg8+VW4LR/vmzomGaI+4ExHpGhlqJs=; b=dHyUaM0Ho6jXEb6zNQl8rEclJZJF+T4MfqR3+PLxI87rSow7X/xU2zdcg/KTXgBJC/ q6KcqTO8Xk0jb+s7WbSb+Pgz9GJCzeZYoLGeaDB8RaibMkfcLcv9V/uYLA1Z+1Xj/kiq DMO7/IUI+Op6G9612t0/BpC1oT+qlkqD65NItCm0z8rMfIHitgkf/ZNyYCc9/YmKgoBP hMjuvlMIHv4+hE6W+TeRwy2afR7d+VxmDs/CtlwoJ24JPWPh39R/q5egurvTIQ/JJz0k kqrcGhNgOaykB0pjmhbWL/2YXbeTBzp2tp02tULKnjTACDTDppqxnBUce/xeM5PsAWeJ mV2A== X-Gm-Message-State: AOJu0Yzc7NTn1peX6oTHJQaFqI8qjxlDjuYkffxHNkEy+5LeE22flA9e kl26CyighPw5wzOmoixHFlcNLdYqM8jb907JgCFDuryGEf9lqmxh+kuf/cjNTi2Frl4gdvpoqKA 1OBSf5FVZzrhvF+ysLA0qQljdm7xVyZQEyVDaYaZY6rrzsQCQZXj8MRa4vVcUf1KPiFu5G9tfHo OoggM3fm3L5P6gWnIncKcdmI3bwLAtdzVbpVVS3uvSDNOgZA== X-Received: by 2002:a05:6602:8d:b0:7f6:1b3a:437b with SMTP id ca18e2360f4ac-7f61b3a44c2mr187735739f.17.1719534658085; Thu, 27 Jun 2024 17:30:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOsACJkE3UNbEuQpyjaC1nCYuaIr4BQ65r5H24LLaLew3xs2nJd5TV2I9cKqMq7cM4hfew/A== X-Received: by 2002:a05:6602:8d:b0:7f6:1b3a:437b with SMTP id ca18e2360f4ac-7f61b3a44c2mr187733639f.17.1719534657514; Thu, 27 Jun 2024 17:30:57 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb742b8c81sm221640173.134.2024.06.27.17.30.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:30:57 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:30:56 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 04/14] efivarfs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-efi@vger.kernel.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/efivarfs/super.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index bb14462f6d99..a929f1b613be 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -275,8 +275,8 @@ enum { }; static const struct fs_parameter_spec efivarfs_parameters[] = { - fsparam_u32("uid", Opt_uid), - fsparam_u32("gid", Opt_gid), + fsparam_uid("uid", Opt_uid), + fsparam_gid("gid", Opt_gid), {}, }; @@ -293,14 +293,10 @@ static int efivarfs_parse_param(struct fs_context *fc, struct fs_parameter *para switch (opt) { case Opt_uid: - opts->uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(opts->uid)) - return -EINVAL; + opts->uid = result.uid; break; case Opt_gid: - opts->gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(opts->gid)) - return -EINVAL; + opts->gid = result.gid; break; default: return -EINVAL; From patchwork Fri Jun 28 00:31:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715244 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC3E66AAD for ; Fri, 28 Jun 2024 00:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534717; cv=none; b=thx4ELfCVaGYq+XjfN0jUdFN6NigzkpUNnHp1EhPWAzP6nsgiGRlA/1u/RfzYwIhsIaKPRN0+5S1l56m5S4rfX67TgFPl76wfN8hQaNgpfNymBBxPgOkTyB2rpHdAAmCQ8CR0K4Y+xujjBPUNBZOysr9Q6SBPzU4TvjTLV/B6MU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534717; c=relaxed/simple; bh=HBxVszKikaJWx1gETB5mDKxXYp8rY5DqnfBXy54fyCk=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=JkPSlvW1Gxxj+p2DVIp+h1Bi7mPaCFTgGV18fXYtE88UZZwi7Xlln+VT9Iz0Yj6UkcUfipFAqjmeO4W53RLi73OLBxypfJ5K+uCbwpa30hWXLX0o5lmzVRf/3Txskx3SPbBE+thVUNm416Q6goF12B1/qMqlTQki/IPu2vaeVls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iSGKCtwM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iSGKCtwM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534714; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PiPuGUz7hisfeWM28u5JCiXWCiZ4+FNesuTv/XbbajI=; b=iSGKCtwMJAV7dc0a/1v6VGdhru66W+0RBlBtqgNDKk+XdLVVQZA43AI9K1P7VU9fkKBJrd MBIAUNFGf3Jj1nCW3XGNLfmRXQB/5yetISsvfEeeI/pWdIPeTXa4w5clDaJIgTqDQfYGu+ GlBwYplJj04nvXUcoDCVzxVbHmI3gB0= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-auPlAmFfN42VoFXMAqciXQ-1; Thu, 27 Jun 2024 20:31:53 -0400 X-MC-Unique: auPlAmFfN42VoFXMAqciXQ-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f61fca8c40so3321739f.3 for ; Thu, 27 Jun 2024 17:31:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534712; x=1720139512; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PiPuGUz7hisfeWM28u5JCiXWCiZ4+FNesuTv/XbbajI=; b=wEioNEuDfFOzGYdBVe8iCGrI69xXL3kc4z0KhrxBa7UC15qqb4IuRx6v4KtHVRfNU1 v2Hy/RdKZaXTc8FGFJxobo8jv3TYb/dIf5HP5vZFoR494j7pvewgpMiAj+sgyQYgykuX KJPwB85OYCS2wOFPCw4reQnK7ZliVApWpXadztN+48kNWYoVX3DCl5JPCmG2KSJj1Q1w 9mpiUzMAu3Lvd+tg5k4IhEYBSWqZbnP6HkEwUG/9oAfMWZZf5TiRyDJlC/N61t8UQqbn E0CDsx9WPi1pApLu+HJYTmY0wKQMTIPOpKBL4+Hs8tt7xZNJS0QMc+laTUp41/M9p1nU osOA== X-Gm-Message-State: AOJu0YwGoRRwiDLKChUX97MuOqgvJNBjG2m+rcWD1chRm60wu9rRt5hx 2/33IF2oaGN6dftYQ7YasJUOjbqv3rtmMAoQr++H3krmsNVZqIKZFG31fNjgBQd4yJVJfZnDAyR MZdRZjrV1vEoeTDGRGKN7243OxccER33evRMuapmvBHRhkD2+y1a1u5cHfEmiNyNs8IGOoeQf2Y jsR44YNb3hgpwFhK4n6Xkn4lD8xINXWHv6ItZjw/veWS+43g== X-Received: by 2002:a05:6602:1696:b0:7f6:200a:ba8c with SMTP id ca18e2360f4ac-7f6200abb9dmr1372339f.1.1719534712436; Thu, 27 Jun 2024 17:31:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGC2XOb/lNC60hMurxkgKTx4JZiZLcoMlaWGCoAMiFiM5OAIWa8XH0AMUHgZnGSJPesh964Tg== X-Received: by 2002:a05:6602:1696:b0:7f6:200a:ba8c with SMTP id ca18e2360f4ac-7f6200abb9dmr1370539f.1.1719534712072; Thu, 27 Jun 2024 17:31:52 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73e05e31sm223150173.73.2024.06.27.17.31.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:31:51 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:31:51 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 05/14] exfat: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: Namjae Jeon References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/exfat/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/exfat/super.c b/fs/exfat/super.c index 3d5ea2cfad66..a3c7173ef693 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -225,8 +225,8 @@ static const struct constant_table exfat_param_enums[] = { }; static const struct fs_parameter_spec exfat_parameters[] = { - fsparam_u32("uid", Opt_uid), - fsparam_u32("gid", Opt_gid), + fsparam_uid("uid", Opt_uid), + fsparam_gid("gid", Opt_gid), fsparam_u32oct("umask", Opt_umask), fsparam_u32oct("dmask", Opt_dmask), fsparam_u32oct("fmask", Opt_fmask), @@ -262,10 +262,10 @@ static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param) switch (opt) { case Opt_uid: - opts->fs_uid = make_kuid(current_user_ns(), result.uint_32); + opts->fs_uid = result.uid; break; case Opt_gid: - opts->fs_gid = make_kgid(current_user_ns(), result.uint_32); + opts->fs_gid = result.gid; break; case Opt_umask: opts->fs_fmask = result.uint_32; From patchwork Fri Jun 28 00:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715245 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CA13566A for ; Fri, 28 Jun 2024 00:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534772; cv=none; b=HujCTWi9Zc3T59lEDuRaFEKJWeXQMpTNrcg13ySfo+U83IVUl/P0JPQrIc74gxsNxGS3SEEZy1O2KsL819UQc1YlQEevalXjCD0R8sZIxIuB+ulDBiRVSrVBpm3Ly9XFarqXvbVia4icbPaIBWNGWuQfYYS1GBadj8DuWIciAzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534772; c=relaxed/simple; bh=Ulp3S5stzv++vXxGMYfQ+BcivZiIAYPslw4rKUn4U8w=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=CqjASS6pi5ebarpfl3169StcjlkCuYSRctFnWtpwcH1bExb6bNQLSSuqON7gDdLk1ac/QKxTCc0Zn7gH9NQNCgZuZqIYDQd4ghkaLKWK1/spHoCX/HZxus2y2dtLKkJTNlcKZoKgvpt+9sZeKDROmgFv9zty/UvoLfdywjDZe1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dkHtSo4o; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dkHtSo4o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534770; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gF9nFCuf0kckhaKB+8V6fEgppLRhdmw1EGPzkGHiXpY=; b=dkHtSo4oKodpqUSityXVrCfxYgBG4EUxfqxTN0/zvhXK9UcLwl4+RFHBMobZs6h+dR+D0d EY6ZaorPNqskJcuD3dX4D5FFgYAVTesJJGPqJlYS530nI7B8276dKKWVqzdiGN5x8kSFL4 IQ6BR7LBRnUcSjNdAT1KNkVCUP2euUM= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-q4T9X-4YNZ6r_eJlsxwXOg-1; Thu, 27 Jun 2024 20:32:48 -0400 X-MC-Unique: q4T9X-4YNZ6r_eJlsxwXOg-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f61f4c998bso5305239f.1 for ; Thu, 27 Jun 2024 17:32:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534767; x=1720139567; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gF9nFCuf0kckhaKB+8V6fEgppLRhdmw1EGPzkGHiXpY=; b=RgJ2uOkfcibM5upw3+DsgslgtpnYNt741f6PthKZi5bTl8DWLEJB6yZrEUOtctXfSQ FpBEq4NtSIqggVimQ6bK8tVZe/9XJMM5OHf47l6JOROW4mAYYEmzxFDBhra4hJRCctgr 2mjnqiZ24ZeHvCPso8evuy7juaU8/4giTeCPByrDlYZKiBFw2W9D/f6M68vtjeX++v56 jB5BTWoySJj9VS7DBb2C5pFRogdnyVlExxeVhKh073ViqxLiWpDwVOat24jEAD03GhhF nSa2kBXsMHpH+0tosQTgag7P2tb9MgCWtToDUyMRl/hpWcurq6+NhcNdRmIYS/vOc65c 0kJg== X-Gm-Message-State: AOJu0YymnsCD/qpZdEjHkfEfQHeEGvJ1EugWVV/6xEQazwXYvK69bLbC KhOogLlLruL1pGrq5TegqVZWAYTewjfpb6gQHznEUj/nQPIX5PULLGAZ/BtlekAQm5C/ImbPvYY itxvAcJmNv49/K5ja8VNi526vSolZIaRWaSNzI2NGLRtMyKQqKPWqOCaDTdwdea8oqwlH8CZSjB 73R93o9D8RzaZM+SRDFC3ujDtYByxzEwtk1er/ozeaRN3MaA== X-Received: by 2002:a05:6602:6b83:b0:7eb:89ba:44fe with SMTP id ca18e2360f4ac-7f3a4e5fd59mr1779260139f.17.1719534767023; Thu, 27 Jun 2024 17:32:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrEmB0ut+X5uwyOZY4YQ5np2u4zYFSu0O6OK+ZudOrt68gsCAqACfpyF4yngPu0Wnsr8jW3A== X-Received: by 2002:a05:6602:6b83:b0:7eb:89ba:44fe with SMTP id ca18e2360f4ac-7f3a4e5fd59mr1779257939f.17.1719534766490; Thu, 27 Jun 2024 17:32:46 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb742f1f6bsm217940173.178.2024.06.27.17.32.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:32:46 -0700 (PDT) Message-ID: Date: Thu, 27 Jun 2024 19:32:45 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 06/14] ext4: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-ext4@vger.kernel.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/ext4/super.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c682fb927b64..0c614df3225d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1721,8 +1721,8 @@ static const struct fs_parameter_spec ext4_param_specs[] = { fsparam_flag ("bsdgroups", Opt_grpid), fsparam_flag ("nogrpid", Opt_nogrpid), fsparam_flag ("sysvgroups", Opt_nogrpid), - fsparam_u32 ("resgid", Opt_resgid), - fsparam_u32 ("resuid", Opt_resuid), + fsparam_gid ("resgid", Opt_resgid), + fsparam_uid ("resuid", Opt_resuid), fsparam_u32 ("sb", Opt_sb), fsparam_enum ("errors", Opt_errors, ext4_param_errors), fsparam_flag ("nouid32", Opt_nouid32), @@ -2127,8 +2127,6 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; const struct mount_opts *m; int is_remount; - kuid_t uid; - kgid_t gid; int token; token = fs_parse(fc, ext4_param_specs, param, &result); @@ -2270,23 +2268,11 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) ctx->spec |= EXT4_SPEC_s_stripe; return 0; case Opt_resuid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) { - ext4_msg(NULL, KERN_ERR, "Invalid uid value %d", - result.uint_32); - return -EINVAL; - } - ctx->s_resuid = uid; + ctx->s_resuid = result.uid; ctx->spec |= EXT4_SPEC_s_resuid; return 0; case Opt_resgid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) { - ext4_msg(NULL, KERN_ERR, "Invalid gid value %d", - result.uint_32); - return -EINVAL; - } - ctx->s_resgid = gid; + ctx->s_resgid = result.gid; ctx->spec |= EXT4_SPEC_s_resgid; return 0; case Opt_journal_dev: From patchwork Fri Jun 28 00:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715246 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79ADE14F98 for ; Fri, 28 Jun 2024 00:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534829; cv=none; b=ZAITCYxm5jSiiikevs8+RD0QNrqZmJu72EVz2DpOkzu5ajm4+ZUPcgkHOMANPNAjJkYzY91J+JGNhuScMQt50r3MGtVW9SLZoumFyA4nXDVGE9GlKyB23sdLjAvJ2V3nglax25gx2khcdXjkhmlWtHzREXH7R4TyaaCF/SQiSN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534829; c=relaxed/simple; bh=YBjNBL3ZI8XMLnFFvkCOP/3a8J9ZpUn9wm5WCknMTf0=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=hlduWmF0UxnO2aprERl+x2oGWORSbrFOQT7X+i2XCEQ39q/pCnG/FGoyjswh7+XyeVDt1erQs4Ncugze+GK1MpoUL3pycvq3tCs1P/UbKASbQTX3MSRTlzAyQ34jFnIQjxH3KnD7cvNX4sne1q2wY+3bcRhokdn0queYZovpxHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=P/qj0Mfm; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P/qj0Mfm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534827; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QibGL+vvqq0wMB+UsoGLlCZB/mxqsrmjQq0cSORajaA=; b=P/qj0MfmcWW/W4jy4oTLWB+H01Rxs2/jEwuh7puxxCCVOIyG7clPljhBvgGg5d0DRUby72 xDaysxHsmgaed/Sg+7QxHIJyKyblBUQ5VlIcE4IFKX9pVqmkzhEXG4uh3jkxdFCtsytf39 3dugThRpStl1LmAwE3pipKFT0CFuV7s= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-G8__aMNcPNqUfuhMsC_JHQ-1; Thu, 27 Jun 2024 20:33:45 -0400 X-MC-Unique: G8__aMNcPNqUfuhMsC_JHQ-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7eb84511dbfso3533639f.3 for ; Thu, 27 Jun 2024 17:33:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534824; x=1720139624; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QibGL+vvqq0wMB+UsoGLlCZB/mxqsrmjQq0cSORajaA=; b=q/lmeUTI3fcxqf7Q6LJ//4TOvzY9gxoAh3Ye6QNjDeY34oenjpaCaEqkYVk1PBLFFk wgldmWtI4rVaVpWb1YcjiCpA7E696uNWFOhVWHJ+843VQWqApCVK9n8ylFeHhTpi0d9S q99PiBLcwMKI4HsVZAWdZepG35GQ1c36TYeL2lMGFyfGJzSViGD02Wc3Y8rIUAMjgnCv sgWHXTnMAmWvS8BY4HFYUTnwGByqq+eY6bIVR2ip8RcxoaE2ooSNBoInAooPlJ0RA2nV SxiV4W7O+nkSOEPOF7k3GhdKr7jZOjqTNIf8wxxCdopHmNAkM1YM0HIgVwiiBySzZ9f9 vdWA== X-Gm-Message-State: AOJu0YyZUwBiiytkgjc7CqQE55y05sl7ug6qW8boTLuScOr//JY40sCx Gg3nWaGX/J2dCNWnPq1/Iy5ixe2KI+wk3qJK9eHrMSnlsHK0G3cDDLAZruYvNSupr/1FU4gs88P +DodFVSDfck5fDbUAY+wcghhF65RUSPu7u6Z+1oVDJr+VRWUZL65oNLt3VVdRi5Iey3LCNHz0jE duhYWuwBPJzoaJBUebBGKRD/CfTkS/oZhdFoPro5BFn9CkqQ== X-Received: by 2002:a05:6602:1582:b0:7eb:7f2e:5b3a with SMTP id ca18e2360f4ac-7f3a4db2390mr2023996839f.2.1719534824638; Thu, 27 Jun 2024 17:33:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLHLOhGCcweETa4ASZ5p1k/qKBA7dRKalfxzAvHnS4heo8nXLZlDbu1Bkj+2v7ghwA12KzhQ== X-Received: by 2002:a05:6602:1582:b0:7eb:7f2e:5b3a with SMTP id ca18e2360f4ac-7f3a4db2390mr2023994139f.2.1719534824285; Thu, 27 Jun 2024 17:33:44 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73dd541dsm222305173.55.2024.06.27.17.33.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:33:44 -0700 (PDT) Message-ID: <02670c04-2449-443f-bf44-68c927685a1c@redhat.com> Date: Thu, 27 Jun 2024 19:33:43 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 07/14] fuse: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: Miklos Greczi References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/fuse/inode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 99e44ea7d875..1ac528bcdb3c 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -740,8 +740,8 @@ static const struct fs_parameter_spec fuse_fs_parameters[] = { fsparam_string ("source", OPT_SOURCE), fsparam_u32 ("fd", OPT_FD), fsparam_u32oct ("rootmode", OPT_ROOTMODE), - fsparam_u32 ("user_id", OPT_USER_ID), - fsparam_u32 ("group_id", OPT_GROUP_ID), + fsparam_uid ("user_id", OPT_USER_ID), + fsparam_gid ("group_id", OPT_GROUP_ID), fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS), fsparam_flag ("allow_other", OPT_ALLOW_OTHER), fsparam_u32 ("max_read", OPT_MAX_READ), @@ -799,16 +799,12 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param) break; case OPT_USER_ID: - ctx->user_id = make_kuid(fsc->user_ns, result.uint_32); - if (!uid_valid(ctx->user_id)) - return invalfc(fsc, "Invalid user_id"); + ctx->user_id = result.uid; ctx->user_id_present = true; break; case OPT_GROUP_ID: - ctx->group_id = make_kgid(fsc->user_ns, result.uint_32); - if (!gid_valid(ctx->group_id)) - return invalfc(fsc, "Invalid group_id"); + ctx->group_id = result.gid; ctx->group_id_present = true; break; From patchwork Fri Jun 28 00:35:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715247 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BDC0D304 for ; Fri, 28 Jun 2024 00:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534918; cv=none; b=n3sy/QwXjoM45jPqt/5O60ZwX7YAZrOrCE6XIzAK/HMFhQE4k3oPyYVAPi8P2ZrYiWFw5XTJu/ZIe5MOIvUrJbMwfDS0m/2u9A5zK6ltEHkTZUVmc+c+Gh5W2sZGjoijo2y4o8/8bW3TUZTvHDLgBfBl9xIfSWr8WQHf2Ex5Rgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719534918; c=relaxed/simple; bh=FpPiL/t10HZ8MzrR9SxKHIyYJGbHROTOe5kCW+T8G68=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Ism+C1ZxRhiOCwaEAnE5CF6dlhPIcd120LCXfo/veIHFfxxbvIUGLM1ErvW/DID7XZK50C/KuOxXI3rFucQO4WBqh8/DqN93uaAfnXhlcGvWcir5gFdWOt/modpSlOg65E7udy4tveCxc59cG/IiwCKaMSl+agz2CjqRUyy909U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AQJNWdiD; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AQJNWdiD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719534916; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/uXKmUT/nwyBhbjHXhbeGwv5exw7uxZHD87X7TVS31A=; b=AQJNWdiDupx+0nEFdDyuzPWc+lJUIQTOoiUYT3ei5blhm5/82EcoDl9xbagD3KU0oLkV7W 5n8RBAl4lFZ3MvFm2429mYh5tLhf3Ma7rEaj+4zPwiXfGlJxlLATykwO/0/eDjH2bSgxom /5fDf0DrfztIzQtGc4qSFztzcF18IyQ= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-oZUq6DoyO1qX_TKRARXCxA-1; Thu, 27 Jun 2024 20:35:14 -0400 X-MC-Unique: oZUq6DoyO1qX_TKRARXCxA-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7e1fe2ba2e1so3620839f.3 for ; Thu, 27 Jun 2024 17:35:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534914; x=1720139714; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/uXKmUT/nwyBhbjHXhbeGwv5exw7uxZHD87X7TVS31A=; b=hG0ie8TfHwNGse4YQ1IyqJzPM1IBT3d0GxsaNSwuFbP2ZjdXiauv5KqmxXebQpVwkC r6S+eZbOXX5UNA2ypjyzniLFGDLOtmiyrJw5s00JFzCI/gBRFbCAYWCxVKmXnlDOVcZ1 /Xqc2KyAupQ4kcPM0VY1psjao7n+p4zMJiIV+aotvmwk/5TGfuu19759FcPOHq3+2MGR xAZNQhtaDR8KredwvMlmZ9+T0xONGaXm0QhcyBEq8WKbKkpix30BhgnjEuGXFELqP6Qu gqkrevMuQI7agWJc995keuk5RZIjGgUZcc2ngsRzsWYUVTeOx6O84/czFpL5WMRyfupD /PIA== X-Gm-Message-State: AOJu0YwFwqYT2FL/9EzDHruX1yTCqBEeDcry0Fu6MNQLfsTl7LnZZROj 0+Xaxyutt8okHIOAbePltn4e9w6dwbG/CgkTi4VWiQSn5tt5aThPhv3D9ikafT4l3zHxxuPRxcE vVfVjfuo6AhBHB3JJA+vWt2gxwVFx5NENbe/i+SofksHrKwcs95oO54UI0mog7PKaoWat+070Se M09g0MkXM+/qw7j1HVbkOP7sWPZyvPiCUCMed1OItPd/7Zxw== X-Received: by 2002:a05:6602:2cd5:b0:7f3:d2d5:f06a with SMTP id ca18e2360f4ac-7f3d2d5f2acmr847380039f.13.1719534913952; Thu, 27 Jun 2024 17:35:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5bkzdQWyhKslA1Bbi7lsK+W3KJetd3xDc9zpQWMVm09ROQZ7lBfg0thxSlPP3X/rVq2ScLQ== X-Received: by 2002:a05:6602:2cd5:b0:7f3:d2d5:f06a with SMTP id ca18e2360f4ac-7f3d2d5f2acmr847378239f.13.1719534913643; Thu, 27 Jun 2024 17:35:13 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73dd71easm224905173.62.2024.06.27.17.35.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:35:13 -0700 (PDT) Message-ID: <6cb0dcfd-f837-463f-b5ec-0e7d2608b837@redhat.com> Date: Thu, 27 Jun 2024 19:35:12 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 08/14] hugetlbfs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-mm@kvack.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/hugetlbfs/inode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 412f295acebe..81dab95f67ed 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -73,13 +73,13 @@ enum hugetlb_param { }; static const struct fs_parameter_spec hugetlb_fs_parameters[] = { - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_string("min_size", Opt_min_size), fsparam_u32oct("mode", Opt_mode), fsparam_string("nr_inodes", Opt_nr_inodes), fsparam_string("pagesize", Opt_pagesize), fsparam_string("size", Opt_size), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), {} }; @@ -1376,15 +1376,11 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par switch (opt) { case Opt_uid: - ctx->uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(ctx->uid)) - goto bad_val; + ctx->uid = result.uid; return 0; case Opt_gid: - ctx->gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(ctx->gid)) - goto bad_val; + ctx->gid = result.gid; return 0; case Opt_mode: From patchwork Fri Jun 28 00:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715248 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFC301BF50 for ; Fri, 28 Jun 2024 00:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535012; cv=none; b=Zq6/xVbS0T5XHe091jZL39lOhaLgWIjfRBb8a2R6ZU4Qvmf7UxX3bh1BnrB9RywBwaOInNbj1n+SOtaETI2Rgsv3Md7QUprc/lHZPFInszLB1jsx9UdC/BZA2bY9q+hKrYnd+byuBE0TX6T3c2W4wmmPWGI+i5H5Hf4qA2oez9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535012; c=relaxed/simple; bh=sQQl/VZkA4HWR9CyQ6uX05OLO58/QyhZXouv4KpZh38=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=KnErbXCzhSkTMhsn1MPpOjl+PLt5JGGChP7c2oJ1IfCvuwAKjC2T9YvQTn19cPvgj6x09+KgTI7ao/wwTmr9/lLH++QCg/1R8btcT9l95apJS5wpjpmEk9/8KxGvoAARATAXkzsn7MhalSbdTM1hzSJjLMyLHwd/FmAh/NlOi3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fQ1OdOsS; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fQ1OdOsS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535009; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/8HMgmWto9s6viH/+SjxOue/JAoKhgQHCg5Kd6Ay2i0=; b=fQ1OdOsScDGr4gDWv5qfdFwD3mm/HuUazVhx7WtMXbeMK+aIBV8iD+QlN0R8jwDaBYxkKz 9oBqGBlgK5d7jeAj0Wbq/4AlzLGLWvAqsmwaEtURC/BhiUBFVD2qOO1zbOk2Gzb3gU0h9t aPcylqPLjXLXu6mXH16SNQV8Kn0uStQ= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-cJFWtg6lPSC-rWue3Z8REg-1; Thu, 27 Jun 2024 20:36:16 -0400 X-MC-Unique: cJFWtg6lPSC-rWue3Z8REg-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7f61da2de1eso5072439f.1 for ; Thu, 27 Jun 2024 17:36:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719534975; x=1720139775; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/8HMgmWto9s6viH/+SjxOue/JAoKhgQHCg5Kd6Ay2i0=; b=apXdFt8m+Cwy7gJ45uo9voIji5aYrTNHg48KgVGPeQFYxjoS+p1C4kdSBPiSTGXQnC /SQq1CMEPEdPy0tSPDQZ7NsrM1eiP2oEyPZs5hb14USdDeR5IKcyVPfq6MsKZ7jOLuV2 SvzRBrPpFvORQNd99ThSVPW2yLGTt/qYwESFaTuLsyvw7OdA7KCLP4ZCaXWuQTBEkBpL yUXTNWyU6QFeh4xv0E6zlUtbLhcmwqmZfazpTTCFMHl13mxNN6oMO4w+99Y5jTCyE04N OCIrN2vlC9sHpu2u/Pnb7qU8BZAtwICPGpDkxKGtczi1SZhp/+QNSIVer4P6F9pd1H/t vEQA== X-Gm-Message-State: AOJu0YwLQ25nE18/LFlJ0oeTnHxA7Vg4cWmEaAZ7qpCfrHEtAOb/Lrmi SJCalbJSpFpbGwJi2Pq8jZCdemxAtuwgAS0iHDhS7+inDY5kWJLmlsFwlpUJD8Q5ZxqlfC6DtOo wSGeMhydO2dqEUeQOfo896fm8YS3fyT5d5PLcPzkLUF1XZrKBj78oJ+Wf5Wa/Kl4ABiHL96Lx7j DKpzQGS9dR5L0ClfsG9r8jBu1U62UOXjNQmrz+5OUVTTbJQA== X-Received: by 2002:a6b:6513:0:b0:7f6:1d7e:a9c9 with SMTP id ca18e2360f4ac-7f61d7eac73mr98537539f.6.1719534975467; Thu, 27 Jun 2024 17:36:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVmrxmGHTN77xyBvsNCRip9PfxH3HGoiT5m4TtdeHqRU1DrdFs66Ypzp6P4cDe7Un7vKV9sA== X-Received: by 2002:a6b:6513:0:b0:7f6:1d7e:a9c9 with SMTP id ca18e2360f4ac-7f61d7eac73mr98536339f.6.1719534975027; Thu, 27 Jun 2024 17:36:15 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-7f61ce9d928sm18531739f.15.2024.06.27.17.36.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:36:14 -0700 (PDT) Message-ID: <3e57caa1-33e0-4456-8e07-60922439e479@redhat.com> Date: Thu, 27 Jun 2024 19:36:14 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 09/14] isofs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: Alejandra Bujniewicz References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/isofs/inode.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 93b1077a380a..ed548efdd9bb 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -326,8 +326,8 @@ static const struct fs_parameter_spec isofs_param_spec[] = { fsparam_u32 ("session", Opt_session), fsparam_u32 ("sbsector", Opt_sb), fsparam_enum ("check", Opt_check, isofs_param_check), - fsparam_u32 ("uid", Opt_uid), - fsparam_u32 ("gid", Opt_gid), + fsparam_uid ("uid", Opt_uid), + fsparam_gid ("gid", Opt_gid), /* Note: mode/dmode historically accepted %u not strictly %o */ fsparam_u32 ("mode", Opt_mode), fsparam_u32 ("dmode", Opt_dmode), @@ -344,8 +344,6 @@ static int isofs_parse_param(struct fs_context *fc, struct isofs_options *popt = fc->fs_private; struct fs_parse_result result; int opt; - kuid_t uid; - kgid_t gid; unsigned int n; /* There are no remountable options */ @@ -409,17 +407,11 @@ static int isofs_parse_param(struct fs_context *fc, case Opt_ignore: break; case Opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - return -EINVAL; - popt->uid = uid; + popt->uid = result.uid; popt->uid_set = 1; break; case Opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - return -EINVAL; - popt->gid = gid; + popt->gid = result.gid; popt->gid_set = 1; break; case Opt_mode: From patchwork Fri Jun 28 00:37:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715330 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8221F224DD for ; Fri, 28 Jun 2024 00:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535072; cv=none; b=hCnuP0M+MgUM1QPaI52eInjQfp/EqwYCDwAF9rgXFlFS6PY/tzT1wlF7JbFHbzibwethBqA1dOpC3J7eFWDVE9LClr7WFNRWRmY+SRE7WASC+pV7VRnGA9lhmGpzfRUcOYkWcVECoNH9GEapSMi5dIpf5R+0QFEvRI11RABUxSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535072; c=relaxed/simple; bh=T9giCEeQe9O8JFgY1dAQ7TEqaknAFm0RMHXlWCjwxCM=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=hjDJK2yJ1uN+rCEDlJ1IkJA+S+9DrYiNXyAdwXt1bocuw7xTQNrfeZW6LaniwbViio/wCDk91UUTbkj95F5cbCtj2ceKMUXc5Ge5mvqEH9sSNqqkMLpl2zGNelRjJv4zH4HaacCcYUnoazDqMIi1ZpELcewXA6cLl+hjGaAdqBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dV7+w2up; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dV7+w2up" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535069; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQhMiTQyhSFYcIKwGIviJG1vL1dNkSkhvAxcEpR5AZU=; b=dV7+w2upqQS5raPYmc/Xh+NVfrZ06RNiSl/XERSOKeOD+p3+7e0orf+gbCyeS3NWHS5lHP fSY3OnOehWhViYHC4e9Yk0f1Fz1hqLMRmKfKgxB8AXXpl5nRPX51WvrlfrhCO1jLMuEKBR E3esNcf4Ih26RLm1wcsw/Was9CtlgCo= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-cpWUIslOPhSgtfwzcVaddQ-1; Thu, 27 Jun 2024 20:37:23 -0400 X-MC-Unique: cpWUIslOPhSgtfwzcVaddQ-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7f3c9764edbso3672739f.3 for ; Thu, 27 Jun 2024 17:37:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535042; x=1720139842; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zQhMiTQyhSFYcIKwGIviJG1vL1dNkSkhvAxcEpR5AZU=; b=eZjX1zNhr4F7xGiFP2B+2iImOKNm8rNbJmlgr6q+LUHBZXUg6pMo94uS/tEy8Fzh+P 7jJ/ukLdP/Z4eL8MSFeTNq0fWTaoLHJ0j3QA+xJ3s5i2XTkYBC4JCFb4CNrUFSwNtGj9 rYSIOJUKD36dCLGAhs2vXxS0PakEAEyha4OXMleZuY7W3/ogRtHG8VMQ8amdcL1yVyLx 3/a6QOxDJ0qDQpihNWQhYuEbTa7T5T4Ozu8hYXEUm74MV5mKqbHqDG5rFK0ydtKbj+le Je/NIGU2R4969C1z/1KDLvDRNdiR3iq9/GR/JoellX148syAY/aZznTHxpHQBus1dUsK 8IFQ== X-Gm-Message-State: AOJu0YwNIBGUvgJ7uxDKElZ8yr6YFdi+me5Jh90nB/I7hDHGZppR7KrO +Cz3zzJls3hUXYCkEyVosU4FPFwdl7GXiAvbgSPVsvBlDNqchxd7PPkO2cUselJSdhj5kKkcVTR jgYSpiXBX+REEKkunnz8njEzYgqXk6eyfqNxKvxXk7yeLmQU7Z8folsYpQG7cNizY03J6Iv7nGO 4498Gp1aKCkU3UZokWtZOpva7rpQHUE/9lDBHoOYRUQcNcfA== X-Received: by 2002:a6b:7010:0:b0:7f6:1b9f:8939 with SMTP id ca18e2360f4ac-7f61b9f8cecmr145464739f.7.1719535042404; Thu, 27 Jun 2024 17:37:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTaAADBARuSKBG3oQZT/2IZEnJcQm2Lvl9Dt7upSPBZW1npZEvY8uH0LWguSFbG15wJ+Z0dw== X-Received: by 2002:a6b:7010:0:b0:7f6:1b9f:8939 with SMTP id ca18e2360f4ac-7f61b9f8cecmr145463439f.7.1719535042046; Thu, 27 Jun 2024 17:37:22 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb742f1774sm218559173.160.2024.06.27.17.37.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:37:21 -0700 (PDT) Message-ID: <04bf30db-8542-48dc-9060-7f7dc08eda22@redhat.com> Date: Thu, 27 Jun 2024 19:37:21 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 10/14] ntfs3: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: ntfs3@lists.linux.dev References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/ntfs3/super.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 27fbde2701b6..c5b688c5f984 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -259,8 +259,8 @@ enum Opt { // clang-format off static const struct fs_parameter_spec ntfs_fs_parameters[] = { - fsparam_u32("uid", Opt_uid), - fsparam_u32("gid", Opt_gid), + fsparam_uid("uid", Opt_uid), + fsparam_gid("gid", Opt_gid), fsparam_u32oct("umask", Opt_umask), fsparam_u32oct("dmask", Opt_dmask), fsparam_u32oct("fmask", Opt_fmask), @@ -319,14 +319,10 @@ static int ntfs_fs_parse_param(struct fs_context *fc, switch (opt) { case Opt_uid: - opts->fs_uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(opts->fs_uid)) - return invalf(fc, "ntfs3: Invalid value for uid."); + opts->fs_uid = result.uid; break; case Opt_gid: - opts->fs_gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(opts->fs_gid)) - return invalf(fc, "ntfs3: Invalid value for gid."); + opts->fs_gid = result.gid; break; case Opt_umask: if (result.uint_32 & ~07777) From patchwork Fri Jun 28 00:38:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715331 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0CAE1D545 for ; Fri, 28 Jun 2024 00:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535098; cv=none; b=t88RsmqyQOAO8YwTFzm4LT/vdp3T/4coVehNY9xMGD5iaDEsEgprCa5oJ+cCTJyKji5aHCNYGMOxLPKYTQE5rcbLXVLzDoPJB+WnCt5ItuFBjUF8844Zu8pcBgDsmqkaSix4QI03ge4tIfGAGpGCOugr+A6bUSYL1yn1OBp92O8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535098; c=relaxed/simple; bh=+4+e6BzekZJNnDjFnnOhhaWUyuWndWTUObFeMdHxjWQ=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=sv3p+IrSwguvU7wcxlPnS/ladcwwhvB+tqmyYtxgkDn13o//q3KzDvkja47p7Krm0TJGuE5907FXPDe4qoGklA2/B7zqtI5hg/2QqfmSlcfrNwHOJaNKCuNpZCDxXHXDv2PiwSyHr0R7zlrDKtqgSHvreKgFUw1VWR8WyGtKoyM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dRVP6jZh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dRVP6jZh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535096; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=29Ula9NPUYU9ZHKXK1TTET3Q7YUfe5/KhwenbSdyx5g=; b=dRVP6jZhTpLgwBH0yJC9+ZiPccW5i5sY9keGdfU4l2tHolc1VCwc1W5jjdtP8FJbWrJFni ZaPBlO4zZP+njnAYWNNL7rJIQPhZpvUL/5i4znw+fs5LVOyGaDz+iEjebq/+VRLdDFmAn+ 6Us4+VzmderRDo7TByq5uBjCVpvM0ns= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-NfN5utNcNUe8vun8yRuRHQ-1; Thu, 27 Jun 2024 20:38:14 -0400 X-MC-Unique: NfN5utNcNUe8vun8yRuRHQ-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7eafdb25dbbso3799039f.3 for ; Thu, 27 Jun 2024 17:38:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535093; x=1720139893; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=29Ula9NPUYU9ZHKXK1TTET3Q7YUfe5/KhwenbSdyx5g=; b=CPT3k57uEz4VsIn1Q/8UgQCDRV84W0w5cZNNA73B82U1AFkUISiY+UDhQTCP0TCTpx q9zbHXcpc4xRn/neqK3r3bh4lAqXo9UJTq5lNv/tCUd7kmCMyvZkjfC4xmvvY7wBGnCw m1mGZ3Ha0KGQTjzIe92AD+2XSuLZrqMtZA/RzLho9qvL458F3VJ5i5SuYwsGnrJhPxqv 9xe1YLHdYYtvuZYtGrIe0hFmA8Oe4ke7M4vcQt653WOS0YES+hYpUwpBlXrYhWT6fB3J lHgF4LPw8F6uffc9AnjNQa0xUBkYJKVc7GHWLv4YW6K9IkGpGw7OjDW7+/BlzgmQLfwo 9lMw== X-Gm-Message-State: AOJu0Yz3j94qjk77LFF1bf1nu/M3O1A/sY94LlW3MM3a8fK73l1Bm/B/ V/Q1lrwvS4t0MAEgzgw4cQ14eTRdqBPGkSukreOo67f3sZsocakLkDsrFlBk/phorz1tZc14Grz JkqO1HmByTiUK9Lt4yfvFy8MiZdmxXE5ddYqdqemma60BX/h5vmRurg20APWkkfCpcob2nIWUOL bXU9EnlX2hysLNUy4mTQCa3naA74QZcDo3MIAKlDmM75zgmA== X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937224439f.11.1719535093222; Thu, 27 Jun 2024 17:38:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxqgFVI3k6X0qAOuP2yi+58eeC72Sq6ILbNqb+MthMIuCOYIhyyBK37gEipr9eZhFvFHZE7A== X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937223139f.11.1719535092889; Thu, 27 Jun 2024 17:38:12 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73bba7c0sm226668173.16.2024.06.27.17.38.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:38:12 -0700 (PDT) Message-ID: <06b54c7c-4f08-4d99-93d1-32b9f6706209@redhat.com> Date: Thu, 27 Jun 2024 19:38:12 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 11/14] tmpfs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-mm@kvack.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- mm/shmem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index a8b181a63402..922204184a82 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3903,14 +3903,14 @@ static const struct constant_table shmem_param_enums_huge[] = { }; const struct fs_parameter_spec shmem_fs_parameters[] = { - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_enum ("huge", Opt_huge, shmem_param_enums_huge), fsparam_u32oct("mode", Opt_mode), fsparam_string("mpol", Opt_mpol), fsparam_string("nr_blocks", Opt_nr_blocks), fsparam_string("nr_inodes", Opt_nr_inodes), fsparam_string("size", Opt_size), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), fsparam_flag ("inode32", Opt_inode32), fsparam_flag ("inode64", Opt_inode64), fsparam_flag ("noswap", Opt_noswap), @@ -3970,9 +3970,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) ctx->mode = result.uint_32 & 07777; break; case Opt_uid: - kuid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(kuid)) - goto bad_value; + kuid = result.uid; /* * The requested uid must be representable in the @@ -3984,9 +3982,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) ctx->uid = kuid; break; case Opt_gid: - kgid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(kgid)) - goto bad_value; + kgid = result.gid; /* * The requested gid must be representable in the From patchwork Fri Jun 28 00:39:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715332 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED5E21D545 for ; Fri, 28 Jun 2024 00:39:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535174; cv=none; b=ZEAQFkBak6ZvoUfzqGPPHujNRVsz8+N658nSsIMo2rPDiSV5E3KPL6FYprIOogNh5UIAZ3AL64dEwBpANSFwzMXWmr/GaVbI8qTBOoqMpdQaO0fSsIIFiwqpSoUnMd8SmkryHrwDheIevQHP7yAt538yikg+1CymiC00MzdoWs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535174; c=relaxed/simple; bh=k/GYj49tNHRu9Cr1Jzcr4L9WQKK7GhbiY7wTq6I033E=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=RMShOVBuh+6YZsiV0H4Nzr7+wUb72JgY94Sbel18QSGgW0HUyLOX3X9enOaR/FTZ4SbJqihx/ml/OOGatFtpFtwh+hNViaUEYExVQEyTJMZDECXmTIA91Z9aXpDolSmFBSveWEkv2tZ8G6ibRYnPho3AlpfV5HX03a2LRf/TWEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IPbNaPkz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IPbNaPkz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535171; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L6lVI4UdpUrrU7t2THONNRQMSPsMiPCxjmcMgqZQjHI=; b=IPbNaPkzSYlROLwtDFz/eoL7Yz1suA76jiJ8/uu7Ilt53rh8KYJbAySNwJzx7zY39zxzOH JqCYAFEQzzQ2Wu0mV3D6s6BTUFvwznufKlzMcNtqP0s2W4rewQxxOlnfNY1HfarUhbFdyi zXP8IKlFnRiWxCQi5hFMj71lq+EiTgQ= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-mkKqGq53NJC_ZHOlBjX_cQ-1; Thu, 27 Jun 2024 20:39:29 -0400 X-MC-Unique: mkKqGq53NJC_ZHOlBjX_cQ-1 Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-3737b3ee909so1339345ab.2 for ; Thu, 27 Jun 2024 17:39:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535168; x=1720139968; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L6lVI4UdpUrrU7t2THONNRQMSPsMiPCxjmcMgqZQjHI=; b=N8rDm3wCCrNIYg6mP5iTCDMzuAB/SSvc+40DukSM3EeHmuYrkQp4T32jz1I6mC5iaH Nuf36MekujZeM+HvfnuS6aP7wgnDTYBTSpWIsP0vdnqUaagI7FVJR4l9s2n6410n3uj3 AccCKNxKBxJB6NPg5SuSTQ4H96lVnM1iWvw6RALRwxkfISU9tZNa/LZOgc/i4ej5+c7N Q82s70Be8YlM0Klj8UYGlx/M8jpjggXYUDRl3E3lcDfu2CwTwuWOjLDcWshoxYNSPrCK tv3CfZq6ZBqGceGeb5BNpkB760FT2sHl48a3JdA5Id8K1XwkaD+x3padczEUur/sgvfs b9eg== X-Gm-Message-State: AOJu0YwP8Pvh7Xi81/8KvqnD1C0X//38h7g1qcxbQOXr3pQRqiN576cF 47xCFWHhqAGus8XlgzMs4Vrq9YztXMRFztucg1mbQqC3DrBGB//V9Lqe0tFtjB+9+vsIANfkJY3 Uqs/QI0vseG+tCQjro8YQzXJFDq7qGLkl+w3BzG0mPev9gfgM6sXwSptQPM7XhxCPt/GQz3Sry4 b6zpqnmZi7GX3bybfLDQtsgXLvKcioU7DCmnZHl0RhXgB7eg== X-Received: by 2002:a05:6e02:1b08:b0:375:be9e:34da with SMTP id e9e14a558f8ab-3763b0b4a4cmr217561785ab.2.1719535167785; Thu, 27 Jun 2024 17:39:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUkR/svSoWco43afklhPBsywxkUN6yiEPhjVFS6DjWiJxJqu6iv90RyIE35M2Q0SO3H2GPzA== X-Received: by 2002:a05:6e02:1b08:b0:375:be9e:34da with SMTP id e9e14a558f8ab-3763b0b4a4cmr217561645ab.2.1719535167496; Thu, 27 Jun 2024 17:39:27 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-37ad29827d6sm1751535ab.32.2024.06.27.17.39.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:39:27 -0700 (PDT) Message-ID: <2543358a-b97e-45ce-8cdc-3de1dd9a782f@redhat.com> Date: Thu, 27 Jun 2024 19:39:26 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 12/14] smb: client: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-cifs@vger.kernel.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- fs/smb/client/fs_context.c | 39 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 3bbac925d076..bc926ab2555b 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -128,12 +128,14 @@ const struct fs_parameter_spec smb3_fs_parameters[] = { fsparam_flag("compress", Opt_compress), fsparam_flag("witness", Opt_witness), + /* Mount options which take uid or gid */ + fsparam_uid("backupuid", Opt_backupuid), + fsparam_gid("backupgid", Opt_backupgid), + fsparam_uid("uid", Opt_uid), + fsparam_uid("cruid", Opt_cruid), + fsparam_gid("gid", Opt_gid), + /* Mount options which take numeric value */ - fsparam_u32("backupuid", Opt_backupuid), - fsparam_u32("backupgid", Opt_backupgid), - fsparam_u32("uid", Opt_uid), - fsparam_u32("cruid", Opt_cruid), - fsparam_u32("gid", Opt_gid), fsparam_u32("file_mode", Opt_file_mode), fsparam_u32("dirmode", Opt_dirmode), fsparam_u32("dir_mode", Opt_dirmode), @@ -951,8 +953,6 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, int i, opt; bool is_smb3 = !strcmp(fc->fs_type->name, "smb3"); bool skip_parsing = false; - kuid_t uid; - kgid_t gid; cifs_dbg(FYI, "CIFS: parsing cifs mount option '%s'\n", param->key); @@ -1083,38 +1083,23 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, } break; case Opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - goto cifs_parse_mount_err; - ctx->linux_uid = uid; + ctx->linux_uid = result.uid; ctx->uid_specified = true; break; case Opt_cruid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - goto cifs_parse_mount_err; - ctx->cred_uid = uid; + ctx->cred_uid = result.uid; ctx->cruid_specified = true; break; case Opt_backupuid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - goto cifs_parse_mount_err; - ctx->backupuid = uid; + ctx->backupuid = result.uid; ctx->backupuid_specified = true; break; case Opt_backupgid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - goto cifs_parse_mount_err; - ctx->backupgid = gid; + ctx->backupgid = result.gid; ctx->backupgid_specified = true; break; case Opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - goto cifs_parse_mount_err; - ctx->linux_gid = gid; + ctx->linux_gid = result.gid; ctx->gid_specified = true; break; case Opt_port: From patchwork Fri Jun 28 00:40:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715333 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 659CB4C7B for ; Fri, 28 Jun 2024 00:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535250; cv=none; b=r/dcr87TackAwwMFmBJqTYs061pAUVwWM0R9nQJMIfCYApsO3lcqtzjto90mcjsCGsibPuW6WJXzSVHlChpjFU3gxHpXgc//lzDv5csHG8ee15jhJjvGHS67p+2CCekIqr1053H1T0OPb444Q2ND9jjpNmo2ZJFcIOJvJjIir40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535250; c=relaxed/simple; bh=Xv8gun3l3UQeFDGlNKxjbcBxzvE7uW/YCpmcLt2vJf4=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=oJ2hBsG/RAu4VV+MFNtLHU3+qD7FECt7KI2XlDcFVxLmAOUdeYnTUaeC/7bK4cwA9rF6/zKW5T1H09fDUeiqwCgfaikraIkgY8TWWA2L5Hxu9XhtLHplxJejjaz5AHkfWZxNNX4eTOvEmCPw5IrTxnaFpe+03aXrMSway96TlEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HUMcffQX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HUMcffQX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535248; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Unk1vGLR1Be3cNBuySBujecQ1IeVxttlaXhutd1cek=; b=HUMcffQXU3qnMIBE2p6m9B7qWBcpsZ9YtiobHoS0wrnxAEXJM60YSsx8WNDwAYXVp+krvm dUXMtzCn+uBzaFPE+WVbUzxbLFbEPWwpreTgFyH/tDFAx5YM0MtPtTClMeep4Vi9hQZwVn bwuhX1wHkrIXag5RRMqpR2L13BME6u0= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-Nbq9UqU2Pjyy-yqfgJS23g-1; Thu, 27 Jun 2024 20:40:46 -0400 X-MC-Unique: Nbq9UqU2Pjyy-yqfgJS23g-1 Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3737b3ee909so1350325ab.2 for ; Thu, 27 Jun 2024 17:40:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535245; x=1720140045; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0Unk1vGLR1Be3cNBuySBujecQ1IeVxttlaXhutd1cek=; b=obpqs3LK5qsLEck/VmpqkfDtmi+QkzqOfioPvysgTcXFouNZW7+OXzYws2fa0rctWs Bsg3XC8cZiABSdIC07dOVG2c0iUOeOt5iLbyChgSv8BrYk43/LQqKzUjHT59SDpOyKvL /ELPRyY4w1+e0ZgjK9gwKYnGUj4SYBTBISZFtykxQIXCS2xtzkOPhpyzn+sqefyJWFN2 BY5f1rE96/ajAF+/K/P2X2fkeVPBSy0nBFA+f5+ZmcvJWIZkYGcUCOj0Sdo0W2fQGr0o dsUGhT8t/GrceMb+8GWglEF5yQizNXGXzst10aAlYQ+YuFVWvUKusW6GRreECGcJetXi pn4g== X-Gm-Message-State: AOJu0YySqoOIBbPEt0HyBY5IDr/xiyrZeOgXc+uiqZJM0K8ZPhZC3Q6x ECUwyivEMy/BHIt4bq6F7iX51DOBeLkcyHyIhlOuPJYNK61xbALNS1n+tsZSFG3vrQGpNrpjCtx OBZnpChS6peQiv4U9S4BbdwjETR51EMuRHhfGEwA9MJfKbfjGeJSJcjUkrzerTBMrM/1aBouKk+ QpfIA6Pqsb2IXpSvxYLkvQfvVEILEtcWf9JQ++OfFJd1Qt8A== X-Received: by 2002:a92:c56a:0:b0:375:b381:9acb with SMTP id e9e14a558f8ab-3763b34fe73mr188912145ab.30.1719535245219; Thu, 27 Jun 2024 17:40:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFh9UG4ASP/yXk4fz3eeE0HY6mTqWEdaPkoaUz2MCu4nPDeuH3H/jqqW6WuJ5Q6wUHkbfa/OQ== X-Received: by 2002:a92:c56a:0:b0:375:b381:9acb with SMTP id e9e14a558f8ab-3763b34fe73mr188911955ab.30.1719535244811; Thu, 27 Jun 2024 17:40:44 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-37ad2f41329sm1773545ab.50.2024.06.27.17.40.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:40:44 -0700 (PDT) Message-ID: <6c9b0b16-e61b-4dfc-852d-e2eb5bb11b82@redhat.com> Date: Thu, 27 Jun 2024 19:40:44 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 13/14] tracefs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-trace-kernel@vger.kernel.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen Acked-by: Steven Rostedt (Google) --- fs/tracefs/inode.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 7c29f4afc23d..1028ab6d9a74 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -296,9 +296,9 @@ enum { }; static const struct fs_parameter_spec tracefs_param_specs[] = { - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_u32oct ("mode", Opt_mode), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), {} }; @@ -306,8 +306,6 @@ static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param { struct tracefs_fs_info *opts = fc->s_fs_info; struct fs_parse_result result; - kuid_t uid; - kgid_t gid; int opt; opt = fs_parse(fc, tracefs_param_specs, param, &result); @@ -316,16 +314,10 @@ static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param switch (opt) { case Opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - return invalf(fc, "Unknown uid"); - opts->uid = uid; + opts->uid = result.uid; break; case Opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - return invalf(fc, "Unknown gid"); - opts->gid = gid; + opts->gid = result.gid; break; case Opt_mode: opts->mode = result.uint_32 & S_IALLUGO; From patchwork Fri Jun 28 00:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715337 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E2D3224 for ; Fri, 28 Jun 2024 00:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535351; cv=none; b=uVF0OpApuTK06JklRORx0xirwNe9WYVbkIe1Ol3znvDTelOK7eviRTaT/CMGNwrBpnp58zd+G3+WdX95JS6Khu7XO1mC1dLQq/oWD/VvyRMB3VjEWYk3C4vMCv5Oa3lUxaTw+Umu8Svsm/0gGYmUm3F0xFDqtipXgBOcH7KK7ZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719535351; c=relaxed/simple; bh=9JlM5wD2SXCrnmtQMestnllMmYEow+klcJ59N8yGv6U=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Exc5SlT2sSS5UIZcZxaRvm/6x0Yf0riJcOor+F4Tl6H9Y27436g4F/rxHj/IDXJweJ4x+VlH/9MdfqWScKEZvYdZ7VwscmEIuj2pcBoiO1X76eb10R5DieX0lhUgz5xFCBGmnHxtraKmI4orKr8s6VVpGj1bZa3dP0SKf2ovrIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TLaqlKHL; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TLaqlKHL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535349; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SIA7+ZRXeTWeMHotFYiEOy3m4rzA2+Fpd4H8n272VYw=; b=TLaqlKHLEd9SGCF7L8h+HZaoCvrcOr3Ltwh+f7VQH/diT156WlZYyCangW2zHHgzHuSqj/ IQnP62q+upLab7gjm+v85i63BEPS7I4KQJmH6LwA9lobpbNmpijxESf64wp4QxhdDKTYgt 0ftkMGEmjLyhfhio7+Q7b/PtizWpe/w= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-t9JP0e7MOaGqBCtRXVSjTA-1; Thu, 27 Jun 2024 20:42:27 -0400 X-MC-Unique: t9JP0e7MOaGqBCtRXVSjTA-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f61f4c998bso6118439f.1 for ; Thu, 27 Jun 2024 17:42:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535346; x=1720140146; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SIA7+ZRXeTWeMHotFYiEOy3m4rzA2+Fpd4H8n272VYw=; b=ibV0CbB9OHlIG+r6MN0s0Om9aTuu0Rs1qNpc6kj4evNOhCRnPX695VbNDopswy+m9C AOkCDBGG5K+jFW7uP3bI8mSTy0CZA896K+fl87iG/FNcESSOtMoUXBlNhfcTzlVgGPa8 R8CcIjp3gLsX9cmNpUAACWy9Z6/vnl+aCVrEiAtG+EPZDG7Q6uS7c6AHDx6XC2fTp0Lp Mzgo0e0A0mYvKrQM2+cPvdpwNNUGPBRHf0KGVnnpYJCBcXFFk1m0HzPzidZn1iQMSBvM qFV5lOPgsKwEBJHVyKQeW95CJF9SeCS/zVGiDbnEadrAKEbzg+N3A/GHJjyGZHWGPhto C1AQ== X-Gm-Message-State: AOJu0YyVE98qs5fULDfY/Td9TVm/lX7IqpOelvDsfXthRSkAGSF0nT3N EdzRXlR5XScw2Q4FwV2uKX8LcwXbQgPP99eHAttGRFuxho2CP6ExpJe1dBsMIubb+PQFgXHV2lj 1qJ4jq3dO0slYO5guK9AXG0eChCIKIGeyeLA1NCEhvLqEO0px1QSbupryidxr7dO7gRIzpqVU4t 1o52Jjs10gwf1KjhjFKaByiLbR2IeO7hhXhShJNGN0vT+JwA== X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937854839f.11.1719535346209; Thu, 27 Jun 2024 17:42:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMedkXRgCs6D2PWTWIjckfA96S4jfjSC4LMilhDSbNUt6OxDRh8WhB4XXkMDeTvbgzVSVoVw== X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937853439f.11.1719535345820; Thu, 27 Jun 2024 17:42:25 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-7f61ce87f69sm19355839f.1.2024.06.27.17.42.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:42:25 -0700 (PDT) Message-ID: <58862d35-a026-4866-ab7f-fa09dda8ac1f@redhat.com> Date: Thu, 27 Jun 2024 19:42:25 -0500 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 14/14] vboxsf: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: Hans de Goede References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Content-Language: en-US In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> Convert to new uid/gid option parsing helpers From: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Hans de Goede --- fs/vboxsf/super.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c index ffb1d565da39..e95b8a48d8a0 100644 --- a/fs/vboxsf/super.c +++ b/fs/vboxsf/super.c @@ -41,8 +41,8 @@ enum { opt_nls, opt_uid, opt_gid, opt_ttl, opt_dmode, opt_fmode, static const struct fs_parameter_spec vboxsf_fs_parameters[] = { fsparam_string ("nls", opt_nls), - fsparam_u32 ("uid", opt_uid), - fsparam_u32 ("gid", opt_gid), + fsparam_uid ("uid", opt_uid), + fsparam_gid ("gid", opt_gid), fsparam_u32 ("ttl", opt_ttl), fsparam_u32oct ("dmode", opt_dmode), fsparam_u32oct ("fmode", opt_fmode), @@ -55,8 +55,6 @@ static int vboxsf_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct vboxsf_fs_context *ctx = fc->fs_private; struct fs_parse_result result; - kuid_t uid; - kgid_t gid; int opt; opt = fs_parse(fc, vboxsf_fs_parameters, param, &result); @@ -73,16 +71,10 @@ static int vboxsf_parse_param(struct fs_context *fc, struct fs_parameter *param) param->string = NULL; break; case opt_uid: - uid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(uid)) - return -EINVAL; - ctx->o.uid = uid; + ctx->o.uid = result.uid; break; case opt_gid: - gid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(gid)) - return -EINVAL; - ctx->o.gid = gid; + ctx->o.gid = result.gid; break; case opt_ttl: ctx->o.ttl = msecs_to_jiffies(result.uint_32);