From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AED28C63777 for ; Mon, 30 Nov 2020 22:22:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 381962073C for ; Mon, 30 Nov 2020 22:22:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j+CWilT1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbgK3WWA (ORCPT ); Mon, 30 Nov 2020 17:22:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728649AbgK3WWA (ORCPT ); Mon, 30 Nov 2020 17:22:00 -0500 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C44C0613CF; Mon, 30 Nov 2020 14:21:20 -0800 (PST) Received: by mail-il1-x144.google.com with SMTP id x15so12963128ilq.1; Mon, 30 Nov 2020 14:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D1Ha7vRV9nbOHPM4HMdUKEIihDTBwTSbMBbTV7hrVUI=; b=j+CWilT1FBY6fMM8ajfbaA+07dZlElLPFHU1/04IJ7sn788bbTuQAzgcca2pxx21Rb SOwcGuhgzpr+fIpnt3+ScpdottCpVtVJS/l0fJDcY75qhGr9yHZztwDCXJrWaubPKuoU +rbOwZFQxdEIe0UkB+VlRZnE7S7PSYHfCXJVMDtLluJ+uWkfSqQAXCAPo9MAu8VsCxQc EK3kkCP27xhQX9D7jMuV/WPb6Fx7ZbytA6L9D+Dn/Trm1NlbhT9U25hpHR1+d9eXi0aP gTd19weVNs7ffk+nPo19gH1QwrRzj9h0QRDVSPCPy1BW7fkY/WCzP3w+X0JvZpfwWa7w DE+A== 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=D1Ha7vRV9nbOHPM4HMdUKEIihDTBwTSbMBbTV7hrVUI=; b=Qb73CK9+8bm9h8UG2SBa2Qk7hk37HmedwU4PBunkKuCt+f6qjBnwsOjN5apXoUAxSx iW4hwfz/YUkNpkGZ9ivS5eW7VqeHhl24K8yT+8JELS0+l7CFU+DnBg0EW/XjcjuaLg5l zj3L6lHax1LPmDZC7pnDCge0nAO+25mFFDaw7AzWXeT2fDCkXhsYObK32YHI9vEmBx/U GYwktO+sVp9q2HSX3ccj15ihnHvppOP1wMmtk2yzi++dTlaD/4PFMWlQi5LbaXM1qvCg iLxwnXSgb0dx73jRb6YKZ/kfXgw0yyqgUom0WCeRsKALK979Fmg0Wssxb1UHnzHBCLIw 2KWw== X-Gm-Message-State: AOAM532JYXm/az02HaCdFNo28iLu1+yiDnPm8gjJWj1IpAoXlMMXSPMS 0mv0d2smFHIci0q2iGqlrW6v3JD3GRHs0UXSCw== X-Google-Smtp-Source: ABdhPJzQyDinxFmY7Qof9roEYRhRR7LsD+Vvl/77JXQu3t8Itz1DUfq/AeLqCIizcLtgMuYQhS5IdB8P89i1Ib8YOu4= X-Received: by 2002:a05:6e02:603:: with SMTP id t3mr20342033ils.11.1606774879479; Mon, 30 Nov 2020 14:21:19 -0800 (PST) MIME-Version: 1.0 References: <20201126155246.25961-1-jack@suse.cz> In-Reply-To: From: Brian Gerst Date: Mon, 30 Nov 2020 17:21:08 -0500 Message-ID: Subject: Re: [PATCH] fanotify: Fix fanotify_mark() on 32-bit x86 To: Andy Lutomirski Cc: Jan Kara , linux-arch , Christoph Hellwig , Al Viro , Will Deacon , Catalin Marinas , Linux FS Devel , X86 ML , Borislav Petkov , Thomas Gleixner , stable Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Fri, Nov 27, 2020 at 7:36 PM Andy Lutomirski wrote: > > On Fri, Nov 27, 2020 at 2:30 PM Brian Gerst wrote: > > > > On Fri, Nov 27, 2020 at 1:13 PM Andy Lutomirski wrote: > > > > > > On Thu, Nov 26, 2020 at 7:52 AM Jan Kara wrote: > > > > > > > > Commit converting syscalls taking 64-bit arguments to new scheme of compat > > > > handlers omitted converting fanotify_mark(2) which then broke the > > > > syscall for 32-bit x86 builds. Add missed conversion. It is somewhat > > > > cumbersome since we need to keep the original compat handler for all the > > > > other 32-bit archs. > > > > > > > > > > This is stupendously ugly. I'm not really sure how this is supposed > > > to work on any 32-bit arch. I'm also not sure whether we should > > > expect the SYSCALL_DEFINE macros to figure this out by themselves. > > > > It works on 32-bit arches because the compiler implicitly uses > > consecutive input registers or stack slots for 64-bit arguments, and > > some arches have alignment requirements that result in hidden padding. > > x86-32 is different now because parameters are passed in via pt_regs, > > and the 64-bit value has to explicitly be reassembled from the high > > and low 32-bit values, just like in the compat case. > > > > That was my guess. > > > I think the simplest way to handle this is add a wrapper in > > arch/x86/kernel/sys_ia32.c with the other fs syscalls that need 64-bit > > args. That keeps this mess out of general code. > > > Want to send a patch? I settled on doing something along the same line as Jan, but in a more generic way that lays the groundwork for converting more of these arch-specific compat wrappers to a generic wrapper. Patch coming soon. -- Brian Gerst