Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2836448imm; Thu, 24 May 2018 17:13:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqP90xg12QWMRCySy2mnczZ2UD7zNGq59AtT4W/BnFuQZejLoILoF8G3bjB8GoXtCBgSAw7 X-Received: by 2002:a17:902:778a:: with SMTP id o10-v6mr187819pll.214.1527207212331; Thu, 24 May 2018 17:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527207212; cv=none; d=google.com; s=arc-20160816; b=DjyWPzm5wVpgAgHrrPK5YgPHjNlrJqF0Ifa7MCfKIl94aals+sf0hyfB11F9ZP6sXj aEGn1e6P4La9k6tMnlnYQnZiX+aWfPSOwXRqA8gadimkOru6QGdu9UCHh401WJVI0FpP 6ayNQQFSSLcTRtnzwLuWBwaBrpdpouU1wepHK8h5zcsRcTAgFSv0LN+Nk2xAMvhkPCeG W+WwhwH/cTb256cpm3vS0tFrBOlc9eOgThEA8O4vSjDEVGF4zmjpc3SLxanBznf9cLKo xkI/SJtd++5WFsfxQ+k6dPQhOvEMMuFil+ePxFxuHQjB0Hl7IS5d1073g0wJhSXmjsO3 Bckg== 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:arc-authentication-results; bh=11D6LRcl7wbgzS9icHOGM6yY4p/4VLdaCwDYRBeBHns=; b=zL76WnC7HCpYQdhNDPcfcgjMyLCkVgVqJpbF4pHX+gaotKl1Rv7DxXYRz8+AxMmh0E femmXM9BKnim0lzGYEnTDko3K90AnaTESdTdSjWOkZ1oobOojUI4ghQfWsy5HdXrkV+w ZDYmQDjs4+a7wFPO3iQJbF7w+OOhoQoQX4/7C4ZPmCAItidb9p7gxj3UaviwxpsWNlyJ TobVvuwbcd9ME2rGU8uamgMiLc1TeEnwnRW7gjJYte6NwLD2UdGexzOnSjv2p2W6gYCE IrhmKBM9lhc2WUNW42mWXc5EByiHdo4CdhS0w1uUa+T2y8dXHPbVm5ibD32qtYVhzLZ7 kFkg== 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 ay9-v6si23979667plb.259.2018.05.24.17.13.17; Thu, 24 May 2018 17:13:32 -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 S970331AbeEXOFJ (ORCPT + 99 others); Thu, 24 May 2018 10:05:09 -0400 Received: from zimbra.alphalink.fr ([217.15.80.77]:44468 "EHLO zimbra.alphalink.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970312AbeEXOE6 (ORCPT ); Thu, 24 May 2018 10:04:58 -0400 Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 13E662B520A4; Thu, 24 May 2018 16:04:56 +0200 (CEST) Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 5D8yXuTOsGoK; Thu, 24 May 2018 16:04:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 613172B5212D; Thu, 24 May 2018 16:04:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail-2-cbv2.admin.alphalink.fr Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VPt-HjhRogXu; Thu, 24 May 2018 16:04:50 +0200 (CEST) Received: from c-dev-0.admin.alphalink.fr (94-84-15-217.reverse.alphalink.fr [217.15.84.94]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 25DB12B520A4; Thu, 24 May 2018 16:04:50 +0200 (CEST) Received: by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000) id E9285601F2; Thu, 24 May 2018 16:04:49 +0200 (CEST) Date: Thu, 24 May 2018 16:04:49 +0200 From: Guillaume Nault To: Eric Biggers Cc: linux-ppp@vger.kernel.org, Paul Mackerras , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Eric Biggers Subject: Re: [PATCH v2] ppp: remove the PPPIOCDETACH ioctl Message-ID: <20180524140449.GA1389@alphalink.fr> 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.5 (2018-04-13) 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 > --- > > v2: leave a stub in place, rather than removing the ioctl completely. > Thanks a lot for your help on this matter. BTW, netdev has its own rules wrt. stable backports. You didn't need to CC: stable@. David handles -stable submissions himself. Using a 'PATCH net' subject prefix would have made it clear that this patch was fixing some released code and should be considered for -stable backport. Reviewed-by: Guillaume Nault Tested-by: Guillaume Nault