Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96828 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82745 invoked from network); 11 Nov 2016 07:41:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2016 07:41:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 104.47.38.99 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 104.47.38.99 mail-bl2nam02on0099.outbound.protection.outlook.com Received: from [104.47.38.99] ([104.47.38.99:47414] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B4/D5-35596-D0675285 for ; Fri, 11 Nov 2016 02:41:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GCGzvIOH3fSjsQE5has1kXde76acxcaCAhjXxpvRtOw=; b=I3dMS2yVYIjGURCnNaGt+LkskLirGsxGgswq9V4CFZ0TFeUVwaCf+T8VS62Lx2J1bVf4yaM1OoRIitIQvmuOYdzmaKr8OlqpOl3ARkik2bw1Etzy1f/NdHofjEtIl04HjQjlgWW7uZjI+i956ULtvhc1I6qoM3mRJovye7+Fg+Q= Received: from MWHPR02MB2477.namprd02.prod.outlook.com (10.168.204.147) by MWHPR02MB2479.namprd02.prod.outlook.com (10.168.204.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Fri, 11 Nov 2016 07:40:56 +0000 Received: from MWHPR02MB2477.namprd02.prod.outlook.com ([10.168.204.147]) by MWHPR02MB2477.namprd02.prod.outlook.com ([10.168.204.147]) with mapi id 15.01.0659.035; Fri, 11 Nov 2016 07:40:56 +0000 To: "php-dev@coydogsoftware.net" CC: Dmitry Stogov , "rasmus@lerdorf.com" , "internals@lists.php.net" , "Anatol Belski (ab@php.net)" , Zeev Suraski Thread-Topic: [PATCH] opcache bug #69090, prepend user identifier to keys Thread-Index: AQHSO+21D4h3upkAiEqzeDgxtnu8Qg== Date: Fri, 11 Nov 2016 07:40:56 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-originating-ip: [92.62.57.172] x-microsoft-exchange-diagnostics: 1;MWHPR02MB2479;6:G3pouKkoI2OjxgTy1U/jArX9loZr28Q6Uq/e5ZJqQeuet97wTnPjjg4gzQnwu5+2pE7ZH1R31oMHclvoSgwOs4g43EwdfFgJ2W7kHERo7xhwSSJX+n5dPoZejZMEN0Y8eGkAp4mgalVikIX/boA1xdu96ByWdi+2saFae7kXjMwfUOOnujWafNjjvHJvruPUcFmb8QOS1OokfI49Yuy/clnlocKZ18M06/7gELjMsrYk9iVfJBm1rilHzIFvzr3w+4yPyxK2QPM37TFnPXCN9Mhve8xBUdD49MCRSD/R+QsrJcyoItZ5UbkbEwCmBGd9;5:SiR5WD4xyQkmGLZuNgtZ2mHZ8/GOgNtnVyWThX47gPXdnQLfFjXuROD38Hu3MT0uZHos4FV1aJBEA0U6gB1xrluHWf7rncLTKl6ZYafwri9h9SiUHlvHuhi3uJyu/wYuUeKIkjEyJXBLQZhJNW7NKw==;24:dfRfioF6Quf5iDs3leTMfOdXuWD5u88qutWcs3QykFzxQWxyzg+BQCYqmSjkWOruFJizYkeyHd7dzjU38aJ3Q33OG+M9ITqbg3EJGTVWNQ0=;7:agQneYrOt+a/hmJtB9mN2OjsmloC6lA/VBx/5jwFFH2rO+b6LJyOvQDOyLIiURr9UCOPFn/GgdJhW9QL1mZEppSxcDmJWAIfjlo5w0qTO+YExgDUeaAf6tLIGMoFeGKiW+S3+4uOjtOQrpMVChs8FhSoN7+GW9El3fBQtTUAV6EsKScxidau8YkmErX9NsVQQ9vogNM/SxY9OiM+t/0RQhWUwUI7k8cmjTEBpMgzVLdZCvt5SN+Pz3HIGH1XC3vuAyuht6cYlCctN6KkrM/O9MFKI/z0rsDLjVP1iRKTa/6xYTlFlli+H/whdsKKV5bPh922vhu9jWFlwSN3AzVrQeq2yZubOjPe4ESu9wPsFEI= x-ms-office365-filtering-correlation-id: 66ec3800-e5c3-423c-69d4-08d40a061270 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR02MB2479; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:MWHPR02MB2479;BCL:0;PCL:0;RULEID:;SRVR:MWHPR02MB2479; x-forefront-prvs: 012349AD1C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(24454002)(189002)(377454003)(199003)(8936002)(110136003)(33656002)(86362001)(7696004)(101416001)(122556002)(189998001)(77096005)(5660300001)(2501003)(66066001)(107886002)(3280700002)(6916009)(76576001)(3660700001)(3846002)(2906002)(586003)(81156014)(99286002)(54356999)(87936001)(4001430100002)(102836003)(2351001)(5640700001)(6116002)(105586002)(106116001)(229853002)(106356001)(97736004)(8676002)(81166006)(92566002)(74316002)(68736007)(7736002)(4326007)(50986999)(2900100001)(305945005)(7846002)(9686002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR02MB2479;H:MWHPR02MB2477.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_MWHPR02MB2477BC9B59DC305ADDCAEC65BFBB0MWHPR02MB2477namp_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2016 07:40:56.0320 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2479 Subject: Re: [PATCH] opcache bug #69090, prepend user identifier to keys From: dmitry@zend.com (Dmitry Stogov) --_000_MWHPR02MB2477BC9B59DC305ADDCAEC65BFBB0MWHPR02MB2477namp_ Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable On Nov 11, 2016 2:20 AM, php-dev@coydogsoftware.net wrote: > > Hello Dmitry, > > A quick question after considering your comments and doing a bit more > homework on extension lifetime: > > On Thu, Nov 10, 2016 at 08:10:19AM -0600, php-dev@coydogsoftware.net wrot= e: > > > > On Thu, Nov 10, 2016 at 08:51:58AM +0000, Dmitry Stogov wrote: > > > > > > The patch introduces syscall in the hot function (this may be > > > optimized). > > > > Agreed. That isn't ideal. But the geteuid() call shouldn't be done > > during opcache initialization when the SHM object is initialized, > > because EUID might change afterwards. I didn't want to get EUID too > > early so I erred on the side of caution, getting it at the last possibl= e > > moment. This is slower but safer because it prevents trivial cross-user > > cache access from PHP userland. I'm open to suggestion if there's a mor= e > > "local" initialization function outside of key generation, which is > > guaranteed to run after EUID changes in both FPM user pool, and > > mod_ruid2/mod_php. > > Looks like OPCache currently does not implement a request_startup_func fo= r > per-request initialization. I'm assuming this was avoided for > performance reasons and due to no perceived need until now for > per-request initialization. This seems like it would be the proper point > in extension lifetime to call geteuid() and save results in the > zend_accel_globals struct to use during key construction. Correct? Any > objection to my implementing this? See zend_accel_activate() in ZendAccelerator.c > > I'm also thinking the stat() for device+inode should be done in opcache > code at file compilation time; correct? It's not a problem to make extra stat() at script compile (I think we alrea= dy do it to record mtime), however we will have to do it also on each acces= s. > > Would this be a step in the right direction? Apologies if these are > basic questions; I'm new to PHP extensions but strongly motivated to fix > OPCache keys quickly. I may have time for a second pass at this over the > weekend. I see your point, but I don't like a quick fix, I like a "good" fix. And I hope, our discussion could lead us to some better solution :) Thanks. Dmitry. > > -php-dev at coydogsoftware dot net --_000_MWHPR02MB2477BC9B59DC305ADDCAEC65BFBB0MWHPR02MB2477namp_--