Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3822915ybh; Tue, 17 Mar 2020 07:15:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuO/CzRQdjlZ4Jia+5z2MmvkbZlFUtGm06+wNT68Gc/KFhzexBXLSOcL1XI6BE+X0jCGv6C X-Received: by 2002:a9d:77d0:: with SMTP id w16mr3875735otl.66.1584454518061; Tue, 17 Mar 2020 07:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584454518; cv=none; d=google.com; s=arc-20160816; b=pO2sq/dat1PT2ivpIaLspC1f5apgBcitWSHTVAva+RYbdf3/gbAH4qSfkOsPLsL49p PHoNBBnB90/J+/z9hf/6fOHMM393l07Bvy4+6KcTtaIxGEn0OZbPGxVdPsVpxoAupx3a 46gdFifC5QKmTGoAJ9GuHEqYmv4iA9Lmyaj8PwBgMIIZe8LaGmxTjbzg/oeCgIxqxTdA V7RPrMX4WW37juaPztUSX95nNs8j7KmQiO56QNuRYXZWp+HaWUNuCDtMqrVk29V6Taz4 eH8MWBAyyuaerac45q+i++s3cDp+8JYT/+XLcvaq+Ww09aEyauPNmsyQUT8Z2UxDHKlZ EFHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:message-id:subject:cc:to:from:date; bh=FtvIpWP0zQegbyCGbwbjhMewIxmMj0RiuR1MJoB41T8=; b=h0FgVZuza+9JGGeKLOnauT6qNe35fgAqm6LTbHdTVDaWqUQygCfSLxI+1n9Xn4/bse P3Mu5V0I2ktGXl49Z+SaVPmcgQxG9e/2O7AY6YJ/NpaOkxzz+mcDqDK+NzzkTouJcpKE X+JiIjOmc0sl8Suuoh++cmfDeS2UuQwANPK4mKn/bjiB2mHGazsuLyIiXsY2OlqHIwkf PgICR6LnPSWM+p/Goc2nwsC/yiGgemqJd3aGq60P8L3yrnbnxLwBJhzPTfSOv2aYpTfC X3xP+2p2Ol6p7+WSwJyUjVD8aku6/+60xi2fMZdqiyejoauWSoqbbHcWIKtgO7wlc1KZ eUPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si1758402otc.153.2020.03.17.07.15.04; Tue, 17 Mar 2020 07:15:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbgCQOOM (ORCPT + 99 others); Tue, 17 Mar 2020 10:14:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:45998 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbgCQOOM (ORCPT ); Tue, 17 Mar 2020 10:14:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C223EABDC; Tue, 17 Mar 2020 14:14:10 +0000 (UTC) Date: Tue, 17 Mar 2020 15:14:09 +0100 From: Jean Delvare To: LKML , Linux I2C Cc: Bartosz Golaszewski , Arnd Bergmann , Greg Kroah-Hartman Subject: VAIO EEPROM support in at24 Message-ID: <20200317151409.7940926c@endymion> Organization: SUSE Linux X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, As the legacy eeprom driver is being phased out, I am reviewing all its use cases to ensure that the at24 driver will be a suitable replacement. One issue I have found is the handling of specific EEPROMs found on the SMBus of some Sony VAIO laptops. The legacy eeprom driver would expose them to user-space, read-only for all users. It would also recognize them as VAIO EEPROMs and would hide some bytes from non-root users because these bytes contain the BIOS password in a lightly encoded form. In order to keep the same level of functionality, we would have to offer the same with the at24 driver. At this time, the user has to instantiate a "24c02" device manually from user-space. By default this device has permissions 600, which is insufficient for users, and dangerous for root, so a quick chmod 444 is needed. Without the password issue, I would just document the procedure and live with it. However in order to protect the password from being read by random users, the driver itself needs to know that it is dealing with a specific type of EEPROM. It seems that we need to introduce a new device flavor to the at24 driver for this purpose. I see that we already have a number of specific flags (AT24_FLAG_SERIAL and AT24_FLAG_MAC) so I suppose we could add something similar for these VAIO EEPROMs. Something like: /* Some Sony VAIO laptops have a 24c02 at 0x57 with product info */ AT24_CHIP_DATA(at24_data_sony_vaio, 2048 / 8, AT24_FLAG_READONLY | AT24_FLAG_IRUGO | AT24_FLAG_SONY_VAIO); Then I suppose it's only a matter of conditionally zeroing a selected range in at24_read() before it returns, to hide the password from non-root users. Before I start implementing the idea above, I would like to know if anyone objects to it, or has a better idea? Thanks, -- Jean Delvare SUSE L3 Support