Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3511084pxb; Wed, 14 Apr 2021 07:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysFd7bmw4JdItcVW1ZtrmdNdNb8wS2FJ/C+bPxySzcYQNMxrF4LgSt6ROMTzAaKemYUb97 X-Received: by 2002:a17:902:b117:b029:e6:81ed:8044 with SMTP id q23-20020a170902b117b02900e681ed8044mr37085130plr.13.1618409455467; Wed, 14 Apr 2021 07:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618409455; cv=none; d=google.com; s=arc-20160816; b=Zmrr25vt+UREPiWhx+BZlk+HabkdGDJga8csqK/AXStUfPHcdI9LMorjlPbE5HCSHZ 6VniubUeYbbOwnxWYw45nBawVVCSU+sU0wWGDEgPa8Su0MYJ46QMw02wNYcXSjbByLZ+ 0hKfHH3XfKGrplKBdDmAkPegAPBLfdgyOE/DFbH7g8bhdLskKP5HUxqbQQhJeGTLaSqp WPnsEihhFB0U3gvBOHxHJzbaTBpJXguruYHB/uPLzMED+j+Fnjn2/Eicd2GQS0jy2V8L 61znHXBunDqBtbkz7+4JM7kBGyhEXcjV7XsxI43XOSeRrLj7sODihhpqu9rAFUSnkIaf FX+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=3p4t9yOma+K5X3sw22SSvIXC9ju4wI9AxovEljuwOeM=; b=0hvZ5TU4WQRwIW3Hq4zZcEumBbnLFikBHq/fQmVI3EUlLoHMRuG7Jp6SWLVirbMUnL hr/D0gEu7R8k6+sl8yVhMGfrM+rEjLSaN9UiD+Nu2NW8XEb1NohrDrnlQ4Ks/x06EmI0 SLTd2T/D88oQaWIacSzs9M4xxsvP+lDMNRemVcU7mSUE5zA3S+sEJycEeggHWRIZPm0T rJnlDwhT44ZBOhrrk2csArWgryHrdpoqHaA9TOhPzWtJJLKtyd+3t7XEIubdh5ClOIUN H+TmfKJalfER1iq+nJayGTi205RJSuJ6RQwHBXBJvEOo/eyeEmI9QvlDs3XpEoJv8CbK /Jjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 73si22667240pgf.398.2021.04.14.07.10.41; Wed, 14 Apr 2021 07:10:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348470AbhDNHIR (ORCPT + 99 others); Wed, 14 Apr 2021 03:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbhDNHIQ (ORCPT ); Wed, 14 Apr 2021 03:08:16 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 635C6C061574 for ; Wed, 14 Apr 2021 00:07:55 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lWZcr-00BVIO-Ky; Wed, 14 Apr 2021 09:07:49 +0200 Message-ID: <2db76f5161be090f9fec2bc4fcb8973533e32564.camel@sipsolutions.net> Subject: Re: "rfkill: add a reason to the HW rfkill state" breaks userspace From: Johannes Berg To: "Grumbach, Emmanuel" , Hans de Goede Cc: linux-wireless Date: Wed, 14 Apr 2021 09:07:48 +0200 In-Reply-To: (sfid-20210414_071301_651335_B1FA5905) References: (sfid-20210414_071301_651335_B1FA5905) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 2021-04-14 at 05:12 +0000, Grumbach, Emmanuel wrote: > > > > Hi, > > > > I've been debugging a userspace rfkill issue today which boils down > > to the > > "rfkill: add a reason to the HW rfkill state" patch: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i > > d=14486c82612a177cb910980c70ba900827ca0894 > > breaking userspace. > > This has been rolled back by: > https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git/commit/?id=71826654ce40112f0651b6f4e94c422354f4adb6 > Other userspace broke (systemd) so Johannes rolled this back by > default. > Userspace that is interested in the new byte will read 9 bytes. Which, unfortunately, doesn't address *this* particular case, because it uses gio and that will fill the buffer with arbitrary size? When you (Hans) say you saw in strace a read of size 8, did you mean the size passed to it, or the return size? I guess it must be the return size, and the size passed to it was way larger. The commit Emmanuel linked to fixes cases such as systemd that were just completely garbage (reading with one size, and then checking they got another), but it wouldn't fix this case. Unfortunately, as you also said, it does seem a bit late now - it's been released in various kernels since 5.10, and while the default rollback will improve the situation somewhat, read(..., size>8) will still return 9 bytes rather than 8 as it used to. Switching that *also* back *should* be safe, but who knows what other bugs were introduced in the meantime? I certainly don't really have a major objection to rolling that also back, but would it really help that much at this point? I guess it could be going into 5.10/5.11 stable kernels though. johannes