From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 324CFC74A5B for ; Fri, 17 Mar 2023 13:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C232B6B0075; Fri, 17 Mar 2023 09:02:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD41C6B0078; Fri, 17 Mar 2023 09:02:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC2E06B007B; Fri, 17 Mar 2023 09:02:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9EA2A6B0075 for ; Fri, 17 Mar 2023 09:02:53 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5C64B121817 for ; Fri, 17 Mar 2023 13:02:53 +0000 (UTC) X-FDA: 80578405026.13.58A7AD3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id A06B0140038 for ; Fri, 17 Mar 2023 13:02:50 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=HvPehhY8; spf=pass (imf23.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679058170; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=A0vE0im1xKOCFAdNDMRXQKU5TCHE9dIpJxMsVSEi7mA=; b=aoj3VEu9huT43n6FZEhay+wDYDKwdMaE6xM/pPSWgXoQCiTzO577RKUSlnwABPr37UZXFG JY3JkBFv4b7aqGCDN+TO9bOW/OQehrvuZn60N39y3TE5+CAWqCB1DO+1ljCpjdqdls0Efx jhotqVI1IYZiiGCVZwLlJHZLMI6wgvU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=HvPehhY8; spf=pass (imf23.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679058170; a=rsa-sha256; cv=none; b=pOmYnVlN7a1SRyyugdiC/yFFPXJhKR0m+WckWJIo2RQhJsH5aSboTaFEsE+0GqzbPj2JFE rtlXmXV2idj5e8XVX7C/f+PNsCvgjQExq2/bislBQ9aVpQvZlasvSiUyqvtdpzcUWhRiXU /7in7L3pOGA9f1qYmF36M06JpTh2eqc= 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7F1F662275; Fri, 17 Mar 2023 13:02:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65378C433D2; Fri, 17 Mar 2023 13:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679058168; bh=0/MuCA88Rv01nDRWL/ZZb4+0d5VshaLoJ6ID1Qur+0Y=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=HvPehhY83QlNIsQd/0sexqdigHgt/ORfo9kLbl/cPrkyofeHMJU4A5ZW9Ckm+DApt lWrkzBfx/df9Q07mbVPZHhEVBYxLeRcKTGmF7EPqTwAjVaWnKISWYDxJIHO0rLCCrW 9aZVYzD1YVMBjoIfrnX8Jrx9x4VhfJ3Pm423VuC0= Subject: Patch "fs: sysfs_emit_at: Remove PAGE_SIZE alignment check" has been added to the 4.19-stable tree To: ebiggers@google.com,ebiggers@kernel.org,gregkh@linuxfoundation.org,joe@perches.com,linux-mm@kvack.org,lucaswei@google.com,yujie.liu@intel.com Cc: From: Date: Fri, 17 Mar 2023 14:02:38 +0100 In-Reply-To: <20230317062743.313169-1-ebiggers@kernel.org> Message-ID: <167905815836131@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore X-Stat-Signature: kbm76cryfmu6mk5mp3pgfhc7npckihgm X-Rspam-User: X-Rspamd-Queue-Id: A06B0140038 X-Rspamd-Server: rspam06 X-HE-Tag: 1679058170-807372 X-HE-Meta: U2FsdGVkX1/AP+b0NiDqj3o8ak61nsJ3EL74rTVVSt167XoHmRHUD2hx9HBK3jx0LyU436fGRzTQWFExXJ3wk2Rwd0PkH/xRiArBbOEBz01pTiS2p3fxAoGEDZ7CBxdSyDQ9AG/xG7oAY7eSeq1x9LfpZsFaL6DSmjNp6Z/NpqqhTmEAD603rzwCfKOScVy+dsWgpYCu96190pbq+qZ+5NZsotyh7PrbK3jMk4EJcxxCXUPRmhK+oNcWvpF6+WdqlfKbmqeu2c9HtROSOzg8rmpW7TuhMhv83xk8sD+EZGmgaRwYOM+sRyNbL5W5v0hoW5FaK0YZ6Sm2cTejt50gRC0VIbe++6/AgqMKBt9CyXFLKlFkNS3IIjXllbjxtB7FZ3too/TRNVuuSFqu5KAENPekpQHhqx8A7Q7UG2VS3o8AJkjcNHEv5mxNtPhoT6/MQ/MWzHf0nbJ9Ou4H0OXAnsQ1AfcXdrtHl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+9VPR+y27Yfhqe8PrrZ3JPNUFWPOe+JTEYNA+tSQIDmzA3NodZn/lUVvMDB4zzK8cJP/XO98ekusKgpFGXDjVLT4OKfeE7bt/3d+GIpHu0CpoEs5wMWYkwV7Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is a note to let you know that I've just added the patch titled fs: sysfs_emit_at: Remove PAGE_SIZE alignment check to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fs-sysfs_emit_at-remove-page_size-alignment-check.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From ebiggers@kernel.org Fri Mar 17 13:57:17 2023 From: Eric Biggers Date: Thu, 16 Mar 2023 23:27:43 -0700 Subject: fs: sysfs_emit_at: Remove PAGE_SIZE alignment check To: stable@vger.kernel.org Cc: Joe Perches , Lucas Wei , linux-mm@kvack.org, kernel test robot Message-ID: <20230317062743.313169-1-ebiggers@kernel.org> From: Eric Biggers From: Eric Biggers [No upstream commit because this fixes a bug in a backport.] Before upstream commit 59bb47985c1d ("mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two)") which went into v5.4, kmalloc did *not* always guarantee that PAGE_SIZE allocations are PAGE_SIZE-aligned. Upstream commit 2efc459d06f1 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output") added two WARN()s that trigger when PAGE_SIZE allocations are not PAGE_SIZE-aligned. This was backported to old kernels that don't guarantee PAGE_SIZE alignment. Commit 10ddfb495232 ("fs: sysfs_emit: Remove PAGE_SIZE alignment check") in 4.19.y, and its equivalent in 4.14.y and 4.9.y, tried to fix this bug. However, only it handled sysfs_emit(), not sysfs_emit_at(). Fix it in sysfs_emit_at() too. A reproducer is to build the kernel with the following options: CONFIG_SLUB=y CONFIG_SLUB_DEBUG=y CONFIG_SLUB_DEBUG_ON=y CONFIG_PM=y CONFIG_SUSPEND=y CONFIG_PM_WAKELOCKS=y Then run: echo foo > /sys/power/wake_lock && cat /sys/power/wake_lock Fixes: cb1f69d53ac8 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output") Reported-by: kernel test robot Link: https://lore.kernel.org/r/202303141634.1e64fd76-yujie.liu@intel.com Signed-off-by: Eric Biggers Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -599,7 +599,7 @@ int sysfs_emit_at(char *buf, int at, con va_list args; int len; - if (WARN(!buf || offset_in_page(buf) || at < 0 || at >= PAGE_SIZE, + if (WARN(!buf || at < 0 || at >= PAGE_SIZE, "invalid sysfs_emit_at: buf:%p at:%d\n", buf, at)) return 0; Patches currently in stable-queue which might be from ebiggers@kernel.org are queue-4.19/fs-sysfs_emit_at-remove-page_size-alignment-check.patch queue-4.19/ext4-fix-cgroup-writeback-accounting-with-fs-layer-encryption.patch