From patchwork Mon Sep 18 12:32:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13389545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA818CD37B0 for ; Mon, 18 Sep 2023 12:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241375AbjIRMdT (ORCPT ); Mon, 18 Sep 2023 08:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241231AbjIRMcv (ORCPT ); Mon, 18 Sep 2023 08:32:51 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5600411F for ; Mon, 18 Sep 2023 05:32:31 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-99bdcade7fbso565706266b.1 for ; Mon, 18 Sep 2023 05:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1695040350; x=1695645150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bTIpQ2wCkQ3gsn9IN2OtZFBrX++kayidfIH0DbMWLuA=; b=fJJU9BqTIihg7qWtYW0OAU0Reg/jv7ksGHuJmnrEXD2jsFE2+cews4dZFPDxn+80iS 8b7uHs/e/18DlFnNn63JImv9m9pgPze8a8p3T8Yx28CJgbdPHPMlPP/P3U3bjDtGhSCY OHrDqqfJUa+SKehcgYVlwpjV/hqSdls4G1LpcQv8XWisfr8lUg4CQMimVybhcycoRoxw owEiJZoEEA7nZGQnt6KXjK5fk5nd9YRe9VyWt5VGdKECs6J3y1WMVfiQD5rJyEdK/uZN B70h4cUIOzjqR2jkBxNpM5uC5Hz6BToCy4F4VvqS/tCjiidpQRy8mCGaWqADn52r10Zl JGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695040350; x=1695645150; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bTIpQ2wCkQ3gsn9IN2OtZFBrX++kayidfIH0DbMWLuA=; b=S24l40VEKYilR/+ODKRzVQY2hbPhAWtzVhNJbD1ndKbj2NkDhXaAvMW52vk98g690L c7sZl0pLtYfNjPwbUwzkY2Gl/ELUbCqfyLANbPgmS9nDOGbvFo1SgRNz8atT6PJwRDeZ VkNB0L2rTFQJOOtMoWMh5D2NlwZNEadBIqmQEYvrJRBW4LztG10Y7EN/PdFTW2Mljg7b /A/YXy6M3bNdFHdhqKQsq7ZKrMR49G4uRELSVjiKoEaDnuwC4yutjDr9FNml3oSU0RiV NXaLogqrH8rG5F5nzm7yO8mFBZJL2D6mkbrzbbOEFRHR5HAMH5ljCIV9kFyCQ1NsVR6c CXvA== X-Gm-Message-State: AOJu0YyaxtvVi9yAzBCKdRZHj16NtwI2aBmla2FIS5W4Uif2tGEEluJu XpLuA8bBpBOLAWPPdTdhJZSBsg== X-Google-Smtp-Source: AGHT+IHEmVNUNMnKl+moqAewq8OTkGHbe/1b/+ipQQWMklc3BOQrfXYoynSLn5IudSVNJhlGcTCSBw== X-Received: by 2002:a17:907:7888:b0:9ad:e244:911e with SMTP id ku8-20020a170907788800b009ade244911emr6635009ejc.55.1695040349768; Mon, 18 Sep 2023 05:32:29 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f209c00529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f20:9c00:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id sd5-20020a170906ce2500b00992a8a54f32sm6328834ejb.139.2023.09.18.05.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:32:29 -0700 (PDT) From: Max Kellermann To: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: amir73il@gmail.com, max.kellermann@ionos.com Subject: [PATCH 1/4] inotify_user: pass directory fd to inotify_find_inode() Date: Mon, 18 Sep 2023 14:32:14 +0200 Message-Id: <20230918123217.932179-1-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Preparing for inotify_add_watch_at(). To: Jan Kara Cc: Amir Goldstein To: linux-fsdevel@vger.kernel.org To: linux-kernel@vger.kernel.org Signed-off-by: Max Kellermann --- fs/notify/inotify/inotify_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 1c4bfdab008d..1853439a24f6 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -370,12 +370,12 @@ static const struct file_operations inotify_fops = { /* * find_inode - resolve a user-given path to a specific inode */ -static int inotify_find_inode(const char __user *dirname, struct path *path, +static int inotify_find_inode(int dfd, const char __user *dirname, struct path *path, unsigned int flags, __u64 mask) { int error; - error = user_path_at(AT_FDCWD, dirname, flags, path); + error = user_path_at(dfd, dirname, flags, path); if (error) return error; /* you can only watch an inode if you have read permissions on it */ @@ -774,7 +774,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, if (mask & IN_ONLYDIR) flags |= LOOKUP_DIRECTORY; - ret = inotify_find_inode(pathname, &path, flags, + ret = inotify_find_inode(AT_FDCWD, pathname, &path, flags, (mask & IN_ALL_EVENTS)); if (ret) goto fput_and_out; From patchwork Mon Sep 18 12:32:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13389546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 195A8C46CA1 for ; Mon, 18 Sep 2023 12:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241272AbjIRMdW (ORCPT ); Mon, 18 Sep 2023 08:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241310AbjIRMcz (ORCPT ); Mon, 18 Sep 2023 08:32:55 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFBD123 for ; Mon, 18 Sep 2023 05:32:33 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c00e1d4c08so13125051fa.3 for ; Mon, 18 Sep 2023 05:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1695040352; x=1695645152; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uqgSIBXgk25i53ApRC28zb/oSMjI8zuN4nMgi5m6KPw=; b=AbRNqM/fiJM/bE7wY1el3fMd89AufNmuIbzAXyP/5QHlTsHOg+ARZf6trUrHZq/Xhb BOFmIayEZTp+3s60XpqS0STJrjVchDiFxTD3tG33H9va2Dt6TwMsYLeByHvtgc0oM2l4 4C3/nzpD/NmS0UUlAYbhNQH7T6WVofV+cYp4ivcg7IXJ88YL79qbe+42uql8bznCzYwX lR4LPgcbgy4kOfQBQ+PCmYruQX7WvNkqRaNzvQGRruSZUiP+NTfx5tQbv8sofQ7pNiBS aQ5ZZPEHQia9sKjA+AeKEE7FEg37lGwZ3Jw4v8TIxU9JlnQ8n4oIwCNYL33gqhqqw6jo Obbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695040352; x=1695645152; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uqgSIBXgk25i53ApRC28zb/oSMjI8zuN4nMgi5m6KPw=; b=Ake+gzXYsB78APxdAj9IABB+2YYaqTNUOYFrwjN2aMhQeMquogs6CHD5C4W/AsL575 zuqWFr3xfy9g2hgG4l9sheBBHQNyTEXDCga/zj/DUHAUYG9hSi36QQqkp/nd4aZDigft q6C6p5+ApCqAZ07FvpVAX0a9Nh9Yv0SGLMY7ztCKQgSvO7sC5YqNN+NeHlFhr6VHjBYZ k2pS526uUch5NJVpfytr3Av+1Pr7P6JboqA6xd4L+21Tv3AgwVwzv7Aw+RUh7Zd1ybwv 5JRGiBdSjLRcjtQt+sMzd+P8+Sk5DwP9ihmnPH8mxJBVIQ85dA8/F4kD9XmB8HJ5N2R9 UT2w== X-Gm-Message-State: AOJu0Yz3rR7hLGittJRQBA8PkFRWRRajSO277MEvEi+n2/KhUCgiM5s7 +pNHpvH2JEPLnB0YtS5pcSorFg== X-Google-Smtp-Source: AGHT+IHyITxWOKyii08edYjtBP+VDisXRQZsIpqTV7m77hz2QxO+vF6oAgcMFre6E+YBeNChO1fUgg== X-Received: by 2002:a05:651c:1727:b0:2c0:1cfd:8698 with SMTP id be39-20020a05651c172700b002c01cfd8698mr679905ljb.36.1695040352145; Mon, 18 Sep 2023 05:32:32 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f209c00529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f20:9c00:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id sd5-20020a170906ce2500b00992a8a54f32sm6328834ejb.139.2023.09.18.05.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:32:31 -0700 (PDT) From: Max Kellermann To: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: amir73il@gmail.com, max.kellermann@ionos.com Subject: [PATCH 2/4] inotify_user: move code to do_inotify_add_watch() Date: Mon, 18 Sep 2023 14:32:15 +0200 Message-Id: <20230918123217.932179-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918123217.932179-1-max.kellermann@ionos.com> References: <20230918123217.932179-1-max.kellermann@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Preparing for inotify_add_watch_at(). To: Jan Kara Cc: Amir Goldstein To: linux-fsdevel@vger.kernel.org To: linux-kernel@vger.kernel.org Signed-off-by: Max Kellermann --- fs/notify/inotify/inotify_user.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 1853439a24f6..b6e6f6ab21f8 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -727,8 +727,8 @@ SYSCALL_DEFINE0(inotify_init) return do_inotify_init(0); } -SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, - u32, mask) +static int do_inotify_add_watch(int fd, int dfd, const char __user *pathname, + u32 mask) { struct fsnotify_group *group; struct inode *inode; @@ -774,7 +774,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, if (mask & IN_ONLYDIR) flags |= LOOKUP_DIRECTORY; - ret = inotify_find_inode(AT_FDCWD, pathname, &path, flags, + ret = inotify_find_inode(dfd, pathname, &path, flags, (mask & IN_ALL_EVENTS)); if (ret) goto fput_and_out; @@ -791,6 +791,12 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, return ret; } +SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, + u32, mask) +{ + return do_inotify_add_watch(fd, AT_FDCWD, pathname, mask); +} + SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd) { struct fsnotify_group *group; From patchwork Mon Sep 18 12:32:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13389547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 380F2CD13D9 for ; Mon, 18 Sep 2023 12:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241129AbjIRMdV (ORCPT ); Mon, 18 Sep 2023 08:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241329AbjIRMc4 (ORCPT ); Mon, 18 Sep 2023 08:32:56 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 047FD10A for ; Mon, 18 Sep 2023 05:32:36 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b9c907bc68so74584971fa.2 for ; Mon, 18 Sep 2023 05:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1695040354; x=1695645154; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iVQUJ/L8+afXKT69wRIL26IHsJ0vcphHTUN9uWpD+6k=; b=ZVJDUei0T8xfdtWX15tKcApO5DRgqvWossHyS/Yo7okNpQcav0LIfkrrJ/dRxgUtoS dMbR5D4WEUPreV7wBLTlKjgC7dtk35RGPlh2PVFlIfMDntYOfK/E81js+s0ZonC3rg1I 1HD3KVIWrjTxMGDjGor7LqciO2j6GqTk03MS44Ojh+pz/omTEf/GWwnZlsQsQR/ljbtA NF/fyLltWyB4hnvTKdEqgWtjiXyU/8lnwAxzcuDESpZ89rXQ0saDf2oE+/lVAIw1Hwi/ V6AgiaGj6W+9mljljF+gJWWeHZYBb6MvNOFyntHkdDF1zqjJRpIJIMmD0yJdP1E77rZX UA7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695040354; x=1695645154; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iVQUJ/L8+afXKT69wRIL26IHsJ0vcphHTUN9uWpD+6k=; b=rzJpFKDNPp9nmsLRCVed8X2ImbvMT5oM24n7UKEvX5r/GfrxhucVz0lcvcyjSbt++V E6sSgpdhR0f07I2rYIN3P+GTYnlCgJGdxAX9yJ2BzBum+UJiDg8z+vOa/cdzrGb3cm07 mN52gnbiFN85UNpJT2mbKfPXxm/YyW8CI9+t6t0f94ACxqi6GRs3OEw0KdSty6WPGiqQ Uzn9Cq4ESOqpYb7Wc2PsYuKFqMksv8CKRLjCBuDvrwpGNWtggDJPHp2lZx9ka7AZW2jb 0+R6xHCpXNGmUszaRnHYtQq0rrJE2m2O5rDPW8ByFqE+HDz98iBA5gSDMEBL0BbC6roM LD8Q== X-Gm-Message-State: AOJu0YxAJbw9nrgJ3J2cuJPMSJ0G6on4OrYMKkvVsx5fxdSsS3FUWKNp kVpObiJ0O22UzQ64tMGu+obfkPpg00ujIKC8FNI= X-Google-Smtp-Source: AGHT+IHb3L5MoZ8WzsxS2Mcfsaw3C3Napx9+SHpFnQgKIyys75W2jZc3ZlqdjEn8jHRUcw8A38gNeQ== X-Received: by 2002:a2e:80d7:0:b0:2bc:ff80:f639 with SMTP id r23-20020a2e80d7000000b002bcff80f639mr7962895ljg.7.1695040354219; Mon, 18 Sep 2023 05:32:34 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f209c00529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f20:9c00:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id sd5-20020a170906ce2500b00992a8a54f32sm6328834ejb.139.2023.09.18.05.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:32:33 -0700 (PDT) From: Max Kellermann To: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: amir73il@gmail.com, max.kellermann@ionos.com Subject: [PATCH 3/4] inotify_user: add system call inotify_add_watch_at() Date: Mon, 18 Sep 2023 14:32:16 +0200 Message-Id: <20230918123217.932179-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918123217.932179-1-max.kellermann@ionos.com> References: <20230918123217.932179-1-max.kellermann@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This implements a missing piece in the inotify API: referring to a file by a directory file descriptor and a path name. This can be solved in userspace currently only by doing something similar to: int old = open("."); fchdir(dfd); inotify_add_watch(....); fchdir(old); Support for LOOKUP_EMPTY is still missing. We could add another IN_* flag for that (which would clutter the IN_* flags list further) or add a "flags" parameter to the new system call (which would however duplicate features already present via special IN_* flags). To: Jan Kara Cc: Amir Goldstein To: linux-fsdevel@vger.kernel.org To: linux-kernel@vger.kernel.org Signed-off-by: Max Kellermann --- fs/notify/inotify/inotify_user.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index b6e6f6ab21f8..8a9096c5ebb1 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -797,6 +797,12 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, return do_inotify_add_watch(fd, AT_FDCWD, pathname, mask); } +SYSCALL_DEFINE4(inotify_add_watch_at, int, fd, int, dfd, const char __user *, pathname, + u32, mask) +{ + return do_inotify_add_watch(fd, dfd, pathname, mask); +} + SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd) { struct fsnotify_group *group; From patchwork Mon Sep 18 12:32:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13389548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5762ACD13DD for ; Mon, 18 Sep 2023 12:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241301AbjIRMdW (ORCPT ); Mon, 18 Sep 2023 08:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241358AbjIRMc5 (ORCPT ); Mon, 18 Sep 2023 08:32:57 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0173F12F for ; Mon, 18 Sep 2023 05:32:38 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-99c93638322so966461366b.1 for ; Mon, 18 Sep 2023 05:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1695040357; x=1695645157; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0X6QtCgWBlGiAp6h0kF11KB6rl566Y3up0YcWsWItks=; b=Tj2vtYb6TouL5/hGJnJfRgF1fUCrUMB9K0ph236O723alETthSQocRNC6PdHDca5Kb 9Ss13k7zOLBqEl6KbNyO6WdJ0svtavKwKgbcXvp5D7zAJvJB3lJ0OfMtATpOV5z36YTJ DDju7F+coo+B30W680ZWth7+8Sc1wu36ghxprFL6Zkh3oqsxCB2GUY5QRY9pF8eI+rx3 Bb6Nb+/DigcQ9zH/li6koN2JpH4l/wcT3wPubReXZACWUjNlf/fzOLfAHm1zEVxWrho0 u4wFXJi1soAWyKaCgYgYvmsrH+NH7tJTWQJwB5X5lpjVkvLvTeEpRD1C/dSJi4TpCw4m +byA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695040357; x=1695645157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0X6QtCgWBlGiAp6h0kF11KB6rl566Y3up0YcWsWItks=; b=omSmRZqrbiZAY8hdKx1RTCTRpm2iBpnxkXwYI2cXJ3FTgf4ZS2lyQkAK7yVZ5NB/+P NQ6WFRHjJAiopo2djctYIgKQNTAVTRmaA0Z+jGUTlO1RxlHtmUSyRKi3KDRKY7mcjjwk 2s9al4Rh8Hhv9ORBDLTlrMnAZZfvOIjulZlTb6u/QukWzKeSwjOMigMYOB8i2vMXuAh0 jKfpu2YW4eDe+s+p/NwqpJXV62Q/brJDGiX/k82vTmhkpMMh5k6kxLBGhaWrRVvwLorU zsyy98/WxUgs+i0lhGJYK1djvRnf/76aKZLnF9L8YWcIIyRsroV4o5g+gof3NDnXJ0R/ rRkQ== X-Gm-Message-State: AOJu0Yzy/ibg8ut1uUmmtQk9cylqjb8AkkAl9GLMcwjeOWKlRKwem6sp TdRlcWwoKAXuO4BOkyaZCPgiNw== X-Google-Smtp-Source: AGHT+IFDdOBnzHdZyGLyZKVR0v/pADMFz5hsIDpwkS0m3PP6fei3DHqPGd6adGZwnzXHrnOt1zV2Fw== X-Received: by 2002:a17:906:eec5:b0:9a1:aaae:8207 with SMTP id wu5-20020a170906eec500b009a1aaae8207mr16145626ejb.20.1695040357404; Mon, 18 Sep 2023 05:32:37 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f209c00529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f20:9c00:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id sd5-20020a170906ce2500b00992a8a54f32sm6328834ejb.139.2023.09.18.05.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:32:35 -0700 (PDT) From: Max Kellermann To: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: amir73il@gmail.com, max.kellermann@ionos.com Subject: [PATCH 4/4] arch: register inotify_add_watch_at Date: Mon, 18 Sep 2023 14:32:17 +0200 Message-Id: <20230918123217.932179-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918123217.932179-1-max.kellermann@ionos.com> References: <20230918123217.932179-1-max.kellermann@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Using syscall number 454 (only different on Alpha). This skips 453 on most architectures; 453 is used on x86_64 for "map_shadow_stack" and my idea is to reserve that number for the remaining architectures, where an implementation may be added eventually. Signed-off-by: Max Kellermann --- arch/alpha/kernel/syscalls/syscall.tbl | 1 + arch/arm/tools/syscall.tbl | 1 + arch/arm64/include/asm/unistd.h | 2 +- arch/arm64/include/asm/unistd32.h | 2 ++ arch/ia64/kernel/syscalls/syscall.tbl | 1 + arch/m68k/kernel/syscalls/syscall.tbl | 1 + arch/microblaze/kernel/syscalls/syscall.tbl | 1 + arch/mips/kernel/syscalls/syscall_n32.tbl | 1 + arch/mips/kernel/syscalls/syscall_n64.tbl | 1 + arch/mips/kernel/syscalls/syscall_o32.tbl | 1 + arch/parisc/kernel/syscalls/syscall.tbl | 1 + arch/powerpc/kernel/syscalls/syscall.tbl | 1 + arch/s390/kernel/syscalls/syscall.tbl | 1 + arch/sh/kernel/syscalls/syscall.tbl | 1 + arch/sparc/kernel/syscalls/syscall.tbl | 1 + arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + arch/xtensa/kernel/syscalls/syscall.tbl | 1 + include/linux/syscalls.h | 2 ++ include/uapi/asm-generic/unistd.h | 5 ++++- 20 files changed, 25 insertions(+), 2 deletions(-) diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl index ad37569d0507..3eaf0c8ffe9c 100644 --- a/arch/alpha/kernel/syscalls/syscall.tbl +++ b/arch/alpha/kernel/syscalls/syscall.tbl @@ -492,3 +492,4 @@ 560 common set_mempolicy_home_node sys_ni_syscall 561 common cachestat sys_cachestat 562 common fchmodat2 sys_fchmodat2 +563 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl index c572d6c3dee0..08fc73bf211c 100644 --- a/arch/arm/tools/syscall.tbl +++ b/arch/arm/tools/syscall.tbl @@ -466,3 +466,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index bd77253b62e0..63a8a9c4abc1 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -39,7 +39,7 @@ #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) -#define __NR_compat_syscalls 453 +#define __NR_compat_syscalls 455 #endif #define __ARCH_WANT_SYS_CLONE diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 78b68311ec81..384c121dfbdf 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -911,6 +911,8 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node) __SYSCALL(__NR_cachestat, sys_cachestat) #define __NR_fchmodat2 452 __SYSCALL(__NR_fchmodat2, sys_fchmodat2) +#define __NR_inotify_add_watch_at 454 +__SYSCALL(__NR_inotify_add_watch_at, sys_inotify_add_watch_at) /* * Please add new compat syscalls above this comment and update diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl index 83d8609aec03..8312606fdcd7 100644 --- a/arch/ia64/kernel/syscalls/syscall.tbl +++ b/arch/ia64/kernel/syscalls/syscall.tbl @@ -373,3 +373,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl index 259ceb125367..51de66ce3e9b 100644 --- a/arch/m68k/kernel/syscalls/syscall.tbl +++ b/arch/m68k/kernel/syscalls/syscall.tbl @@ -452,3 +452,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl index a3798c2637fd..991a0ae1c4be 100644 --- a/arch/microblaze/kernel/syscalls/syscall.tbl +++ b/arch/microblaze/kernel/syscalls/syscall.tbl @@ -458,3 +458,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl index 152034b8e0a0..98a7c7c45293 100644 --- a/arch/mips/kernel/syscalls/syscall_n32.tbl +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl @@ -391,3 +391,4 @@ 450 n32 set_mempolicy_home_node sys_set_mempolicy_home_node 451 n32 cachestat sys_cachestat 452 n32 fchmodat2 sys_fchmodat2 +454 n32 inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl index cb5e757f6621..8751f6de6b96 100644 --- a/arch/mips/kernel/syscalls/syscall_n64.tbl +++ b/arch/mips/kernel/syscalls/syscall_n64.tbl @@ -367,3 +367,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 n64 cachestat sys_cachestat 452 n64 fchmodat2 sys_fchmodat2 +454 n64 inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl index 1a646813afdc..a899807b3b64 100644 --- a/arch/mips/kernel/syscalls/syscall_o32.tbl +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl @@ -440,3 +440,4 @@ 450 o32 set_mempolicy_home_node sys_set_mempolicy_home_node 451 o32 cachestat sys_cachestat 452 o32 fchmodat2 sys_fchmodat2 +454 o32 inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl index e97c175b56f9..325885297d5d 100644 --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -451,3 +451,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl index 20e50586e8a2..132876dc7aa5 100644 --- a/arch/powerpc/kernel/syscalls/syscall.tbl +++ b/arch/powerpc/kernel/syscalls/syscall.tbl @@ -539,3 +539,4 @@ 450 nospu set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl index 0122cc156952..b6d29996190c 100644 --- a/arch/s390/kernel/syscalls/syscall.tbl +++ b/arch/s390/kernel/syscalls/syscall.tbl @@ -455,3 +455,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl index e90d585c4d3e..337875016443 100644 --- a/arch/sh/kernel/syscalls/syscall.tbl +++ b/arch/sh/kernel/syscalls/syscall.tbl @@ -455,3 +455,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index 4ed06c71c43f..9634f81be406 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -498,3 +498,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl index 2d0b1bd866ea..de83d6861429 100644 --- a/arch/x86/entry/syscalls/syscall_32.tbl +++ b/arch/x86/entry/syscalls/syscall_32.tbl @@ -457,3 +457,4 @@ 450 i386 set_mempolicy_home_node sys_set_mempolicy_home_node 451 i386 cachestat sys_cachestat 452 i386 fchmodat2 sys_fchmodat2 +454 i386 inotify_add_watch_at sys_inotify_add_watch_at diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl index 1d6eee30eceb..fdf0128fffce 100644 --- a/arch/x86/entry/syscalls/syscall_64.tbl +++ b/arch/x86/entry/syscalls/syscall_64.tbl @@ -375,6 +375,7 @@ 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 453 64 map_shadow_stack sys_map_shadow_stack +454 common inotify_add_watch_at sys_inotify_add_watch_at # # Due to a historical design error, certain syscalls are numbered differently diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl index fc1a4f3c81d9..43cbdd8f369c 100644 --- a/arch/xtensa/kernel/syscalls/syscall.tbl +++ b/arch/xtensa/kernel/syscalls/syscall.tbl @@ -423,3 +423,4 @@ 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 +454 common inotify_add_watch_at sys_inotify_add_watch_at diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 22bc6bc147f8..63349ee93cb3 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -379,6 +379,8 @@ asmlinkage long sys_fcntl64(unsigned int fd, asmlinkage long sys_inotify_init1(int flags); asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask); +asmlinkage long sys_inotify_add_watch_at(int fd, int dfd, const char __user *path, + u32 mask); asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd); asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index abe087c53b4b..f84bdb800352 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -823,8 +823,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat) #define __NR_fchmodat2 452 __SYSCALL(__NR_fchmodat2, sys_fchmodat2) +#define __NR_inotify_add_watch_at 454 +__SYSCALL(__NR_inotify_add_watch_at, sys_inotify_add_watch_at) + #undef __NR_syscalls -#define __NR_syscalls 453 +#define __NR_syscalls 455 /* * 32 bit systems traditionally used different