From patchwork Thu Sep 13 23:59:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10600193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5889B157B for ; Fri, 14 Sep 2018 00:00:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB522B630 for ; Fri, 14 Sep 2018 00:00:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D310B2B61D; Fri, 14 Sep 2018 00:00:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B0E02B632 for ; Fri, 14 Sep 2018 00:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbeINFMk (ORCPT ); Fri, 14 Sep 2018 01:12:40 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53940 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeINFMk (ORCPT ); Fri, 14 Sep 2018 01:12:40 -0400 Received: by mail-wm1-f66.google.com with SMTP id b19-v6so171530wme.3; Thu, 13 Sep 2018 17:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rtOOC3GLNWGMW84i9cg4IatCMDh5KWmKK57ezAje8XQ=; b=A+SazxOIVOng2Qqd9ERzco+Dg3+REfS/RE60E3X3G7QKqhHyhW4Bctoj6r3V3sSWb7 3glLbnzgm6d+f9IDNotGsedqYq6iGL63xHOXtWpZrRuvpLASra0hy5h4cmNFMcvNWfDR qAVWAFj9M8pXAtW85OiluZVxbAD8ZFeOhPv6cPNnJm/NusAeShjgIuzJMHo++JcTgdyj w/Jng7jF61j3/bF7bc2kRV3KlOzOCHYpNZkPMeAkPjKds/Sjhs0yQ49pyxdcwDQjdWzi L/jzWMXalII5fYifMf06v8JF8i50pU0MU7dFkr3zpjBQyShjt8ZYv5m8+q+hFwc9WSDC AjJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rtOOC3GLNWGMW84i9cg4IatCMDh5KWmKK57ezAje8XQ=; b=l4sSvn3WV9A+isolO6KFr99MnCw3Drut6MHL9eQw2GM1llr27bT1QTWmA/e7kIxsjY Td17pS1d8WFKicEYeJgSnYCedeeUk+20EKzP2N5UzlBYYxj+kOz2hrhr/FHMivLAHPJ9 bKmgy1UqEDgr4qzj7o9JvRWQggoKExxV2GvXLPvJRoEwtrdfmFUXsnT5I43vCxJWQnMf uPB13ZJPLiAEwTy6fDsaU8dwKClO8l3Sg1P0dHH3Z6tckR1TsSqD918y3hD/ddZMAjRq NoDaaZY6eYsf9RZNBtABwjqv7cIQBDLAHQPSGhrn1DVKpcCMF62CExHo/m1Y0GdBzwzq pCDQ== X-Gm-Message-State: APzg51BFPTYEYE4BNYy2H5lVrVWPN/5J9TS/NgKh18lpPcPsOuJdM/m3 CcNyASqiqH6BjYmflbi1Qy8= X-Google-Smtp-Source: ANB0Vda0HzlhPf6xAxFQ1Vug4I/lgs25piWEDe1TkL858TCqU7JMrwnzCAuIgsyq9rbMlUHBnxdQPQ== X-Received: by 2002:a1c:e70b:: with SMTP id e11-v6mr264388wmh.22.1536883253277; Thu, 13 Sep 2018 17:00:53 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id x125-v6sm118129wmg.27.2018.09.13.17.00.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 17:00:52 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Stefan Agner , Rasmus Villemoes , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Arnd Bergmann , Greg Kroah-Hartman , Masahiro Yamada , Joe Perches , Dominique Martinet , linux-sparse@vger.kernel.org Subject: [PATCH 1/2] Compiler Attributes: naked was fixed in gcc 4.6 Date: Fri, 14 Sep 2018 01:59:40 +0200 Message-Id: <20180913235941.31211-2-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180913235941.31211-1-miguel.ojeda.sandonis@gmail.com> References: <20180913235941.31211-1-miguel.ojeda.sandonis@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 9c695203a7dd ("compiler-gcc.h: gcc-4.5 needs noclone and noinline on __naked functions") added noinline and noclone as a workaround for a gcc 4.5 bug, which was resolved in 4.6.0. Since now the minimum gcc supported version is 4.6, we can clean it up. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290 and https://godbolt.org/z/h6NMIL Cc: Stefan Agner Cc: Rasmus Villemoes Cc: Eli Friedman Cc: Christopher Li Cc: Kees Cook Cc: Ingo Molnar Cc: Geert Uytterhoeven Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Joe Perches Cc: Dominique Martinet Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Reviewed-by: Luc Van Oostenryck Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda Reviewed-by: Stefan Agner --- include/linux/compiler-gcc.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 763bbad1e258..25d3dd6b2702 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -84,14 +84,8 @@ * to trace naked functions because then mcount is called without * stack and frame pointer being set up and there is no chance to * restore the lr register to the value before mcount was called. - * - * The asm() bodies of naked functions often depend on standard calling - * conventions, therefore they must be noinline and noclone. - * - * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. - * See GCC PR44290. */ -#define __naked __attribute__((naked)) noinline __noclone notrace +#define __naked __attribute__((naked)) notrace #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) From patchwork Thu Sep 13 23:59:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10600195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE1556CB for ; Fri, 14 Sep 2018 00:00:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 800322B5F7 for ; Fri, 14 Sep 2018 00:00:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73CF42B613; Fri, 14 Sep 2018 00:00:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFDAF2B624 for ; Fri, 14 Sep 2018 00:00:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbeINFMm (ORCPT ); Fri, 14 Sep 2018 01:12:42 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35398 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728090AbeINFMm (ORCPT ); Fri, 14 Sep 2018 01:12:42 -0400 Received: by mail-wm1-f66.google.com with SMTP id o18-v6so183631wmc.0; Thu, 13 Sep 2018 17:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kgNdH1mJaCf3YmynMLZAEJJb4IOLoepeJBnI5H762Gw=; b=ZMBOoo3EBAG80KeCqfw76V4Kp8Ks/Kp5O1E7gSgTxi5nXLN3oaE0Cdl7wLgiia+3QF mpc+y4gjtGhp5lxz8Nz2wgR4PSvWlPNbjKeVl0LClQll7XE+ruGKJPUu0BCC498Ri3L4 h8kPtPlYcS55x7U9l9ThFXWt6jdFFuYflLc6Ukv1qLEvvGZTCRg2TVB3OufoZlKe/c9o 7Fg5ZY9/bG1flipvpmQWQmIj5Cd5T+x0Nx1ecu31wmJtLq1wrku2qT+b0vYi5MvmYroI vxn/3+0G6yft10PD2tYx6Tk0wGQ9QunfNqEq9MNEkOodPUxj9bBfc/HxJ3iSd1R3FySz /yow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kgNdH1mJaCf3YmynMLZAEJJb4IOLoepeJBnI5H762Gw=; b=Y4ypCM92M0z1pkCv48/ksAZUUPuONa15YNTZNkFueGxu49eugR4O5cnKwiVwtMvENU qCSTf8MnhQW2JFP6oBtXqNTsUlcF3bk4SFzXrLZUiSF242TKbf0wi9yqsfD7EciCgMTS CFFHUGmUhJrYfmlAyyNttYmDcj6hmQ0YgKkKS3HvkYJd6yHNRjDIct+hKmcVg81wDB1/ nIGc//QoebsYCfQjvlcm3ip4OJbz78HHtDWE1JzjMCK/zHkEsUerGoBtV0HctmfFOhb6 NmMoT37yJGY0a1TBejY+M44aXUNeDup5UbqlVkROCWHIzSAgMZEGtxZ0z62WE/Ou+crj JbQg== X-Gm-Message-State: APzg51BcOqphWyQoamRsZEj3bC2lIi/4H08Be/JQ+xQ0IlZ2FPqJv1NF 3dNIAopl9X555jg4DMgrsZY= X-Google-Smtp-Source: ANB0VdZg02j/0SVerxwHXEogWddqdcFfOmXv+4UnYjOWqN15DPKgGgszUlQB01uOuTDNTl4yb/Nz/Q== X-Received: by 2002:a1c:a1c6:: with SMTP id k189-v6mr251619wme.93.1536883254676; Thu, 13 Sep 2018 17:00:54 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id x125-v6sm118129wmg.27.2018.09.13.17.00.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 17:00:54 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Stefan Agner , Rasmus Villemoes , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Greg Kroah-Hartman , Masahiro Yamada , Joe Perches , Dominique Martinet , linux-sparse@vger.kernel.org Subject: [PATCH 2/2] Compiler Attributes: naked can be shared Date: Fri, 14 Sep 2018 01:59:41 +0200 Message-Id: <20180913235941.31211-3-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180913235941.31211-1-miguel.ojeda.sandonis@gmail.com> References: <20180913235941.31211-1-miguel.ojeda.sandonis@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The naked attribute is supported by at least gcc >= 4.6 (for ARM, which is the only current user), gcc >= 8 (for x86), clang >= 3.1 and icc >= 13. See https://godbolt.org/z/350Dyc Therefore, move it out of compiler-gcc.h so that the definition is shared by all compilers. This also fixes Clang support for ARM32 --- 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive"). Cc: Stefan Agner Cc: Rasmus Villemoes Cc: Eli Friedman Cc: Christopher Li Cc: Kees Cook Cc: Ingo Molnar Cc: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Joe Perches Cc: Dominique Martinet Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Suggested-by: Arnd Bergmann Reviewed-by: Luc Van Oostenryck Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda Reviewed-by: Stefan Agner --- include/linux/compiler-gcc.h | 8 -------- include/linux/compiler_types.h | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 25d3dd6b2702..4d36b27214fd 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -79,14 +79,6 @@ #define __noretpoline __attribute__((indirect_branch("keep"))) #endif -/* - * it doesn't make sense on ARM (currently the only user of __naked) - * to trace naked functions because then mcount is called without - * stack and frame pointer being set up and there is no chance to - * restore the lr register to the value before mcount was called. - */ -#define __naked __attribute__((naked)) notrace - #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #define __optimize(level) __attribute__((__optimize__(level))) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 3525c179698c..db192becfec4 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -226,6 +226,14 @@ struct ftrace_likely_data { #define notrace __attribute__((no_instrument_function)) #endif +/* + * it doesn't make sense on ARM (currently the only user of __naked) + * to trace naked functions because then mcount is called without + * stack and frame pointer being set up and there is no chance to + * restore the lr register to the value before mcount was called. + */ +#define __naked __attribute__((naked)) notrace + #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) /*