Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1113255iob; Thu, 12 May 2022 11:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+YjuDrwpU1o5g9lW/ZUiRQGe5gDmlH+JeWJMCSEF+N3BdE672q9+3yPFDHjESw7w5ibvU X-Received: by 2002:a05:6402:d51:b0:425:d5e1:e9f0 with SMTP id ec17-20020a0564020d5100b00425d5e1e9f0mr36386378edb.125.1652379742906; Thu, 12 May 2022 11:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652379742; cv=none; d=google.com; s=arc-20160816; b=hpaiAYgxdSvBNxfLNNFso18f4ZWvVKQVE9lGTHzB8QBSSUFda2RkCpUkyyLstEQZaz I+IrfKG8Wsx6mGgLvBZU00QovJ3Ix2v09K+sEoFZzbDO55u2Y4AQxzvjw94LNjh9al8z LPHtIlWcPpFW5Jd5d/LgC2hc9d2mbs8tlEgugOH0l62JzvUas69Zg2BDZ7MgTkcY7/Ss Ocz4rNohr8IhFmm9Ep+E4bPj0/YTi2ecd4bo2G/9Fl9cp+1GmKmlwaZPun1JLGmpkiWu kAAJNrEASuALqnBqscmOTs436qzWGttpPf1CfJAZFVj9NOePxJuuVZ6dw8A9k4AK3rM2 4zFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AQe6N02jfGCt1Tpv9ElZ85pDuhThz61shKfOKRMru0s=; b=l2IzpLgMEt1A0m614ph6UuK1UAO7hCFDnCYvIMXB1CFyqSpcoDRwMQxfc6yIX3WDaA P5vUhtXkS8T3c9g5FfuyhzPWpJ5VJyMCWcyfYscCGzgt2BJSCtcRi7xk7jPpOz8Melyj xb1J6CmJuU6kHmagTApnIJIt9U2EGzDAEPfzaOvHCiYjxENKTADXtTJYIzRSN6CUy8gV K+InRqZZkvq2fpXp6wPUVAvA2eo8Uw1+WWZLb5uUAs1PhNQFs6jMf4TIpLfxggOcnUKV nRePrt4zXn061YLkIKeCcc6LH+0nB4U7TZ7UAEl99B/xY3stW4k24kDvzForcAe2+P+B yV4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BEvRkLgW; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho15-20020a1709070e8f00b006f392b2aac4si44807ejc.190.2022.05.12.11.21.43; Thu, 12 May 2022 11:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BEvRkLgW; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245720AbiELRlw (ORCPT + 99 others); Thu, 12 May 2022 13:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357169AbiELRkw (ORCPT ); Thu, 12 May 2022 13:40:52 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1426013F27; Thu, 12 May 2022 10:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AQe6N02jfGCt1Tpv9ElZ85pDuhThz61shKfOKRMru0s=; b=BEvRkLgW7vQHVOsVfskg7QHDzS ni062Z+K9j8D+UEoCD+CUDlULmp8G0eqE7AShtpjvFXFN2noQCTx9si+LrIB/IWFcRZVwVaLjzXCH MJzaAZlkx1BkeZASvknqLNqpdNWlO1rC/DSvmazJzxaxaMLkFZJS2vr6qVWm687oHI8E/0f0m5Ea0 WMXDQR9Emlr7kX8uSpzaU023iE3UxIpBFsp+FCPMTpDur0kK9BrrBvRMt6Fmh1VZitdsV6v99tEMm GCNNP1IX3GWFBEOA3faGjezvK6sBmnOfRYHi4cLJoXX+2o0ExMwpNiOCq7gg2kE0Sfr1wAT4YmLgv 1QMG3h9g==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1npCnq-00D1Um-8K; Thu, 12 May 2022 17:40:42 +0000 Date: Thu, 12 May 2022 10:40:42 -0700 From: Luis Chamberlain To: "Jason A. Donenfeld" , Al Viro , "Eric W. Biederman" , Lucas De Marchi Cc: Lennart Poettering , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH 1/2] sysctl: read() must consume poll events, not poll() Message-ID: References: <20220502140602.130373-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 03, 2022 at 01:27:44PM +0200, Jason A. Donenfeld wrote: > On Mon, May 02, 2022 at 05:43:21PM +0200, Lennart Poettering wrote: > > On Mo, 02.05.22 17:30, Jason A. Donenfeld (Jason@zx2c4.com) wrote: > > > > > Just wanted to double check with you that this change wouldn't break how > > > you're using it in systemd for /proc/sys/kernel/hostname: > > > > > > https://github.com/systemd/systemd/blob/39cd62c30c2e6bb5ec13ebc1ecf0d37ed015b1b8/src/journal/journald-server.c#L1832 > > > https://github.com/systemd/systemd/blob/39cd62c30c2e6bb5ec13ebc1ecf0d37ed015b1b8/src/resolve/resolved-manager.c#L465 > > > > > > I couldn't find anybody else actually polling on it. Interestingly, it > > > looks like sd_event_add_io uses epoll() inside, but you're not hitting > > > the bug that Jann pointed out (because I suppose you're not poll()ing on > > > an epoll fd). > > > > Well, if you made sure this still works, I am fine either way ;-) > > Actually... ugh. It doesn't work. systemd uses uname() to read the host > name, and doesn't actually read() the file descriptor after receiving > the poll event on it. So I guess I'll forget this, and maybe we'll have > to live with sysctl's poll() being broken. :( A kconfig option may let you do what you want, and allow older kernels to not break, however I am more curious how sysctl's approach to poll went unnnoticed for so long. But also, I'm curious if it was based on another poll implementation which may have been busted. But more importantly, how do we avoid this in the future? Luis