Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp350174pxt; Fri, 6 Aug 2021 03:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWjGVm9OPY861xD8UbKrbd4FXzm6FlFtE590WRD/KXwjLLrUMRbXA96mZwCVztuxzmVp0g X-Received: by 2002:a02:c841:: with SMTP id r1mr9159149jao.2.1628246345270; Fri, 06 Aug 2021 03:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628246345; cv=none; d=google.com; s=arc-20160816; b=ahP8v/pq/+Bo3ouBoRK6DakIrEvSUB55qE6PBDREwDzgD3s2CBvlqN+VftwurAD/Ck Gq2H6vZtEQuzUMUyWbG3HD/BwOCQqnpcOfE9aSAegpr8OGMgyK7tQB0MaMukcmRIYTit /VFngPYUCbCQQrJQBjkL6tt1fz5I3RpV/Vi44UBhGN1yAo+fJ2tT+2j7jSrwYNAA6xkl U6NchLdtp6VMbap1Alt3u8RkmpJJoDO4teQUVGFLTvFIx3AO1KCG9F3ipVzf3AudunPv 2YXH/sa9Wr+oWEuvLqy6U+6y5FMryBT5Q4jHOFsYPDKpIA9ZOBQanr4wjcGxw2ANyYsS rkuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ohHKSh+HZImpSVaLM9TW5relpABftXO5BlsVkkQC4Nk=; b=QRDzeoij2soxdZBe3Bz6Vzx6erDiYE+qapuVJj0ACF8RKJTVixv1zey2E78AsKAD+k WWceR9mQ73mkRv+WF+TfhXMSjKub3niIvJVxKO4YNaYOpoXg8HK4BdPSu7E5pbM8aBh8 gFcQMbhkS+BfnZaGvLf3qQ+OFbcvRiAjUufkYTIyw+XgfBjKs0SdPGWCKnoBwl+6/Y0j tcqU0lRTXbxe99KKyAIDoTK87rvupBGNuAjLflGUbcNxcZAf/aMZNXK461E2VYt5E3ci zkp0ozKcurLqrFcA/A8nn8K8grjV6e3WQ40I7amexFC8Eza+h50vzUSzYqI/OzT762fy QEow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XYiFbQ2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si7922572ioz.5.2021.08.06.03.38.50; Fri, 06 Aug 2021 03:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XYiFbQ2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245212AbhHFKhW (ORCPT + 99 others); Fri, 6 Aug 2021 06:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245202AbhHFKhT (ORCPT ); Fri, 6 Aug 2021 06:37:19 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0921FC061798 for ; Fri, 6 Aug 2021 03:37:04 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id cf5so12424716edb.2 for ; Fri, 06 Aug 2021 03:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ohHKSh+HZImpSVaLM9TW5relpABftXO5BlsVkkQC4Nk=; b=XYiFbQ2l+Q6VnSuV3mymGTcQZDcTePXH6XonuZpjEeql1yzQTM9ZnH8pilXV4DIuID wDH6SxZ84yHVSzT+rneEwPYnY764gFXIXf+HhKFw7pmiVPSjBq66l4ZgWjUYSTCwwRHD IPUSw5iy2QAwSXR9NEQ5CBeG7ZOJ+tyXlrZf35KtgHVSkmO5gEgpWhPREtxIAigx7Q54 /hu2yhPbubYXMAm1n8gepSozQnWaaEkBbWQywVgce/BXCouIbuLE2sAWeH61kwRES3zS fHjzaJPB1ce1I3VvVfSeTCjBvFwjrnOijjBB/6aF9nibTWs7Gs7GGnIyfOOz03U6K9Op uzKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ohHKSh+HZImpSVaLM9TW5relpABftXO5BlsVkkQC4Nk=; b=kVzr8AHQhYG8HoV6MVQUol5NFFyljYuiTYO3s8XaXNSeqJ0qRYNmTwzTeoeXnydy39 0Ba2bRlS5IElhlLEQgO/0e4Vx4jsooHiUkeZxyh7Biq7bNwhAinoBEzkxw/Y3+jr6jP5 M2fXzSmD1GqDYdkp/e6j5HWqvf9Npj8CBv0NWxmb/K1+wr/j0o73bRWGU2q4RqWp8a/R WAjgT1SxWiElP7BeZ5I0p9NZWLJYQvy/637h3fjh570c4frkQ8vSfEv58Fh9xEk/YzrR Dk3I6YmVn8SWppxGBYbMkZn9x56ITShp+mtuL/qajYNk+fd4ExJssip+GR4LUijru7ME DXqQ== X-Gm-Message-State: AOAM532+R6BszAH4Km20Kx4BUOk2jc3spSemoZXQw8TXeZklAF462Oa2 kvAIRpbg4tfsHgRwq0Ocwa3rhLYUSpKmuEAI8v3zJw== X-Received: by 2002:aa7:c805:: with SMTP id a5mr11962205edt.23.1628246222536; Fri, 06 Aug 2021 03:37:02 -0700 (PDT) MIME-Version: 1.0 References: <20210730062854.3601635-1-svens@linux.ibm.com> <875ywlat5e.fsf@disp2133> <94478003-8259-4b57-6d93-5a07e0750946@kernel.org> <87v94jalck.fsf@disp2133> <56b7c0fe-f2e1-7c4f-eb1b-1d9793dea5a8@kernel.org> In-Reply-To: <56b7c0fe-f2e1-7c4f-eb1b-1d9793dea5a8@kernel.org> From: Naresh Kamboju Date: Fri, 6 Aug 2021 16:06:51 +0530 Message-ID: Subject: Re: [PATCH v3] ucounts: add missing data type changes To: "Eric W. Biederman" Cc: Sven Schnelle , Nathan Chancellor , Alexey Gladkov , open list , LTP List , linux-fsdevel@vger.kernel.org, Jan Kara Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Aug 2021 at 00:56, Nathan Chancellor wrote: > > On 8/5/2021 9:48 AM, Eric W. Biederman wrote: > > Nathan Chancellor writes: > > > >> Hi Eric, > >> > >> On 8/4/2021 12:47 PM, Eric W. Biederman wrote: > >>> Nathan Chancellor writes: > >>> > >>>> On Fri, Jul 30, 2021 at 08:28:54AM +0200, Sven Schnelle wrote: > >>>>> commit f9c82a4ea89c3 ("Increase size of ucounts to atomic_long_t") > >>>>> changed the data type of ucounts/ucounts_max to long, but missed to > >>>>> adjust a few other places. This is noticeable on big endian platforms > >>>>> from user space because the /proc/sys/user/max_*_names files all > >>>>> contain 0. > >>>>> > >>>>> Fixes: f9c82a4ea89c ("Increase size of ucounts to atomic_long_t") > >>>>> Signed-off-by: Sven Schnelle > >>>> > >>>> This patch in -next as commit e43fc41d1f7f ("ucounts: add missing data type > >>>> changes") causes Windows Subsystem for Linux to fail to start: On Linux next-20210802..next-20210805 we have been noticing that LTP syscalls inotify06 test case getting failed all architectures. BAD: Linux next-20210802 inotify06.c:57: TBROK: Failed to close FILE '/proc/sys/fs/inotify/max_user_instances': EINVAL (22) inotify06.c:107: TWARN: Failed to close FILE '/proc/sys/fs/inotify/max_user_instances': EINVAL (22) GOOD: Linux next-20210730 inotify06.c:92: TPASS: kernel survived inotify beating Investigation: Following changes found between good and bad Linux next tags under fs/notify git log --oneline --stat next-20210730..next-20210802 fs/notify e43fc41d1f7f ucounts: add missing data type changes fs/notify/fanotify/fanotify_user.c | 10 ++++++---- fs/notify/inotify/inotify_user.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) Conclusion: We have confirmed this patch caused the LTP syscalls inotify06 test failure. After applying your proposed fix patch [1] the reported test getting pass. However, I have to run full test plan to confirm this do not cause regressions. Tested-by: Linux Kernel Functional Testing [1] https://lore.kernel.org/lkml/87v94jalck.fsf@disp2133/ > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > > index 6576657a1a25..28b67cb9458d 100644 > > --- a/fs/notify/fanotify/fanotify_user.c > > +++ b/fs/notify/fanotify/fanotify_user.c > > @@ -54,6 +54,9 @@ static int fanotify_max_queued_events __read_mostly; > > > > #include > > > > +static long ft_zero = 0; > > +static long ft_int_max = INT_MAX; > > + > > struct ctl_table fanotify_table[] = { > > { > > .procname = "max_user_groups", > > @@ -61,8 +64,8 @@ struct ctl_table fanotify_table[] = { > > .maxlen = sizeof(long), > > .mode = 0644, > > .proc_handler = proc_doulongvec_minmax, > > - .extra1 = SYSCTL_ZERO, > > - .extra2 = SYSCTL_INT_MAX, > > + .extra1 = &ft_zero, > > + .extra2 = &ft_int_max, > > }, > > { > > .procname = "max_user_marks", > > @@ -70,8 +73,8 @@ struct ctl_table fanotify_table[] = { > > .maxlen = sizeof(long), > > .mode = 0644, > > .proc_handler = proc_doulongvec_minmax, > > - .extra1 = SYSCTL_ZERO, > > - .extra2 = SYSCTL_INT_MAX, > > + .extra1 = &ft_zero, > > + .extra2 = &ft_int_max, > > }, > > { > > .procname = "max_queued_events", > > diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c > > index 55fe7cdea2fb..62051247f6d2 100644 > > --- a/fs/notify/inotify/inotify_user.c > > +++ b/fs/notify/inotify/inotify_user.c > > @@ -55,6 +55,9 @@ struct kmem_cache *inotify_inode_mark_cachep __read_mostly; > > > > #include > > > > +static long it_zero = 0; > > +static long it_int_max = INT_MAX; > > + > > struct ctl_table inotify_table[] = { > > { > > .procname = "max_user_instances", > > @@ -62,8 +65,8 @@ struct ctl_table inotify_table[] = { > > .maxlen = sizeof(long), > > .mode = 0644, > > .proc_handler = proc_doulongvec_minmax, > > - .extra1 = SYSCTL_ZERO, > > - .extra2 = SYSCTL_INT_MAX, > > + .extra1 = &it_zero, > > + .extra2 = &it_int_max, > > }, > > { > > .procname = "max_user_watches", > > @@ -71,8 +74,8 @@ struct ctl_table inotify_table[] = { > > .maxlen = sizeof(long), > > .mode = 0644, > > .proc_handler = proc_doulongvec_minmax, > > - .extra1 = SYSCTL_ZERO, > > - .extra2 = SYSCTL_INT_MAX, > > + .extra1 = &it_zero, > > + .extra2 = &it_int_max, > > }, > > { > > .procname = "max_queued_events", > > diff --git a/kernel/ucount.c b/kernel/ucount.c > > index 260ae7da815f..bb51849e6375 100644 > > --- a/kernel/ucount.c > > +++ b/kernel/ucount.c > > @@ -58,14 +58,17 @@ static struct ctl_table_root set_root = { > > .permissions = set_permissions, > > }; > > > > +static long ue_zero = 0; > > +static long ue_int_max = INT_MAX; > > + > > #define UCOUNT_ENTRY(name) \ > > { \ > > .procname = name, \ > > .maxlen = sizeof(long), \ > > .mode = 0644, \ > > .proc_handler = proc_doulongvec_minmax, \ > > - .extra1 = SYSCTL_ZERO, \ > > - .extra2 = SYSCTL_INT_MAX, \ > > + .extra1 = &ue_zero, \ > > + .extra2 = &ue_int_max, \ > > } > > static struct ctl_table user_table[] = { > > UCOUNT_ENTRY("max_user_namespaces"), -- Linaro LKFT https://lkft.linaro.org