Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4488457ivc; Tue, 3 Nov 2020 13:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJy78aAbagGG00X+JcK5AXQ3zueGnRZujTs36UL23Uhvy7+flADtlnLHDLS561wIKsG8ac3W X-Received: by 2002:a17:906:2a4b:: with SMTP id k11mr19086168eje.467.1604438527291; Tue, 03 Nov 2020 13:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438527; cv=none; d=google.com; s=arc-20160816; b=PUYxFZc2qRz5PSD5YvLgBKHgDcPiIyjg4FsdDGJjMsiEnWCUa56kduj9gzA6S5oJuR MA75k2i9dpYKfEdkBuTuj9d91q7nnlhNyYlw96sRnUuaO2tSOyQ+7NdB4FDdR4TFolm8 gpfQf/0UT8kioDVfSKoUf2Xxr+/AyFHjqcqiSFQ7ADf9CKBJqGItYLe1sOQxS05ZvEjN xWhkdJtBAj5z1m6sBtc0hHqjU/raV12nRKWR3AKp5MhA3cD+rFG/YWOPFv17LWpRhD37 XEYsoqwfx6bbgs4/OhPtmzkOy14eNBhSTszPZluMaCEuZDcb3Lks1f1DluWT2OclqT4x lQOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tstgg3vKoiDwsRipOpBFOIS+Y4+ArIdAGlRHw0sw9m8=; b=pPXpiDIUVXforoh2uZIjlklNRBqIVViwHLZc+eYiWr88YXYaTYuaS9VHJgmXVcYtiZ ramUzIxrxulzxbXWEZdklG6p0RmVaGqU5kq3mIV9BQadtAG2Pg6oupbxrlK0OVVOBdDH /CFS1BAim4WC0Jn4aqgsweJnuTryvpJ4FBcbLu8n++aTiAmrdMRFFv4vGYlxEEjTNhBl nPBHNZZAbdBuUc5EF9rxSUHaFE7o9nS2NTSWrVAJLQ7sm5hIYSQTqf450rD8NF33fp0w 4qf/htVj05QwRWYaoT2ZUExeQ4lwDw5ubxChKuvg4Q3jVIdw6jLy0QYVR7IpQD+79V3u Zz/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jasiak-xyz.20150623.gappssmtp.com header.s=20150623 header.b=yERDrGyW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si5680380eds.334.2020.11.03.13.21.43; Tue, 03 Nov 2020 13:22:07 -0800 (PST) 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=@jasiak-xyz.20150623.gappssmtp.com header.s=20150623 header.b=yERDrGyW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388825AbgKCVSD (ORCPT + 99 others); Tue, 3 Nov 2020 16:18:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731398AbgKCVR7 (ORCPT ); Tue, 3 Nov 2020 16:17:59 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DCAEC0617A6 for ; Tue, 3 Nov 2020 13:17:53 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id d24so20591312ljg.10 for ; Tue, 03 Nov 2020 13:17:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jasiak-xyz.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=tstgg3vKoiDwsRipOpBFOIS+Y4+ArIdAGlRHw0sw9m8=; b=yERDrGyWs9LQaBc8vwTXKGtVCnBlE3wL/3bg3Dmyy7QT/M5SwRSfUaUTdKWJWntjLe Ro9kg3N03rypCKnbDYXnxiEfcYaQsF+tSx4fMNuwNIukZx0ukRnVS+me/VvpwUZzAyP0 aQDKbrr7bji2ltGAkv/GpzEZAMLt4TLueRLRsFG317F8qiLMp2XYHiSgRFV9d7fIn351 XnH+n3l3CNcyOUKizAzFS/PvmfyeacEAhaKKJymK+Us5UPAaPsloMulN4Thzoren2M29 bhAMTyFwhEby/wO/cZFX+gwoTksjDZ+yLcCv5edSuzUwpgitb3TzbFSMspWpuzDeCBa+ dxEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=tstgg3vKoiDwsRipOpBFOIS+Y4+ArIdAGlRHw0sw9m8=; b=f1SoX1tddIyl5rsgknL3IFlny3clPzf9M++vkQe5J9QFkNfz0XHAvOhrH4ROUVTh6m b+o1fHHE6d+B7fDeNxgsTOkgMYWJg16gwFGOIcidiIYZDVXeRZ4c0AA8mvuyv1ZMRho5 hkJmZYF1whEtJzvxVnNCk9MeSsGlzjBTHPFEF3g5nnY2+iapmRj7ZBbHny+/HUnsAbd0 dS8MKPYx42TzBKjibdXEeR/lGOhlnnOh0yS3MpPM8DlqDSmHop+Zs/RFUkxTfBRHC5k/ L5T4BwwHv/92TrkXYqPWJN6Xc4XN70LvtzbrKbpu30j+GJ5wa1oXy0mgBUFm/Z9zuFXi cwRA== X-Gm-Message-State: AOAM530bgA+EoRoC++ov52JGTyNaaGb/R59svZw0tt3dPHXYEkIidqWq FPNWHp8tV/kFisB8bPw8EmYymQ== X-Received: by 2002:a2e:b0cc:: with SMTP id g12mr10210749ljl.403.1604438271390; Tue, 03 Nov 2020 13:17:51 -0800 (PST) Received: from gmail.com (wireless-nat-78.ip4.greenlan.pl. [185.56.211.78]) by smtp.gmail.com with ESMTPSA id f78sm4271820lfd.271.2020.11.03.13.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 13:17:50 -0800 (PST) Date: Tue, 3 Nov 2020 22:17:47 +0100 From: =?utf-8?B?UGF3ZcWC?= Jasiak To: Jan Kara Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Brian Gerst , Andy Lutomirski Subject: Re: PROBLEM: fanotify_mark EFAULT on x86 Message-ID: <20201103211747.GA3688@gmail.com> References: <20201101212738.GA16924@gmail.com> <20201102122638.GB23988@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201102122638.GB23988@quack2.suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I have written small patch that fixes problem for me and doesn't break x86_64. diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 3e01d8f2ab90..cf0b97309975 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -1285,12 +1285,27 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, return ret; } +#if defined(CONFIG_X86) && !defined(CONFIG_64BIT) +SYSCALL_DEFINE6(fanotify_mark, + int, fanotify_fd, unsigned int, flags, __u32, mask0, + __u32, mask1, int, dfd, const char __user *, pathname) +{ + return do_fanotify_mark(fanotify_fd, flags, +#ifdef __BIG_ENDIAN + ((__u64)mask0 << 32) | mask1, +#else + ((__u64)mask1 << 32) | mask0, +#endif + dfd, pathname); +} +#else SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags, __u64, mask, int, dfd, const char __user *, pathname) { return do_fanotify_mark(fanotify_fd, flags, mask, dfd, pathname); } +#endif #ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE6(fanotify_mark, -- Paweł Jasiak