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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 3744FC388F9 for ; Thu, 22 Oct 2020 20:06:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC24C24182 for ; Thu, 22 Oct 2020 20:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S370857AbgJVUGo (ORCPT ); Thu, 22 Oct 2020 16:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S370843AbgJVUGn (ORCPT ); Thu, 22 Oct 2020 16:06:43 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F9B1C0613CE; Thu, 22 Oct 2020 13:06:43 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVgqz-006SmZ-1W; Thu, 22 Oct 2020 20:06:29 +0000 Date: Thu, 22 Oct 2020 21:06:29 +0100 From: Al Viro To: Nick Desaulniers Cc: Arnd Bergmann , David Laight , Christoph Hellwig , David Hildenbrand , Greg KH , "kernel-team@android.com" , Andrew Morton , Jens Axboe , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" Message-ID: <20201022200629.GX3576660@ZenIV.linux.org.uk> References: <5fd6003b-55a6-2c3c-9a28-8fd3a575ca78@redhat.com> <20201022132342.GB8781@lst.de> <8f1fff0c358b4b669d51cc80098dbba1@AcuMS.aculab.com> <20201022192458.GV3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201022192458.GV3576660@ZenIV.linux.org.uk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Thu, Oct 22, 2020 at 08:24:58PM +0100, Al Viro wrote: > Depending upon the calling conventions, compiler might do truncation in caller or > in a callee, but it must be done _somewhere_. Unless I'm misreading AAPCS64, "Unlike in the 32-bit AAPCS, named integral values must be narrowed by the callee rather than the caller" in 6.4.2 means that callee must not _not_ expect the upper 32 bits of %x0..%x7 to contain anything valid for 32bit arguments and it must zero-extend %w0..%w7 when passing that to something that expects a 64bit argument. On inlining it should be the same situation as storing unsigned int argument into unsigned long local variable and working with that - if void f(unsigned int w) { unsigned long x = w; printf("%lx\n", x); } ends up passing %x0 to printf, it's an obvious bug - it must do something like uxtw x0, w0 first. What am I missing here? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 22 Oct 2020 21:06:29 +0100 From: Al Viro Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" Message-ID: <20201022200629.GX3576660@ZenIV.linux.org.uk> References: <5fd6003b-55a6-2c3c-9a28-8fd3a575ca78@redhat.com> <20201022132342.GB8781@lst.de> <8f1fff0c358b4b669d51cc80098dbba1@AcuMS.aculab.com> <20201022192458.GV3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201022192458.GV3576660@ZenIV.linux.org.uk> Sender: Al Viro List-ID: To: Nick Desaulniers Cc: Arnd Bergmann , David Laight , Christoph Hellwig , David Hildenbrand , Greg KH , "kernel-team@android.com" , Andrew Morton , Jens Axboe , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" On Thu, Oct 22, 2020 at 08:24:58PM +0100, Al Viro wrote: > Depending upon the calling conventions, compiler might do truncation in caller or > in a callee, but it must be done _somewhere_. Unless I'm misreading AAPCS64, "Unlike in the 32-bit AAPCS, named integral values must be narrowed by the callee rather than the caller" in 6.4.2 means that callee must not _not_ expect the upper 32 bits of %x0..%x7 to contain anything valid for 32bit arguments and it must zero-extend %w0..%w7 when passing that to something that expects a 64bit argument. On inlining it should be the same situation as storing unsigned int argument into unsigned long local variable and working with that - if void f(unsigned int w) { unsigned long x = w; printf("%lx\n", x); } ends up passing %x0 to printf, it's an obvious bug - it must do something like uxtw x0, w0 first. What am I missing here? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Date: Thu, 22 Oct 2020 20:06:29 +0000 Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_it Message-Id: <20201022200629.GX3576660@ZenIV.linux.org.uk> List-Id: References: <5fd6003b-55a6-2c3c-9a28-8fd3a575ca78@redhat.com> <20201022132342.GB8781@lst.de> <8f1fff0c358b4b669d51cc80098dbba1@AcuMS.aculab.com> <20201022192458.GV3576660@ZenIV.linux.org.uk> In-Reply-To: <20201022192458.GV3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nick Desaulniers Cc: Arnd Bergmann , David Laight , Christoph Hellwig , David Hildenbrand , Greg KH , "kernel-team@android.com" , Andrew Morton , Jens Axboe , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" On Thu, Oct 22, 2020 at 08:24:58PM +0100, Al Viro wrote: > Depending upon the calling conventions, compiler might do truncation in caller or > in a callee, but it must be done _somewhere_. Unless I'm misreading AAPCS64, "Unlike in the 32-bit AAPCS, named integral values must be narrowed by the callee rather than the caller" in 6.4.2 means that callee must not _not_ expect the upper 32 bits of %x0..%x7 to contain anything valid for 32bit arguments and it must zero-extend %w0..%w7 when passing that to something that expects a 64bit argument. On inlining it should be the same situation as storing unsigned int argument into unsigned long local variable and working with that - if void f(unsigned int w) { unsigned long x = w; printf("%lx\n", x); } ends up passing %x0 to printf, it's an obvious bug - it must do something like uxtw x0, w0 first. What am I missing here? 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 54AA9C388F7 for ; Thu, 22 Oct 2020 20:08:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 8EF9C24640 for ; Thu, 22 Oct 2020 20:08:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EF9C24640 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CHJMm0SXPzDqlr for ; Fri, 23 Oct 2020 07:08:36 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=ftp.linux.org.uk (client-ip=2002:c35c:fd02::1; helo=zeniv.linux.org.uk; envelope-from=viro@ftp.linux.org.uk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CHJKg263DzDqmY for ; Fri, 23 Oct 2020 07:06:47 +1100 (AEDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVgqz-006SmZ-1W; Thu, 22 Oct 2020 20:06:29 +0000 Date: Thu, 22 Oct 2020 21:06:29 +0100 From: Al Viro To: Nick Desaulniers Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" Message-ID: <20201022200629.GX3576660@ZenIV.linux.org.uk> References: <5fd6003b-55a6-2c3c-9a28-8fd3a575ca78@redhat.com> <20201022132342.GB8781@lst.de> <8f1fff0c358b4b669d51cc80098dbba1@AcuMS.aculab.com> <20201022192458.GV3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201022192458.GV3576660@ZenIV.linux.org.uk> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-aio@kvack.org" , David Hildenbrand , "linux-mips@vger.kernel.org" , David Howells , "linux-mm@kvack.org" , "keyrings@vger.kernel.org" , "sparclinux@vger.kernel.org" , Christoph Hellwig , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "kernel-team@android.com" , Arnd Bergmann , "linux-block@vger.kernel.org" , "io-uring@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Jens Axboe , "linux-parisc@vger.kernel.org" , Greg KH , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , David Laight , "netdev@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Oct 22, 2020 at 08:24:58PM +0100, Al Viro wrote: > Depending upon the calling conventions, compiler might do truncation in caller or > in a callee, but it must be done _somewhere_. Unless I'm misreading AAPCS64, "Unlike in the 32-bit AAPCS, named integral values must be narrowed by the callee rather than the caller" in 6.4.2 means that callee must not _not_ expect the upper 32 bits of %x0..%x7 to contain anything valid for 32bit arguments and it must zero-extend %w0..%w7 when passing that to something that expects a 64bit argument. On inlining it should be the same situation as storing unsigned int argument into unsigned long local variable and working with that - if void f(unsigned int w) { unsigned long x = w; printf("%lx\n", x); } ends up passing %x0 to printf, it's an obvious bug - it must do something like uxtw x0, w0 first. What am I missing here? 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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 247DEC388F9 for ; Thu, 22 Oct 2020 20:08:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 A5C2424640 for ; Thu, 22 Oct 2020 20:08:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LOxeUea6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5C2424640 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UFdNC5mYPNVX8lkm948bhkOJ20jf903vEcYWR9lAFJ8=; b=LOxeUea6Bm57xyA10d56fFUCc TDNdNffGxxjkFytlRHmDiHVoqS1Nf+t6HcBBInSAptQEGeUHFw0gJp/CG767CGUHAls17sDzghAQn VUlkDzfUAj8rF2y12UEe5P1nsZtgXMuUI1GKY+TRvne5hY+NFdW+jJyiZ7BNnS6+YdBzq7kIum/L1 CtZVLQ36l1WlwmsJtnqyiTqKJI0e+vEElgeWwxXe7M8t9XWPLyDr2mhHIlwiqNRblK5+OPyOtUdIo Q4fvCILapW1nr4/7E8H1n1eLhuwS78q+s2aBjmvYUg8B+nKgBWfGIC5Xx0h6stJZVICiU4rrOGq6U +I4cp7lTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVgrE-0007cE-WF; Thu, 22 Oct 2020 20:06:45 +0000 Received: from [2002:c35c:fd02::1] (helo=ZenIV.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVgrC-0007br-GE for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2020 20:06:43 +0000 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVgqz-006SmZ-1W; Thu, 22 Oct 2020 20:06:29 +0000 Date: Thu, 22 Oct 2020 21:06:29 +0100 From: Al Viro To: Nick Desaulniers Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" Message-ID: <20201022200629.GX3576660@ZenIV.linux.org.uk> References: <5fd6003b-55a6-2c3c-9a28-8fd3a575ca78@redhat.com> <20201022132342.GB8781@lst.de> <8f1fff0c358b4b669d51cc80098dbba1@AcuMS.aculab.com> <20201022192458.GV3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201022192458.GV3576660@ZenIV.linux.org.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_160642_575261_EFAD44A9 X-CRM114-Status: GOOD ( 13.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-aio@kvack.org" , David Hildenbrand , "linux-mips@vger.kernel.org" , David Howells , "linux-mm@kvack.org" , "keyrings@vger.kernel.org" , "sparclinux@vger.kernel.org" , Christoph Hellwig , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "kernel-team@android.com" , Arnd Bergmann , "linux-block@vger.kernel.org" , "io-uring@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Jens Axboe , "linux-parisc@vger.kernel.org" , Greg KH , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , David Laight , "netdev@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" 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 Thu, Oct 22, 2020 at 08:24:58PM +0100, Al Viro wrote: > Depending upon the calling conventions, compiler might do truncation in caller or > in a callee, but it must be done _somewhere_. Unless I'm misreading AAPCS64, "Unlike in the 32-bit AAPCS, named integral values must be narrowed by the callee rather than the caller" in 6.4.2 means that callee must not _not_ expect the upper 32 bits of %x0..%x7 to contain anything valid for 32bit arguments and it must zero-extend %w0..%w7 when passing that to something that expects a 64bit argument. On inlining it should be the same situation as storing unsigned int argument into unsigned long local variable and working with that - if void f(unsigned int w) { unsigned long x = w; printf("%lx\n", x); } ends up passing %x0 to printf, it's an obvious bug - it must do something like uxtw x0, w0 first. What am I missing here? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel