From patchwork Sun Oct 23 20:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp126307wru; Sun, 23 Oct 2022 13:40:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UUMvllESJzggmkn5IrgIk0uv21rqlcuwM1L8u0uWjskC/QCbsmuqUPcw2ZVKLYe7JlzzY X-Received: by 2002:a17:903:4d7:b0:178:8564:f754 with SMTP id jm23-20020a17090304d700b001788564f754mr30265830plb.60.1666557645323; Sun, 23 Oct 2022 13:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666557645; cv=none; d=google.com; s=arc-20160816; b=tB4AAZOT3KT0ZKN8aaDj7HZjSMeaa+KEqx2YutIPQfMOV5IKtLY2gaNYah/dR2LZjr rE4XBnuy/NqaTdJlrx3gm7KCbaOwrY6vaX7zv/BzxQ3qyb02Z3o1dmzNbwXPmTBEMglX mTlspWeO8D3SImjg2y4IdoPyLjOdbPUzJ80CzBSz5fTVxngzk6gBPdFIgwIikIyvBDNf SMg1AqN938SejWhxj+3UFKUxh1KdtlVyqb9LS488tlz5hx1J7fBpxwwMcijn9jfGiADk ztggBAXwxRaFzy0cFnGrTBdRaMkZdIFt6Ax4hJ7kab2R8SwB4zGHfbi2HqBFQuAs43p3 ZkuQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=eCkESx7tLbcl/nHIQwtIPhMNwZ8iCRtVJZ00kAPVrdA=; b=uJD4+ZpCdn3LPZGfDL4G9YpcAb1i8bkQs+iZ/YZkINPQHh0cMKPlChH+dExCEa38I2 0Fxa6qg+IJp8KLgx7B/zczZ7HQzSoynfYozjiUGBuWyIlW5Vh3vlm7OVASA4/5XkXiYc mmrwWyF+xiBtHkDhRNy0uj+T+WDAWaq7Tjc4etemhQX1IPgRTE5V4zhTIuWuxovyJsBW qzgwzaTGr88/6MMLK8WMOKQxs10KZUd2ryysICqawmkAC54akpfVPbcQ7e3Rltaj+Xgn wnqa36wWsfjcCyvlxrnwwtt43lBuR/UYvsKXaf0vASRCcCTGj86okbFEY++DVc6TkAz7 TvJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=QnB2qtO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a63b304000000b00461ffae7b37si9708495pgf.0.2022.10.23.13.40.32; Sun, 23 Oct 2022 13:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=QnB2qtO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbiJWUcp (ORCPT + 99 others); Sun, 23 Oct 2022 16:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiJWUcn (ORCPT ); Sun, 23 Oct 2022 16:32:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C5B6705D; Sun, 23 Oct 2022 13:32:42 -0700 (PDT) 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 D915AB80DCD; Sun, 23 Oct 2022 20:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51389C433D6; Sun, 23 Oct 2022 20:32:36 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="QnB2qtO6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1666557154; 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; bh=eCkESx7tLbcl/nHIQwtIPhMNwZ8iCRtVJZ00kAPVrdA=; b=QnB2qtO6lEOM4mxmjapSCxuIUb838GyXQD9dk5cHuNf7r1kHF1OS2YJOtpj4MajPA79g2y QGM5P4bMHnEZYNxeABp8h+OC9XW5ZhtaXOplvIwtuUPSR4RupWA3lpwNA60vNAAYYFdeXD J2Fu0drXLEG5BiOYGLbxOOeFisHSqfM= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 40fbc149 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 23 Oct 2022 20:32:33 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" , Albert Ou , Boris Ostrovsky , Borislav Petkov , Catalin Marinas , Chris Zankel , Christophe Leroy , Dave Hansen , Greg Kroah-Hartman , Guo Ren , "H . Peter Anvin" , Ingo Molnar , Juergen Gross , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Paul Walmsley , Rich Felker , Russell King , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v1 0/2] cleanup stackprotector canary generation Date: Sun, 23 Oct 2022 22:32:06 +0200 Message-Id: <20221023203208.118919-1-Jason@zx2c4.com> MIME-Version: 1.0 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747512349585201299?= X-GMAIL-MSGID: =?utf-8?q?1747512349585201299?= Stack canary generation currently lives partially in random.h, where it doesn't belong, and is in general a bit overcomplicated. This small patchset fixes up both issues. I'll take these in my tree, unless somebody else prefers to do so. Cc: Albert Ou Cc: Boris Ostrovsky Cc: Borislav Petkov Cc: Catalin Marinas Cc: Chris Zankel Cc: Christophe Leroy Cc: Dave Hansen Cc: Greg Kroah-Hartman Cc: Guo Ren Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Juergen Gross Cc: Max Filippov Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Rich Felker Cc: Russell King Cc: Thomas Bogendoerfer Cc: Thomas Gleixner Cc: Will Deacon Cc: Yoshinori Sato Cc: linux-arm-kernel@lists.infradead.org Cc: linux-csky@vger.kernel.org Cc: linux-mips@vger.kernel.org Cc: linux-riscv@lists.infradead.org Cc: linux-sh@vger.kernel.org Cc: linux-xtensa@linux-xtensa.org Cc: linuxppc-dev@lists.ozlabs.org Cc: x86@kernel.org Jason A. Donenfeld (2): stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h stackprotector: actually use get_random_canary() arch/arm/include/asm/stackprotector.h | 9 +-------- arch/arm64/include/asm/stackprotector.h | 9 +-------- arch/csky/include/asm/stackprotector.h | 10 +--------- arch/mips/include/asm/stackprotector.h | 9 +-------- arch/powerpc/include/asm/stackprotector.h | 10 +--------- arch/riscv/include/asm/stackprotector.h | 10 +--------- arch/sh/include/asm/stackprotector.h | 10 +--------- arch/x86/include/asm/stackprotector.h | 14 +------------- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/setup_percpu.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- arch/xtensa/include/asm/stackprotector.h | 7 +------ include/linux/random.h | 19 ------------------- include/linux/stackprotector.h | 19 +++++++++++++++++++ kernel/fork.c | 2 +- 16 files changed, 33 insertions(+), 103 deletions(-) Acked-by: Greg Kroah-Hartman