Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1420456imm; Wed, 23 May 2018 16:05:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqd1yyQ1Jm4+EVTUaPhp1SSEV6n+hCva8Mfvdq3Vjo/aXxkvhdYtNgGJeI9zagJowKQYKrs X-Received: by 2002:a17:902:5a03:: with SMTP id q3-v6mr3825862pli.300.1527116716812; Wed, 23 May 2018 16:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527116716; cv=none; d=google.com; s=arc-20160816; b=DuwZSYmoC4PNYfKVaHgBgkfclJiI4q5E2S9KdwWWbWW/RxyYkrvcUEpnUixO9nHVuL vB5z7YYGGRcZQhKmnaud9jlUfJ86yDPVnjfzBvvx+/BWaa+O1JufaadVoM1GRGq1DmZ9 QPCto84VPyWEp3lNxlp80RF2uMcgeBgzL0pYPtuVh6HO+qJj0HVmilOyogxO69KFnoO2 Y58LgswtK6TXatA3OwIjK/uAXkYGo9Kv6Sje/fYS9K3ydMiSG3uAJnWVuYmMkRaaMwyW HlZYnDsDXCWb8meWaxL7k5xDgzhkcPHlJyFShJOSUcUVZIpu6IlrTGXePyFdeU5g8MNa KzMQ== 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:dkim-signature:arc-authentication-results; bh=/YwuHyO5xWDJDeRYRqeCnHxBd/r6oP/4/DeN/bGKCJo=; b=jmIUL8uozsFEp86nh5Td29EUMeCUb7GqFX+I3HsieQaICzRbLWWhZKKbJv08aPRSHV VWnEgJRP8RjQGvYABGGeRITmWOd8YFckYNTBrrLtENfdn7rw1YbvPDZMe8WGMrJR3CJJ /RABJUDjCxhKFCvOlhUAh4thejY6laGjB+swSOgrvPdvyae5JkZpHMvMzIcz0M+m0g2L uDYUFlFQZin4ZNtdx0N89KkDca5cxIr9ycP8SorDYsQ2E+YxAX6Cm7J/B8v3xWyPbMpp Uq/eCrsj0CtbssqQP+QjlSgkrdKpHHjYCiUQJzlvbrdQ+RnA7vnJt5jQClt4F+acUs4/ 6How== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ozlabs.org header.s=201707 header.b=tebBHF2c; 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 s10-v6si15507918pgs.189.2018.05.23.16.05.00; Wed, 23 May 2018 16:05:16 -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; dkim=pass header.i=@ozlabs.org header.s=201707 header.b=tebBHF2c; 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 S935023AbeEWXEp (ORCPT + 99 others); Wed, 23 May 2018 19:04:45 -0400 Received: from ozlabs.org ([203.11.71.1]:34275 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934854AbeEWXEn (ORCPT ); Wed, 23 May 2018 19:04:43 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 40rp4T11FFz9s2L; Thu, 24 May 2018 09:04:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527116681; bh=Ev3h7Exmt/+eYt1qd2zSrIr7waA8ZXXxeCB6AByQGRA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tebBHF2cCOB4MgvUrjK2uAALUnOckhiRvrUo4MpY820bmFTUl49QClRQ0KSyLXvEN 1IOaPmepcFN5alGX28g5Luhd9fCuOjIAbb+J7t9ikFSwP1GgNG2AYUh5GAIqJUecDh FkfhnGZVhFArafzjHqbBhD6ZqeYxt/eZgVKvMfENLfJAkVhs6PMiB8+R2fqWkDU2iE 70hvYXIJWhxcZQ9BmGmvlX+NXa0cXmW2ROonLIHN8z2kNR9s0AXlK0mzFuyHKBhFSm wZcgXZxJ+oxycsKoO7wQ0arCdPIkobJz72L5By1i6bdHJhhJBsDN085OJXA0VsUiTV B62iTQ5ChJK+Q== Date: Thu, 24 May 2018 09:04:00 +1000 From: Paul Mackerras To: Eric Biggers Cc: linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Guillaume Nault , syzkaller-bugs@googlegroups.com, Eric Biggers Subject: Re: [PATCH v2] ppp: remove the PPPIOCDETACH ioctl Message-ID: <20180523230400.GA13256@fergus.ozlabs.ibm.com> References: <20180523035952.25768-1-ebiggers3@gmail.com> <20180523213738.146911-1-ebiggers3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180523213738.146911-1-ebiggers3@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 02:37:38PM -0700, Eric Biggers wrote: > From: Eric Biggers > > The PPPIOCDETACH ioctl effectively tries to "close" the given ppp file > before f_count has reached 0, which is fundamentally a bad idea. It > does check 'f_count < 2', which excludes concurrent operations on the > file since they would only be possible with a shared fd table, in which > case each fdget() would take a file reference. However, it fails to > account for the fact that even with 'f_count == 1' the file can still be > linked into epoll instances. As reported by syzbot, this can trivially > be used to cause a use-after-free. > > Yet, the only known user of PPPIOCDETACH is pppd versions older than > ppp-2.4.2, which was released almost 15 years ago (November 2003). > Also, PPPIOCDETACH apparently stopped working reliably at around the > same time, when the f_count check was added to the kernel, e.g. see > https://lkml.org/lkml/2002/12/31/83. Also, the current 'f_count < 2' > check makes PPPIOCDETACH only work in single-threaded applications; it > always fails if called from a multithreaded application. > > All pppd versions released in the last 15 years just close() the file > descriptor instead. > > Therefore, instead of hacking around this bug by exporting epoll > internals to modules, and probably missing other related bugs, just > remove the PPPIOCDETACH ioctl and see if anyone actually notices. Leave > a stub in place that prints a one-time warning and returns EINVAL. > > Reported-by: syzbot+16363c99d4134717c05b@syzkaller.appspotmail.com > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers Acked-by: Paul Mackerras