Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3073758pxm; Mon, 28 Feb 2022 11:28:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJy42JOlbpS3E2V0Z2meB/wHszl+W9TsSb9nHUgdltDrCYCg/wx3unxWWzkcH7vx9IuA91Iz X-Received: by 2002:a17:902:ea12:b0:151:58b1:e5be with SMTP id s18-20020a170902ea1200b0015158b1e5bemr10245652plg.149.1646076492539; Mon, 28 Feb 2022 11:28:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646076492; cv=none; d=google.com; s=arc-20160816; b=dqorGR1jQnz7UlDFj3lIdY0167wyxCtPOnToDj2lO/qyR6LaS4UcwA/xFLCO/vfywz VfcgCfZ77a8ydx28lGP2PJZ/4Bl5XKLm3kGotTxLhULwUFMCaXhXqendGA0KLZtQgIAd bvms5y20ACKVe9PxNmcxVyXklblqYkjWrtYSpv5VGAutQgtvPYXEcwNrLwL+DaNGHP7V tzgYBa9ks1N7sJVXihunL2q4PHxgXvN5nnLVwfSQ6LzOS1b2PcMw9QH3UQBzlyIHyei+ t7HD2VUQjRCseIHmZ1yIs4ZOFvA1s7fosb2VUyJQo6zNKmwRiPnFboLIhs+ilbmGtfRO 8XRA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/FdY4NAiU1tX9KqAY5+mN5z4QxIC3RkhBmSJSjqB4AI=; b=kBEv4UVxxKO9ZPPbn9QsvoqbwMpmv0R69BndO03ZpogVYcAbl+9nEFj+g62E/ouicr U5aFddU9ZuF+D9k4VGju4WzF2PsCXI0A46MK96qcdT8v9gFGF+Ko5A+rrJrqtalJWFuu 5JxmjMWhc7nYH1Mxlr/DAYVuc8c2YF5KgiPqLJztlXn2bsLZ4uxhnyrfdVphmSml8Vs6 iE/8IG8PpPuFY7hRQ9h6TAUcT/I9LZHGc4D8g7GfKJ6L57vVOlnSgv03uStbt8d0HQRH 8jg9y/kPfIDonFqKmrN5sYZWJKM5bw7hAmg6MYTTdJr2c0AQCPuEDl5fMcdTNPAoRedr mFQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=oGJGxbfO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 19-20020a630f53000000b00372b2baa2e7si10400503pgp.392.2022.02.28.11.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 11:28:12 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=oGJGxbfO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F02A8D64E3; Mon, 28 Feb 2022 11:14:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237312AbiB1SlO (ORCPT + 99 others); Mon, 28 Feb 2022 13:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240546AbiB1Sk5 (ORCPT ); Mon, 28 Feb 2022 13:40:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578D7FDE; Mon, 28 Feb 2022 10:34:40 -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 08697B81626; Mon, 28 Feb 2022 18:34:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84DADC340E7; Mon, 28 Feb 2022 18:34:36 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="oGJGxbfO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1646073274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/FdY4NAiU1tX9KqAY5+mN5z4QxIC3RkhBmSJSjqB4AI=; b=oGJGxbfOARcAlVZiJzVzpZNt2+8dVPKBfchCynJss6e2v/UZpaSL1iTm9H0F2bvGI1EGmi yUUB7uQSkxQbxQxijFs2qW6I4Wwur8nVpAk9n7A6HAngODF/C/gPj8y4Lf1RAmzIjaxUat Ejj1SzHLRtFZJFpzLr0OMtUvpuYCO7E= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 19209f25 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 28 Feb 2022 18:34:33 +0000 (UTC) From: "Jason A. Donenfeld" To: rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-acpi@vger.kernel.org, Alexander Graf , Mika Westerberg , Andy Shevchenko , Hans de Goede , Len Brown , Greg Kroah-Hartman , Ard Biesheuvel , "Jason A . Donenfeld" Subject: [PATCH 2/3 v6] ACPI: allow longer device IDs Date: Mon, 28 Feb 2022 19:33:55 +0100 Message-Id: <20220228183355.9090-1-Jason@zx2c4.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org From: Alexander Graf We create a list of ACPI "PNP" IDs which contains _HID, _CID, and CLS entries of the respective devices. However, when making structs for matching, we squeeze those IDs into acpi_device_id, which only has 9 bytes space to store the identifier. The subsystem actually captures the full length of the IDs, and the modalias has the full length, but this struct we use for matching is limited. 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. 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 on 64-bit, because the ulong in the same struct caused there to be 7 bytes of padding anyway, and when doing a s/M/Y/g i386_defconfig build, the bzImage only increased by 0.0055%, so negligible. This patch is a prerequisite to add support for VMGenID in Linux, the subsequent patch in this series. It has been confirmed to also work on the udev/modalias side in userspace. [1] https://download.microsoft.com/download/3/1/C/31CFC307-98CA-4CA5-914C-D9772691E214/VirtualMachineGenerationID.docx Signed-off-by: Alexander Graf Cc: Rafael J. Wysocki Cc: Mika Westerberg Cc: Andy Shevchenko Cc: Hans de Goede Cc: Len Brown Cc: Greg Kroah-Hartman Cc: Ard Biesheuvel Co-authored-by: Jason A. Donenfeld [Jason: reworked commit message a bit, went with len=16 approach.] Signed-off-by: Jason A. Donenfeld --- Hi Rafael, This patch is directed toward you specifically. The first and last patch of the series this is part of have been through the ringer of review a bit already and do not specifically require your attention, but we wound up getting hung up on an ACPI ID matching API limitation. This patch fixes that limitation with this patch that you see here, with a trivial one line fix, which does require your attention. The other patches will go through my random.git tree naturally, but because those patches depend on this one here, in order to compile without warnings (and be functional at all), it would be nice if you would provide an "Acked-by" on it and permit me to /also/ take it through my random.git tree (if it looks like a correct patch to you, of course). This would make the merge logistics a lot easier. Plus it's a small +1/-1 line change. This v6 updates the commit message. Please have a look and let me know what you think. Thanks, Jason include/linux/mod_devicetable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 4bb71979a8fd..5da5d990ff58 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -211,7 +211,7 @@ struct css_device_id { kernel_ulong_t driver_data; }; -#define ACPI_ID_LEN 9 +#define ACPI_ID_LEN 16 struct acpi_device_id { __u8 id[ACPI_ID_LEN]; -- 2.35.1