From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#26126: 26.0.50; file-notify-rm-watch removes arbitrary watches Date: Thu, 30 Mar 2017 11:15:49 -0700 Organization: UCLA Computer Science Department Message-ID: <25f8a6eb-2d71-42af-818a-80fd3b1d1a3c@cs.ucla.edu> References: <87r31x9ulw.fsf@luca> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------151D4BE51E41B3284D298EF2" X-Trace: blaine.gmane.org 1490897786 5945 195.159.176.226 (30 Mar 2017 18:16:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 30 Mar 2017 18:16:26 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: 26126@debbugs.gnu.org To: Andreas Politz , Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 30 20:16:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctecG-0000AY-DI for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Mar 2017 20:16:12 +0200 Original-Received: from localhost ([::1]:37100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctecM-0001p5-DA for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Mar 2017 14:16:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctecB-0001n0-Oy for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2017 14:16:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctec6-0003yg-P7 for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2017 14:16:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54971) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ctec6-0003yH-LY for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2017 14:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ctec6-0001aS-Fg for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2017 14:16:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87r31x9ulw.fsf@luca> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Mar 2017 18:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26126 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 26126-submit@debbugs.gnu.org id=B26126.14908977616090 (code B ref 26126); Thu, 30 Mar 2017 18:16:02 +0000 Original-Received: (at 26126) by debbugs.gnu.org; 30 Mar 2017 18:16:01 +0000 Original-Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctec4-0001aA-2Z for submit@debbugs.gnu.org; Thu, 30 Mar 2017 14:16:00 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctec1-0001Zx-Jf for 26126@debbugs.gnu.org; Thu, 30 Mar 2017 14:15:58 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0477816004E; Thu, 30 Mar 2017 11:15:52 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id gwtkJlc4HSTz; Thu, 30 Mar 2017 11:15:49 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C377F160090; Thu, 30 Mar 2017 11:15:49 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id A1T5OPKN25Ph; Thu, 30 Mar 2017 11:15:49 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A401116004E; Thu, 30 Mar 2017 11:15:49 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131103 Archived-At: This is a multi-part message in MIME format. --------------151D4BE51E41B3284D298EF2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for writing and reviewing that code. I looked at inotify.c after the patch was applied and found a few races and integer-overflow issues, most of which have likely been lurking there for a while. I fixed the problems that I found by installing the attached patch into master; please give it a try when you have the time. --------------151D4BE51E41B3284D298EF2 Content-Type: text/plain; charset=UTF-8; name="0001-Some-inotify-cleanup.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Some-inotify-cleanup.txt" RnJvbSA2OGQ3MGMxNjM0MTMyN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XJuIEZjb25zIChtYWtlX251bWJlciAobWFzayAmIDB4ZmZmZiks Ci0gICAgICAgICAgICAgICAgbWFrZV9udW1iZXIgKG1hc2sgPj4gMTYpKTsKLX0KLQotc3Rh dGljIGJvb2wKLWxpc3B5X21hc2tfbWF0Y2hfcCAoTGlzcF9PYmplY3QgbWFzaywgdWludDMy X3Qgb3RoZXIpCi17Ci0gIHJldHVybiAoWElOVCAoWENBUiAobWFzaykpICYgb3RoZXIpCi0g ICAgfHwgKChYSU5UIChYQ0RSIChtYXNrKSkgPDwgMTYpICYgb3RoZXIpOwotfQotCi1zdGF0 aWMgTGlzcF9PYmplY3QKIGlub3RpZnlldmVudF90b19ldmVudCAoTGlzcF9PYmplY3Qgd2F0 Y2gsIHN0cnVjdCBpbm90aWZ5X2V2ZW50IGNvbnN0ICpldikKIHsKLSAgTGlzcF9PYmplY3Qg bmFtZSA9IFFuaWw7CisgIExpc3BfT2JqZWN0IG5hbWU7CisgIHVpbnQzMl90IG1hc2s7Cisg IENPTlNfVE9fSU5URUdFUiAoRm50aCAobWFrZV9udW1iZXIgKDMpLCB3YXRjaCksIHVpbnQz Ml90LCBtYXNrKTsKIAotICBpZiAoISBsaXNweV9tYXNrX21hdGNoX3AgKEZudGggKG1ha2Vf bnVtYmVyICgzKSwgd2F0Y2gpLCBldi0+bWFzaykpCisgIGlmICghIChtYXNrICYgZXYtPm1h c2spKQogICAgIHJldHVybiBRbmlsOwogCiAgIGlmIChldi0+bGVuID4gMCkKQEAgLTE5NSwx MCArMTkwLDEwIEBAIGlub3RpZnlldmVudF90b19ldmVudCAoTGlzcF9PYmplY3Qgd2F0Y2gs IHN0cnVjdCBpbm90aWZ5X2V2ZW50IGNvbnN0ICpldikKICAgZWxzZQogICAgIG5hbWUgPSBY Q0FSIChYQ0RSICh3YXRjaCkpOwogCi0gIHJldHVybiBsaXN0MiAobGlzdDQgKEZjb25zICht YWtlX251bWJlciAoZXYtPndkKSwgWENBUiAod2F0Y2gpKSwKKyAgcm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RvciAoZGVzY3JpcHRvcik7CiAKLSAgICAgIGlmICghIE5J TFAgKGVsdCkpCisgICAgICBpZiAoISBOSUxQIChwcmV2dGFpbCkpCiAgICAgICAgIHsKLSAg ICAgICAgICBMaXNwX09iamVjdCB3YXRjaGVzID0gWENEUiAoZWx0KTsKLSAgICAgICAgICB3 aGlsZSAoISBOSUxQICh3YXRjaGVzKSkKKwkgIExpc3BfT2JqZWN0IHRhaWwgPSBDT05TUCAo cHJldnRhaWwpID8gWENEUiAocHJldnRhaWwpIDogd2F0Y2hfbGlzdDsKKwkgIGZvciAoTGlz cF9PYmplY3Qgd2F0Y2hlcyA9IFhDRFIgKFhDQVIgKHRhaWwpKTsgISBOSUxQICh3YXRjaGVz KTsKKwkgICAgICAgd2F0Y2hlcyA9IFhDRFIgKHdhdGNoZXMpKQogICAgICAgICAgICAgewog ICAgICAgICAgICAgICBldmVudC5hcmcgPSBpbm90aWZ5ZXZlbnRfdG9fZXZlbnQgKFhDQVIg KHdhdGNoZXMpLCBldik7CiAgICAgICAgICAgICAgIGlmICghTklMUCAoZXZlbnQuYXJnKSkK ICAgICAgICAgICAgICAgICBrYmRfYnVmZmVyX3N0b3JlX2V2ZW50ICgmZXZlbnQpOwotICAg ICAgICAgICAgICB3YXRjaGVzID0gWENEUiAod2F0Y2hlcyk7CiAgICAgICAgICAgICB9CiAg ICAgICAgICAgLyogSWYgZXZlbnQgd2FzIHJlbW92ZWQgYXV0b21hdGljYWxseTogRHJvcCBp dCBmcm9tIHdhdGNoIGxpc3QuICAqLwogICAgICAgICAgIGlmIChldi0+bWFzayAmIElOX0lH Tk9SRUQpCi0gICAgICAgICAgICByZW1vdmVfZGVzY3JpcHRvciAoZGVzY3JpcHRvciwgdHJ1 ZSk7CisJICAgIHJlbW92ZV9kZXNjcmlwdG9yIChwcmV2dGFpbCwgdHJ1ZSk7CiAgICAgICAg IH0KICAgICAgIGkgKz0gc2l6ZW9mICgqZXYpICsgZXYtPmxlbjsKICAgICB9CiAKLS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