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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 D4212C433B4 for ; Tue, 18 May 2021 14:22:14 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E5C961209 for ; Tue, 18 May 2021 14:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E5C961209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wthMHHkGJTWKruXN86masIdeL2ZZMbq8PBokFLA+tTg=; b=d6hHhPvSRILkLRJeNnl+2GVmB QtLiLyTmDQYR8V4IQpogDUbU6zT2hjqh6z6e4HFypKeWZrIyVZcFxWW/Zmw1QuOkZr74MHXz3gpGS rfAFDR9+3mBFm7ed0uJJ11BX7YcGvqSNwCXkS5OvsEruwQ2RyiAjUCJshZzsyz/L/NBW1r2td9w9K tgZY6J2j3Cok/MnCUViJ7CorbnoxZc0SB3FZiFrklc5F3pIn1LO09cd5FNUjC+GdE4n1pwQQeAi0V gzTTGRfylqoH6q423ZreTm7fkIN4Vg+ZaczmwwJ6bOCdgqdAEny6k0WlCQukBQcjHqiUdZ0uSOtME jI57CabUg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lj0ZY-000zsN-7Y; Tue, 18 May 2021 14:19:50 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj0Yv-000zjh-A6; Tue, 18 May 2021 14:19:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AS2wcknP2BrtIZszYf9e+6x75C1Et0AM5k4dyrQ49vM=; b=RiAolcUc6AAE6f9NVZlGf+LtVK U/fFB65UJJ/QuwNjFmetUVAaVu448UdHCn7khZSgcJPUknE4Zrd3oPtAG9DXgPac7AdrxkV+uWiCC j21wAhMO8vS98PM0CwvEE3bI7XHV3qnqyMA5FVSbprzR+iiPedpXUIBEs9bowophdzEKlBzVAlGF9 HFoD/NNcy16MvaWzRGVeiOv6JHwFxWvEfoeyJ0L0Bkf1R2absUIFZ1ALJOGXRp+6r1l38g50Oyaqb KXEwqllsqy6deI3LeyTKpTBosoGf9oTix1rWB4bU9Y9mqHINMXkn11tMpPo6E2bh7BO7N9cuX79i4 z2fgbh8Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj0Ys-00EihX-LL; Tue, 18 May 2021 14:19:07 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E74366135F; Tue, 18 May 2021 14:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621347544; bh=nrAiIQTKJqiGVWRN+fZiK7vfTpl+mh6GdbMLf8QWU6M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uO2nCdiW0NvUD3Oq2cx82BZG1aOLpwqISU2mJf1pn/41gmWeJwtJ3KwTWkPZOSffp qtEeD+G01WQE2a6OLg6viaogVrTcoartVG2vRtYwIcq9FSRcV1egrAvYdgmA/X3tdB m+P5YNb/2zoWb2ENaduSUYHTB0469Qb0Kj+2op5ABqhzmU5gjMCmQF2DbOGijvmPsZ xCjeQ8txdUZYsP5uPuGPMjh0ckotg/LymHT4x6ecHUAo8zYTM6uAVSt2umBf2+GizG +1ADzfu8zRcpU2xe1Of94E5AHIjxvrL1zbXxtiJz14yqM7TivZbQbYGDShT6WINj/N peuu9A0lgQRXg== Received: by mail-wr1-f47.google.com with SMTP id z17so10407151wrq.7; Tue, 18 May 2021 07:19:04 -0700 (PDT) X-Gm-Message-State: AOAM533UUL+Y1xqmF1DVD7QEsrqLzEOPm6ibA2hTVmeZWorC+U6dBOha YrbTRlYOh6gniy9AyUSS5m7An1dsq2f1IcrqJwA= X-Google-Smtp-Source: ABdhPJzFpyp1CPVwvL2JvI3KmHNWPOcV2naQQAKLVgR48kQxz5AWGK/oLA+ez9stiNWkfs+BeuLGyXYYTicjDNU1kEw= X-Received: by 2002:a5d:6dc4:: with SMTP id d4mr7586717wrz.105.1621347543476; Tue, 18 May 2021 07:19:03 -0700 (PDT) MIME-Version: 1.0 References: <20210517203343.3941777-1-arnd@kernel.org> <20210517203343.3941777-2-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Tue, 18 May 2021 16:17:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/4] kexec: simplify compat_sys_kexec_load To: "Eric W. Biederman" Cc: linux-arch , Christoph Hellwig , Alexander Viro , Andrew Morton , Borislav Petkov , Brian Gerst , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Linux ARM , Linux Kernel Mailing List , Linux-MM , kexec@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_071906_755567_32840E7C X-CRM114-Status: GOOD ( 28.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 18, 2021 at 4:05 PM Arnd Bergmann wrote: > > On Tue, May 18, 2021 at 3:41 PM Eric W. Biederman wrote: > > > > Arnd Bergmann writes: > > > > > From: Arnd Bergmann KEXEC_ARCH_DEFAULT > > > > > > The compat version of sys_kexec_load() uses compat_alloc_user_space to > > > convert the user-provided arguments into the native format. > > > > > > Move the conversion into the regular implementation with > > > an in_compat_syscall() check to simplify it and avoid the > > > compat_alloc_user_space() call. > > > > > > compat_sys_kexec_load() now behaves the same as sys_kexec_load(). > > > > Nacked-by: "Eric W. Biederman" > >KEXEC_ARCH_DEFAULT > > The patch is wrong. > > > > The logic between the compat entry point and the ordinary entry point > > are by necessity different. This unifies the logic and breaks the compat > > entry point. > > > > The fundamentally necessity is that the code being loaded needs to know > > which mode the kernel is running in so it can safely transition to the > > new kernel. > > > > Given that the two entry points fundamentally need different logic, > > and that difference was not preserved and the goal of this patchset > > was to unify that which fundamentally needs to be different. I don't > > think this patch series makes any sense for kexec. > > Sorry, I'm not following that explanation. Can you clarify what different > modes of the kernel you are referring to here, and how my patch > changes this? I think I figured it out now myself after comparing the two functions: --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -269,7 +269,8 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, /* Verify we are on the appropriate architecture */ if (((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH) && - ((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT)) + (in_compat_syscall() || + ((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT))) return -EINVAL; /* Because we write directly to the reserved memory Not sure if that's the best way of doing it, but it looks like folding this in restores the current behavior. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel