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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE85C433EF for ; Fri, 8 Oct 2021 11:47:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 E91A560F6D for ; Fri, 8 Oct 2021 11:47:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E91A560F6D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9EA541684; Fri, 8 Oct 2021 13:46:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9EA541684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633693621; bh=OzX9OQSslrumvlbzKLrmCg/qXhmv5PNZPjIH3rQ4RtA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rcuJdWOoJqtxp5yPOTMxcCpQYXp0cn1uia697CoOB/O8ld7XcBH+3iSi3Z38bmxs+ frl3gDuZQSDtRiKdncsJL/dR921OefhVMovqT9lp3sgZWC0Il/w3HbtaY1ZJbxgXFM SCNUOxjkaj0PVw0ZxhCw167lUUGvs4mGLtbtG0RE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2EBC3F80240; Fri, 8 Oct 2021 13:46:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8E82EF80229; Fri, 8 Oct 2021 13:46:09 +0200 (CEST) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 281F1F80229 for ; Fri, 8 Oct 2021 13:46:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 281F1F80229 Received: from mail-wr1-f53.google.com ([209.85.221.53]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MowbA-1n7Z241OxS-00qVJj for ; Fri, 08 Oct 2021 13:46:02 +0200 Received: by mail-wr1-f53.google.com with SMTP id o20so28876088wro.3 for ; Fri, 08 Oct 2021 04:46:01 -0700 (PDT) X-Gm-Message-State: AOAM530LClzP5RzhNU0w3/SZki5zzyft7ZbeSWfoUxUOkItPQHJlWLqG m5sNwC5T8vNeWkY0H5UGUh99msj/OWD7+GJSrdA= X-Google-Smtp-Source: ABdhPJyHo72NGMxQuQyxjtT+5nQCpXx6NLGzNhCQiYTfEj1ygK3qKqvFSanv94vqY7Xo8TEpIVxc2neyx1BN+BCLKCI= X-Received: by 2002:a05:6000:1561:: with SMTP id 1mr3318468wrz.369.1633693561692; Fri, 08 Oct 2021 04:46:01 -0700 (PDT) MIME-Version: 1.0 References: <20191211212025.1981822-1-arnd@arndb.de> <20191211212025.1981822-9-arnd@arndb.de> <29QBMJU8DE71E.2YZSH8IHT5HMH@mforney.org> <20211007160634.GB7074@brightrain.aerifal.cx> <20211007165158.GC7074@brightrain.aerifal.cx> In-Reply-To: From: Arnd Bergmann Date: Fri, 8 Oct 2021 13:45:45 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [musl] Re: [alsa-devel] [PATCH v7 8/9] ALSA: add new 32-bit layout for snd_pcm_mmap_status/control To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:Ah14Rz8ustNsdnAr1Tjlgz/ZmZcl8PsfUeHuzMG5qA5dYsDLPmI ZouGrYBGRXaAoaGyUvoGoBNWz1x55usUBxhy+qBoAvXFxT+eN3qV+qjwZIZnQBNyYQ+AbpW E/Yl5d1y8e1ERl2Srd09U0W4yEfX4icjUEZ8sY/DDxSqnPaL5sGuaZ6wcySzsn7NSsS3PpA QlY3ReGXGybqJy0YP3ghw== X-UI-Out-Filterresults: notjunk:1;V03:K0:3ug/viv/Khw=:c+KFYuo41LljZkE1HVu2Nn BlvN+BNL1xDLH26qtSKcJf1Vd9I6V/Nv/oPt20neuh+Wh3BS5wzSWWzZ15T2zoIucip33Z4rm PuR7tkGw8xy9I++vewuMhdvLiIfKo5mVDuOnDcdQHD59QJwfRTUUgow/mzflZuYXY/rFE0xlx r5+5ylH9YqSWYbJ2LWn/JR+SdMRuDqGBpD49dk8Gyq2/nxmUocbDtkdrWeb+tWMb4z7oz1LEU IF2WhR7NKGwbSf+JRvkb6RYWLAzw3r3dFCTDzsW4Ahbx59SNA4QMDTWcbEcnbfAvB7xRVdr2z A8z7spcWeGxWf/maCVv5O0LJ/HwQmoCMPNhmaUbSaaUrAhh9dQurHiSgkig3YyzWM2bDNcNPj VRqmLRk7p8t5HHPYMchfwcy6ppS6kMjo3xX/3x4CbcFuUg12v8a+lIK9k+jQSUSE5wQs+H14t Ejf6T4iRqXbjG68+YPrecRMNFBMuGp7TCiDWMGQVtVNFgGe5/MadUlZmy4dweVvQA6k5BH4YE vKq+46tzBVNB7WS6uYArmIwlwwFJN4Bv2E6cEtcI2NaM9DerT7DCxRm/JTKD0d7L590kYKbk9 Jf2SG/VwCYD2S3ci2C3bDN+2G+1Lt236UtyEiuHi3BF9eImPatjABtS+mqTZ6p0Lw/YGqMiCy KigFrdUpqAgt4zjX2R7AuxxhQBJHFzaGaUnufvlb29lMXpaJwznfG8+6BVW/F8ohmJXg4gulH m8SYsJqLX5bmYM5UDz8LW5hjPCV2zszoxsNwV3oy/jPBn0xiFCRL0w1dvwpdBdlkb4fys5zDa bWgQ4t+4jQQ6laAiiy3vHjUX79KbX7kbkqvGFcz6RQn8bS31bV5FCiU2sy05kF5E+C8tNlY8g 06JNqEK30iyC8yOF7xfQ== Cc: ALSA Development Mailing List , Rich Felker , Arnd Bergmann , Baolin Wang , y2038 Mailman List , Linux Kernel Mailing List , Takashi Iwai , Michael Forney , Mark Brown , Baolin Wang X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, Oct 8, 2021 at 1:11 PM Takashi Iwai wrote: > On Fri, 08 Oct 2021 11:24:39 +0200, Arnd Bergmann wrote: > > > > I've tried to understand this part of musl's convert_ioctl_struct(), but I just > > can't figure out whether it does the conversion based the on the layout that > > is currently used in the kernel, or based on the layout we should have been > > using, and would use with the above fix. Rich, can you help me here? > > So, at this moment, I'm not sure whether we should correct the struct > at all. This will lead to yet more breakage, and basically the struct > itself *works* -- the only bug is in 32bit compat handling in the > kernel (again). I'm still unsure if the musl fallback code is correct or not. > The below is a revised kernel patch (again untested), just correcting > the behavior of 32bit compat mode. 32bit apps on 32bit kernel work > fine as is, as well as 64bit apps on 64bit kernel. Right, this should cover all cases of the ioctl itself misbehaving. In addition, we still need to disallow the mmap() interface on compat kernels then. Strictly speaking, we could allow the snd_pcm_mmap_status but not snd_pcm_mmap_control to be mapped, but I'm not sure if that's better than disallowing both. Arnd 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8E17C433FE for ; Fri, 8 Oct 2021 11:47:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CAF2860F58 for ; Fri, 8 Oct 2021 11:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242994AbhJHLtX (ORCPT ); Fri, 8 Oct 2021 07:49:23 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:51239 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242880AbhJHLr6 (ORCPT ); Fri, 8 Oct 2021 07:47:58 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1N7AEs-1mpUBR464C-017Tsv for ; Fri, 08 Oct 2021 13:46:02 +0200 Received: by mail-wr1-f50.google.com with SMTP id t8so29118571wri.1 for ; Fri, 08 Oct 2021 04:46:01 -0700 (PDT) X-Gm-Message-State: AOAM5325/qBWdybYF81mMoVJQxIkXJHfvZWj1/b00DQdrDupZij9/Ynv sYBRDjleArPqQtMtHSQO76AFrGdykxeaZx5DTJ8= X-Google-Smtp-Source: ABdhPJyHo72NGMxQuQyxjtT+5nQCpXx6NLGzNhCQiYTfEj1ygK3qKqvFSanv94vqY7Xo8TEpIVxc2neyx1BN+BCLKCI= X-Received: by 2002:a05:6000:1561:: with SMTP id 1mr3318468wrz.369.1633693561692; Fri, 08 Oct 2021 04:46:01 -0700 (PDT) MIME-Version: 1.0 References: <20191211212025.1981822-1-arnd@arndb.de> <20191211212025.1981822-9-arnd@arndb.de> <29QBMJU8DE71E.2YZSH8IHT5HMH@mforney.org> <20211007160634.GB7074@brightrain.aerifal.cx> <20211007165158.GC7074@brightrain.aerifal.cx> In-Reply-To: From: Arnd Bergmann Date: Fri, 8 Oct 2021 13:45:45 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [musl] Re: [alsa-devel] [PATCH v7 8/9] ALSA: add new 32-bit layout for snd_pcm_mmap_status/control To: musl@lists.openwall.com Cc: Arnd Bergmann , Rich Felker , Michael Forney , ALSA Development Mailing List , Takashi Iwai , Baolin Wang , y2038 Mailman List , Linux Kernel Mailing List , Mark Brown , Baolin Wang Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:+hFh6TMhzooG835U1FXgefHtJnVouZBVAOuU5np591EBrvwkVqB /Ja6iPzKmnOLDf1JNrA0yLTl5aUkhJsA19gwecRxwo3LDCTIC3112jhUO4n7yajGETc+wIK P4BalAzAcc6gAUNemrDeOsBAT2e+5nnt3Jo2J+Ykyc2FP+tJDI7GxbQCZRR9Pk/7dHLyA8t KJmxmnbOx4l4KqmgNRqrA== X-UI-Out-Filterresults: notjunk:1;V03:K0:r9wJz8rfA4s=:FS5F5UyAlXWqzHTC2rHBIh zFJMXOQqk5WXTvOW22svwUArEdTib/yrnP+ROgDCsP1j1T9gqnoeKF0qRU/zImMv1937oayTr 5RSZgWwOpH0Lnr7r+TN9tiVkMsP7kLyZ8n3TeZj5Bf2zRAaUps2qS2m+kw02trybQ83wetl7X RGbcKsu64yOhJotfspnZOW+DPfsn6shH2phb5xjCe8god73QWvOTmPaa4pCNxlguQljLUTDUY 9U1BaHyN059r4r32UHREPLygaN9+Drfe4rZqvqRkOdecdyfPXps6Nhq4EWNgKsr4m0VUGpfoA X1Dbc4T88gjs6U3OwXOeFJs6PvlCy4VxILsB1OQNbetZcDZ9qdHgfKxEwlHYms2c0mnTyPrOz 2xVrPPcQjLfTchM0XCU5BdrblT5vBlTjAu8tINGzMqASG9hCWQMgxfm8QWRUE5M+ctrjXto0x vnLpNRpDsSJB1w89jY4ba94C8js1YlRawof/tdzo6UMNT3ixFMk9SBHt96QoeJahxQWSZEHtA OQfboLzQiwfjmdBBMgmITPmmZMMSOzi/mMaPM1GckHPdNcUqZBzqVTDQlg2bY1y9osutcd5Qn oozmSa435UmJsykZWcDVt8FYmAxpFRyHZMbRDGnHH7CkNS7kT+PdsJsr00RJwI7qG2yN7XODn QlzTujy7dyWhbZ3uJWlINK4eilSfGOjqlCnVUlaPBWvdpUeEx6BRJdawWGRS8MT7ZmaUrNshO MkM/WQdYA1UbNo+igC4dPachrWAimyufKMHj8g== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 8, 2021 at 1:11 PM Takashi Iwai wrote: > On Fri, 08 Oct 2021 11:24:39 +0200, Arnd Bergmann wrote: > > > > I've tried to understand this part of musl's convert_ioctl_struct(), but I just > > can't figure out whether it does the conversion based the on the layout that > > is currently used in the kernel, or based on the layout we should have been > > using, and would use with the above fix. Rich, can you help me here? > > So, at this moment, I'm not sure whether we should correct the struct > at all. This will lead to yet more breakage, and basically the struct > itself *works* -- the only bug is in 32bit compat handling in the > kernel (again). I'm still unsure if the musl fallback code is correct or not. > The below is a revised kernel patch (again untested), just correcting > the behavior of 32bit compat mode. 32bit apps on 32bit kernel work > fine as is, as well as 64bit apps on 64bit kernel. Right, this should cover all cases of the ioctl itself misbehaving. In addition, we still need to disallow the mmap() interface on compat kernels then. Strictly speaking, we could allow the snd_pcm_mmap_status but not snd_pcm_mmap_control to be mapped, but I'm not sure if that's better than disallowing both. Arnd