Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1809272pxm; Sun, 27 Feb 2022 03:44:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpNDUM5EVyVS0W65N5xJme2d0ApG2kXLD1KiY7hJKOgqU2Z0HEp8Fu1QD1U7JnhSri7HJT X-Received: by 2002:a65:6942:0:b0:378:9365:5963 with SMTP id w2-20020a656942000000b0037893655963mr968322pgq.142.1645962274743; Sun, 27 Feb 2022 03:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645962274; cv=none; d=google.com; s=arc-20160816; b=tWlTvTFu8JIyEEMSYBEp/Nmp02Eyh0pkZtaFcF2LgPTzhvqIU2puGB5AsKUMXJqzHu ilC2aX6GVFfpn/nz97i3EnkK7cGzx/OLdRmVH4uGuJpAMWXMX0ToyFozvKT4MbPqi9ql Eoo0AYBlmKsfLAbN88+vhfk+OMk/0nBse7c557+jiwg7gD+RB1o6zfG2jKNpNJyMYFep 5oMhOBhQ/0p+NEhQA8Qt4rF1TiIEISPlH8Q54yVu8YGznCDkBdfXt2TLFpL6FUsxAZQN 2Lv/oL8oFlIjmqFHzjK9byuHy6ZazfeidvQPvF3XVay6lbGyVkdxHsEuZbRHbHNKWG3N 8b5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=p42necgS2+w3IBbaZntG/drkpeKiZlOst3+ic3/i65o=; b=nI5aG8gla6AAs4xlGMDyU3HT5eZDuXV/P8vpYTKwwQB8YDEzuTAFbDO+47WQBQA8DD JOAhzYLr7YOzJTw8QCXLC/R/UAb4+H1IsK9+8dcESia50fM3yZBtZKzVaTleKIOYG07X ikThMcMdrb+qAxJxLPP4FuGyvPu/K2r//fjpmV47WJA3lIb0Ks01pBGQggAYbkeMSmSX 9NYnWnJT7uhr5F/87EufNUgKvnxL8V5fnEHtsV+r3zoRguyh63uYB9vnjLfe4bHjkUSG glpiUDLdYKBERHuqmDu8n8aZMitAZW/57ZJX8NtgZOigOLUnP4cj9wJGTvAGfrb9Wx86 2OFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T0dQwHEu; 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 h10-20020a17090a3d0a00b001bc67215a56si7322109pjc.148.2022.02.27.03.44.21; Sun, 27 Feb 2022 03:44:34 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=T0dQwHEu; 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 S229696AbiB0KbA (ORCPT + 99 others); Sun, 27 Feb 2022 05:31:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiB0Ka6 (ORCPT ); Sun, 27 Feb 2022 05:30:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 022734132C; Sun, 27 Feb 2022 02:30:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6C99B80B8E; Sun, 27 Feb 2022 10:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24AB8C340F0; Sun, 27 Feb 2022 10:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645957819; bh=p42necgS2+w3IBbaZntG/drkpeKiZlOst3+ic3/i65o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=T0dQwHEuLT+MFaX0055u645MrzOQtFLQNNSipuvu0FMiQ9VxwggjH/YawZO7uGYPP 4HYqHPVq9Wh5reFTmoockrTYg4me5HlLJA4UFzFT132zzfYhrhxEh2C87FFtEyujPa gPIBTV9Cy5XA5Rwl/Fa+e7DPppy5UBEIsSGBsVPuexuIHvHiaF3iGkQpDV/AVhuoiv mCNT99BNWuSVtvL+tHwGYPCCp2opGePCMiVAKyRmr61lCH+hfp2FN5YeCh9QZi32C3 AJ8TeQ8z8lQxmHbEBFQZmYpA48u6Q0+jjjOEqD/P0W7wzdFBPMfMgifjtLqBN+zUpU kZjYoG1FLnSOQ== Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-2db2add4516so45429797b3.1; Sun, 27 Feb 2022 02:30:19 -0800 (PST) X-Gm-Message-State: AOAM532mHCp95nbV8Efto37FlUbEYyWjk/LaMuQeDPLE0Df8+LXomhpP G8i4Gf8PbC6rQor7SL7uKkZbUAuwbWDepksjyx4= X-Received: by 2002:a0d:cc58:0:b0:2d8:923:7e96 with SMTP id o85-20020a0dcc58000000b002d809237e96mr14505414ywd.60.1645957818120; Sun, 27 Feb 2022 02:30:18 -0800 (PST) MIME-Version: 1.0 References: <20220226220639.1173594-1-Jason@zx2c4.com> <20220226220639.1173594-3-Jason@zx2c4.com> In-Reply-To: From: Ard Biesheuvel Date: Sun, 27 Feb 2022 11:30:06 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 2/3] ACPI: allow longer device IDs To: "Jason A. Donenfeld" Cc: Len Brown , "Rafael J. Wysocki" , Linux Crypto Mailing List , ACPI Devel Maling List , Linux Kernel Mailing List , Alexander Graf , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Sun, 27 Feb 2022 at 11:03, Jason A. Donenfeld wrote: > > On 2/27/22, Ard Biesheuvel wrote: > > On Sat, 26 Feb 2022 at 23:07, Jason A. Donenfeld wrote: > >> > >> From: Alexander Graf > >> > > > > Please don't invent patch authors like that. Alex's patch that started > > this discussion was completely different. > > Considering the investigative side ("why won't the _CID match?") and > most the commit message were Alex's, and that those things comprise > 95% of what this patch is, and that the code change itself isn't even > part of anything Turing complete, I most certainly did not feel > comfortable stripping Alex's authorship. Instead I added myself as a > co-author at the bottom. When in doubt, err on the side of crediting > others. Alex also took a look at this patch, I am under the impression > of at least, before it went out. Let's minimize the paperwork > policing, okay? I think it'd make for a much more pleasant space here. Seriously? You want to go down the road again of poisoning the atmosphere here, and blaming everyone else for doing it? I had enough of that with the Zinc debacle, and I thought we had moved beyond that, after having collaborated constructively with you on various topics over the past couple of years. Please stop with the ad hominems in response to criticism on factual aspects of your code. Putting someone else's authorship on code they did not write is not cool, and pointing that out is *not* what is making this space unpleasant. And 'paperwork policing' is sadly an important aspect of a high profile open source project such as Linux. > If Alex objects he can just simply say, "hey feel free to remove me as > author," and it'll be simple as that, and again doesn't involve your > policing. > When you ask for my review, you get my review. If there are aspects of your contributions that are a priori exempt from criticism, I think you're in the wrong place. > >> We create a list of ACPI "PNP" IDs which contains _HID, _CID, and CLS > >> entries of the respective devices. However, we squeeze them into struct > >> acpi_device_id, which only has 9 bytes space to store the identifier. It > >> originally had 16 bytes, but was changed to only have 9 in 6543becf26ff > >> ("mod/file2alias: make modalias generation safe for cross compiling"), > >> presumably on the theory that it would match the ACPI spec so it didn't > >> matter. > >> > > > > Please clarify that this applies to the module metadata side of > > things. The ACPI subsystem already captures and exposes _HIDs and > > _CIDs that are longer than 8 characters, which is why simply > > increasing the size of this field is sufficient to create modules that > > can match devices that expose a CID that is longer than 8 bytes. > > Good point for strengthening the argument here. Will do. > > > > >> Unfortunately, while most people adhere to the ACPI specs, Microsoft > >> decided that its VM Generation Counter device [1] should only be > >> identifiable by _CID with a value of "VM_Gen_Counter", which is longer > >> than 9 characters. > >> > >> To allow device drivers to match identifiers that exceed the 9 byte > >> limit, this simply ups the length to 16, just like it was before the > >> aforementioned commit. Empirical testing indicates that this > >> doesn't actually increase vmlinux size, because the ulong in the same > >> struct caused there to be 7 bytes of padding anyway. > >> > > > > The padding situation only applies to struct acpi_device_id, whereas > > ACPI_ID_LEN is used in other places as well. Also, the size of vmlinux > > only covers statically allocated instances in the core kernel, and > > most of the ACPI_ID_LEN uses are probably in drivers. So whether > > vmlinux changes size or not is not that relevant. > > I actually looked at every usage in the tree (there aren't that many) > and couldn't find a single one where behavior changed, performance > changed, or memory usage changed. I thought we looked together on IRC > so I'm surprised to see you mention this, but maybe I misunderstood > you. Anyway, I can't see the size increase impacting anything at all. > If you see a case, this would be the time to mention that you see > something. I didn't find anything though. > If you did not check the rodata/data/bss sizes of all modules depending on this macro, or checked their memory usage at runtime, you cannot definitively say that nothing has changed. *However*, as I argued below, using ACPI_ID_LEN to allocate a string that needs to hold a HID or CID provided by the ACPI subsystem might well result in a buffer overrun, as the ACPI subsystem will happily return longer strings. So my conclusion is that the change is ok, which is why I gave my reviewed-by. > > Patch 6543becf26ff was wrong to change ACPI_ID_LEN, because it failed > > to take into account any other uses of ACPI_ID_LEN, and did not bother > > to explain why the change was necessary in the context of what it was > > trying to achieve. > > I'm not sure there really were other usages back then. The commit > message seems descriptive enough to me too. This was about cross > compiling, so padding. But it certainly did seem to limit future > drivers in an unintended way, as you wrote: > > > So, given that we need more than 8 characters to match drivers to > > devices exposed by Hyper-V (or other VMMs adhering to the VMGENID > > spec), I think this change is necessary and correct. > > Right, that's the idea. > > > > > > So, with the authorship/signoff corrected, and the commit log clarified, > > > > Reviewed-by: Ard Biesheuvel > > Thanks. > > Hopefully we'll hear from Rafael this week. > > Jason