Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4559702yba; Wed, 17 Apr 2019 14:14:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqy11P1QCCn8RsQOnf0ysw1YQNKD2vVrBY7beyKAWFSK1K18LUsXbY9dPJ2gtFA31CjPTWXk X-Received: by 2002:aa7:9296:: with SMTP id j22mr93486094pfa.140.1555535662405; Wed, 17 Apr 2019 14:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555535662; cv=none; d=google.com; s=arc-20160816; b=DqGnsyaxK3ZwqHqOj1QtkkSwIfRwXeducV2Hw5Z8gMGH4E1Ix4Hum7T6tHTZgxcO3a VQfRpNrD6b/l/Vn3cuJVZQqmDvShWeDZk44ugruWqbmrezZmrKxulIEtYw6Jf9S/tKi4 cAArFcPUCYgqZbzsNtzZeEIjCdVlNQreriXkvd9b05Er9BWdjQGrlqGJHCjD7DgeJ1fP xZcj56H9x7x553u78UP9j+UOD9V0ZV9J2VKPa2nDnzw/k4JztDa/U9tE8GryEZCt5SLH vrWpqhiiVCzB3t2p30i/Z6G7ILVz3NYLlVfXmJOJEJW8kh97J0kmd1eCj2j4QzTzOixa 9XAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Vdwu8rr9WTnZLFjreibXsqVkqFQs/dULbDtWPUrWu5M=; b=rwyHDYRDn6wfUK3HOQqq/5WZ/L7vnuuHoDfQ9Y1EuOGXoj/+xE82clEuKkDx+dXTg1 9pyz4vLt4bQNB1X5fIeb9RVfRY6mLziu/epDjzbijf9GBQEiQYpzkzLzwsPZsPHMxRkr DNzg5eExtA9l940BVuuRQ4pVeLLll9/NgWvp389FpUZt/hOwwA3i9H5kTv6wO1G9TNQ/ 2G8jvo62IUtqjxs6BRpdtPwjZls1xBwuzS0yxiH2wJZaDQg9iy1pEzTPUf4awyDnDBRr 66egOMgDbUjOKANoTFWOkiDix0nZOv2Mz4fwO/DBIPetIIRz/xXC8OKqp801b9XdrwnV z07Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si53535743pgj.576.2019.04.17.14.14.07; Wed, 17 Apr 2019 14:14:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733127AbfDQVNK (ORCPT + 99 others); Wed, 17 Apr 2019 17:13:10 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:50786 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbfDQVNK (ORCPT ); Wed, 17 Apr 2019 17:13:10 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hGrrc-0007nC-4E; Wed, 17 Apr 2019 21:13:04 +0000 Date: Wed, 17 Apr 2019 22:13:04 +0100 From: Al Viro To: Arnd Bergmann Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Paul Mackerras , "David S. Miller" , Michal Ostrowski , Dmitry Kozlov , James Chapman , linux-ppp@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v3 02/26] compat_ioctl: move simple ppp command handling into driver Message-ID: <20190417211303.GU2217@ZenIV.linux.org.uk> References: <20190416202013.4034148-1-arnd@arndb.de> <20190416202013.4034148-3-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190416202013.4034148-3-arnd@arndb.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 16, 2019 at 10:19:40PM +0200, Arnd Bergmann wrote: > diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c > index c708400fff4a..04252c3492ee 100644 > --- a/drivers/net/ppp/ppp_generic.c > +++ b/drivers/net/ppp/ppp_generic.c > @@ -899,6 +899,7 @@ static const struct file_operations ppp_device_fops = { > .write = ppp_write, > .poll = ppp_poll, > .unlocked_ioctl = ppp_ioctl, > + .compat_ioctl = ppp_ioctl, Oh? What happens on e.g. s390 with something like PPPIOCNEWUNIT? Current kernel: * no ->compat_ioctl() * ->unlock_ioctl() is present * found by compat_ioctl_check_table() * pass (unsigned long)compat_ptr(arg) to do_vfs_ioctl() * pass that to ppp_ioctl() * pass that to ppp_unattached_ioctl() * fetch int from (int __user *)compat_ptr(arg) With your patch: * call ppp_ioctl() * pass arg to ppp_unattached_ioctl() * fetch int from (int __user *)arg AFAICS, that's broken... Looking at that ppp_ioctl(), pointer to arch-independent type or ignored: PPPIOCNEWUNIT PPPIOCATTACH PPPIOCATTCHAN PPPIOCSMRU PPPIOCSFLAGS PPPIOCGFLAGS PPPIOCGUNIT PPPIOCSDEBUG PPPIOCSMAXCID PPPIOCCONNECT PPPIOCGDEBUG PPPIOCSMAXCID PPPIOCSMRRU PPPIOCDETACH PPPIOCDISCONN PPPIOCGASYNCMAP PPPIOCSASYNCMAP PPPIOCGRASYNCMAP PPPIOCSRASYNCMAP PPPIOCGXASYNCMAP PPPIOCSXASYNCMAP PPPIOCGNPMODE PPPIOCSNPMODE pointer to struct ppp_option_data (with further pointer-chasing in it): PPPIOCSCOMPRESS pointer to struct ppp_idle: PPPIOCGIDLE pointer to struct sock_filter (with hidden pointer-chasing, AFAICS): PPPIOCSPASS PPPIOCSACTIVE Pretty much all of them take pointers. What's more, reaction to unknown is -ENOTTY, not -ENOIOCTLCM, so that patch will have prevent the translated ones from reaching do_ioctl_trans() What am I missing here? Why not simply do compat_ppp_ioctl() { PPPIOCSCOMPRESS32 => deal with it PPPIOCGIDLE32 => deal with it PPPIOCSPASS32 / PPPIOCSACTIVE32 => deal with it default: pass compat_ptr(arg) to ppp_ioctl() and be done with that } with BPF-related bits (both compat and native) taken to e.g. net/core/bpf-ppp.c, picked by both generic and isdn? IDGI...