Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbcD3Wet (ORCPT ); Sat, 30 Apr 2016 18:34:49 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55482 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbcD3Wer (ORCPT ); Sat, 30 Apr 2016 18:34:47 -0400 From: Arnd Bergmann To: Matt Fleming Cc: "Compostella, Jeremy" , Ingo Molnar , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] efibc: avoid stack overflow warning Date: Sun, 01 May 2016 00:34:29 +0200 Message-ID: <18565207.dPI1UNgYiO@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160430201449.GL2839@codeblueprint.co.uk> References: <1461952128-2135409-1-git-send-email-arnd@arndb.de> <20160430201449.GL2839@codeblueprint.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:3+DGuUXZIzhAcI9+RnemLJneF6duQ3fi31T4bJrCFzSIAmiiy7s wIaaCsgSBt0d6zMUb+vge4p43IqlYivCRQNELniOpi1UQWlS57Y7HnPKS2TJ+cViI3qSfma w57Apy28vgphso+bVe7gQm+/jQ6cm07a1tI8skHYRw/ArXOYYdbaTwW//HtlanSGRDOeLab Fg613Y/y06h52/6M/4L6Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:5hmIg21xB/M=:HDeS+9vu1cjFi2YFQLsssZ MZNddIxLNh6ccirNgYGhc+Vipw5dyWrDeQKxUB5d31+ODAeifZ09HcT2ccO5m9CED+tqpssrW uI95qOJZQLet3n0lcJjGsQhosuYvc2bvoKgw45hcvvPq6x+ZL+k3IJQi/bO7xQQdXU2XLyNd9 hDdrTz12v+p9aCC4KV4+a3BahxHZNuVvZSzKFv/NKHBTCiCJwXSQ4jGVkoLB/Blc7gzxtuFX6 1xmqa/fAKR5s3rQa+NAoOGF3Ks2W0ZbziIw8/kvTUzCewUfYL+6QSDIh2JuV9WHa8a88i15wZ 4XOXeYw9HypdeBICQH8RVbeULAR59WZzi8/ivChV2UjhIMtg01V5WFmm/HS5Pw2Gl8SgBy780 pVw6OEJeSwUxxC2ZVB/sH0t80oe29ChGKC9N2jLXFc/WN0KKgtBRBltK7DFQNjCjr3naKGSMY HVc/qxLZdQhq8jqNiLD0ixHASYba3/uMl0DGQozp7VEA/Sw4weRJc8/F2VaYdVvUOOJn2ghCh eRzmTeiJuPYFrO9qPnVKxMLJBjGKumhMXe73PnT2KKiItguYt55qAWEhQYlkxK2R+rYvbvuD2 gP6XXnhnafquRASWUZ3g2BPg/DsxiTa/hyiEEmeI0+d8iZ3v5qq15dWy4qEiN2VqCgMrdVasy DyzyzZa3X6oswhxhTDaMb7dmyQPL81B2h5a5NlFxSiLp5CVhpmijQEqebOEQ1DUpUgSFg6tBg DJ8d36MWaKIjTXLR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1535 Lines: 35 On Saturday 30 April 2016 21:14:49 Matt Fleming wrote: > On Fri, 29 Apr, at 07:48:31PM, Arnd Bergmann wrote: > > gcc complains about a newly added file for the EFI Bootloader Control: > > > > drivers/firmware/efi/efibc.c: In function 'efibc_set_variable': > > drivers/firmware/efi/efibc.c:53:1: error: the frame size of 2272 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] > > > > The problem is the declaration of a local variable of type > > struct efivar_entry, which is by itself larger than the warning > > limit of 1024 bytes. > > > > We know that the reboot notifiers are not called from a deep stack, > > so this is not an actual bug, but we should still try to rework > > the code to avoid the warning. We also know that reboot notifiers > > are never run concurrently on multiple CPUs, so there is no problem > > in just making the variable 'static'. > > I assumed reboot notifiers were guaranteed to be non-concurrent too > but having dug into the callers of kernel_reboot(), I couldn't find > any kind of mutual exclusion. > > How/where is this guaranteed? The sys_restart() system call takes a mutex before calling kernel_restart() or kernel_poweroff(). I've had a closer look now and found that there are a few other callers of kernel_restart, so I guess if you restart using sysctl at the exact same time as calling /sbin/reboot, things may break. It's not something we'd have to worry about in practice, but it does make my patch incorrect. Should we come up with a different way to do it? Arnd