From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756840AbdEUTEm (ORCPT ); Sun, 21 May 2017 15:04:42 -0400 Received: from mail-it0-f47.google.com ([209.85.214.47]:35049 "EHLO mail-it0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752119AbdEUTEj (ORCPT ); Sun, 21 May 2017 15:04:39 -0400 MIME-Version: 1.0 In-Reply-To: <20170521073405.GX390@ZenIV.linux.org.uk> References: <20170515223716.2085-8-viro@ZenIV.linux.org.uk> <20170519060820.GW568@yexl-desktop> <20170521073405.GX390@ZenIV.linux.org.uk> From: Linus Torvalds Date: Sun, 21 May 2017 12:04:38 -0700 X-Google-Sender-Auth: H_rIw2jpHqsAz8iJye1bmAfUTJk Message-ID: Subject: Re: [lkp-robot] [waitid()] 75f64d68f9: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= To: Al Viro Cc: kernel test robot , Linux Kernel Mailing List , Ingo Molnar , Oleg Nesterov , Peter Zijlstra , Christoph Hellwig , LKP Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 21, 2017 at 12:34 AM, Al Viro wrote: > > - __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \ > + __put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \ Hmm. Looking more at this, the "unsafe_get_user()" case is wrong too - for types larger than "long". But I see you have a pull request pending, and I'll take this fix as-is. I *think* the right thing to do is to just do register __inttype(*(ptr)) __val_gu; for unsafe_get_user. I think the error crept in because I copied the "get_user_ex()" code, which has the same type confusion (ie it doesn't handle values larger then long, so "long long" on x86-32 wouldn't work). That type limitation was ok'ish simply because get_user_ex() was x86-only and of very limited use (and clearly never saw the 64-bit value on a 32-bit arch case). But for unsafe_get_user() we obviously want to make it generic enough and just be able to replace existing get_user() calls. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0505901785205840079==" MIME-Version: 1.0 From: Linus Torvalds To: lkp@lists.01.org Subject: Re: [lkp-robot] [waitid()] 75f64d68f9: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= Date: Sun, 21 May 2017 12:04:38 -0700 Message-ID: In-Reply-To: <20170521073405.GX390@ZenIV.linux.org.uk> List-Id: --===============0505901785205840079== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Sun, May 21, 2017 at 12:34 AM, Al Viro wrote: > > - __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); = \ > + __put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), _= _pu_err, -EFAULT); \ Hmm. Looking more at this, the "unsafe_get_user()" case is wrong too - for types larger than "long". But I see you have a pull request pending, and I'll take this fix as-is. I *think* the right thing to do is to just do register __inttype(*(ptr)) __val_gu; for unsafe_get_user. I think the error crept in because I copied the "get_user_ex()" code, which has the same type confusion (ie it doesn't handle values larger then long, so "long long" on x86-32 wouldn't work). That type limitation was ok'ish simply because get_user_ex() was x86-only and of very limited use (and clearly never saw the 64-bit value on a 32-bit arch case). But for unsafe_get_user() we obviously want to make it generic enough and just be able to replace existing get_user() calls. Linus --===============0505901785205840079==--