From patchwork Wed Jun 28 17:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 113977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9084428vqr; Wed, 28 Jun 2023 10:17:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VcPYYi8eKPY/dZ+EqwHVogJgMa8IX3L11jYJz2HkULeyp0cmEmEnp2M2Re1Bn23OHUIMV X-Received: by 2002:a05:6402:270f:b0:514:971b:7f36 with SMTP id y15-20020a056402270f00b00514971b7f36mr26920952edd.3.1687972671271; Wed, 28 Jun 2023 10:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687972671; cv=none; d=google.com; s=arc-20160816; b=nRkw7OIq+EX5JgoWCDNTcqd1zzwszPesS5vUmCfylR4XRLNB/oaDodrA2ZoEQuN4V2 kyLxtpDSu1OMeUVlTi8ShQZIi1G5mh/0cjCn3NpuGw/chF0sllbU6m/jDuttdMTjKzJP Syfyv58z2KZral3n88Z6nZjbwxgJciWtWzhW7IMHp6aJ8fqsgRHU0NVistrK0J3LyT45 UHsQZKqS5m3L00BugMBVPxY40pU0zgeoJCL07clyKo5Z/uMk3ZXgM//oG3Z1hwRZPSEf k4FmFNG0ghBj0cwhjDHRkodMqNBFaHXTROQxik8SQ7XUvIgjYpDO92qAP74rN9pH4j8H +qcQ== 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=yVNlrr/14l8NEMMiJ6PCzhb8xYGWCKsqMfnP53EwrxI=; fh=r6Q3JMwkzZyrPYliHoBorEIhO9dVLySB+grqvIsmwm4=; b=PZyu3Fej6vK1IG5CIKBZn9FWhLIfzhaSeBpU3pNxUN6q4qpd5Y+gHkjmQBfM6kxJZf jm14h4erfASQDeggLIFnp41kbI9b42fn8QgWHa238ZwsMdEkQJxHJ4Isnx12ziYDMq+f gS3rQ+KznS03V4nUWgbCkXZ29c2ijm/S8aqAFhrRPiydFVCGATEcxgoAli2Qnub2e6CY SL2n+EmLVqceMix0jVznWax81ZOt5oiKE1+gRlD0nlYnCZ8Q/xknnT+mMEVer8xTNNuF T+180xFkLFJZiVo5xNd60eh3uROK7SIqgoC+HmaVRJ5QZCfkhgnEktX8u6Zt20bv8cK8 PhPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PTWv1QJK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020aa7d98f000000b005149e8ae7afsi5273892eds.381.2023.06.28.10.17.26; Wed, 28 Jun 2023 10:17:51 -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=@gmail.com header.s=20221208 header.b=PTWv1QJK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232013AbjF1RN1 (ORCPT + 99 others); Wed, 28 Jun 2023 13:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbjF1RNX (ORCPT ); Wed, 28 Jun 2023 13:13:23 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1834D1BF2; Wed, 28 Jun 2023 10:13:22 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fba64e4fbcso1795085e9.3; Wed, 28 Jun 2023 10:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687972400; x=1690564400; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yVNlrr/14l8NEMMiJ6PCzhb8xYGWCKsqMfnP53EwrxI=; b=PTWv1QJKU2HRW4HCoHyv6rd4D4hXN598rahNdQPquM5ji6Bkm9Z/ypvIgMvS8KsXjE MtrtV+FzG244FE6BuydJ+L9jR6HLhH91KH0yJYCrThPJZrKS9q7lvxhE5NoaodotKIyF /l8otIrOCsVZM60J8SavRQ+CH6MmiihHcjEyF7u/LOef9Ihf6dviGD+KtYhYPkCgxCND nuacdgjPYq8yn1Bi56wPbeh+1ODJM/xLoFUBFkHCA67ayM22+3qV29cBx0nIfuXczqEu xSqxxo6KoGpOGlCK7XYC2mRzR5mm7gvRkB9vIt1sJbEzdzw26+Pk48qX9kXKqMMgiRd4 MViQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687972400; x=1690564400; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yVNlrr/14l8NEMMiJ6PCzhb8xYGWCKsqMfnP53EwrxI=; b=Q1FERfxpgsPxPMd2AgVDgBkStmAg7PxgI9P4UxjeayfdFAhQ5ZSf3uvjbHlgZ3XtYq INqxkJlYJq2L/XTnvIuOYi8d2LAC+t/75vN5UXQHNQgiNAQUCaxG5pn7XulS6bgqzCK8 Vus6ckJhX0hjLgnQQJIpJbOvKG1iCDYCH2fuFFv1N9xePI22esv/15cJZ7nLD/umyfEI P+vR3Lakzi5JmFlIiHa1Tyo/vH8AQrREBshs+wIyKo76wLgmXHY7LFi+ClO/Jo94GbKi aaI5ty4hiDZoKZRSYqYMJvRuiwNAfbYnQWep8VUjqyrMQuY5YXt2oI6K1gtTlbX1TGhU lcIw== X-Gm-Message-State: AC+VfDywYerXFCn3711oNPJ89Q7w8U+hqiq0DVRWPyvPJpSck1zf8u9h Qozek8wc4g5QT4wO/f7wpjKYhWxV0ow= X-Received: by 2002:a7b:c451:0:b0:3fa:9850:8b1d with SMTP id l17-20020a7bc451000000b003fa98508b1dmr6727023wmi.30.1687972399849; Wed, 28 Jun 2023 10:13:19 -0700 (PDT) Received: from localhost (cpc1-brnt4-2-0-cust862.4-2.cable.virginm.net. [86.9.131.95]) by smtp.gmail.com with ESMTPSA id z24-20020a05600c221800b003fa96fe2bd9sm9379883wml.22.2023.06.28.10.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 10:13:19 -0700 (PDT) From: Stafford Horne To: LKML Cc: Rich Felker , Stafford Horne , Szabolcs Nagy , Jonas Bonn , Stefan Kristiansson , linux-openrisc@vger.kernel.org Subject: [PATCH] openrisc: Revert adding fpcsr to sigcontext to unbreak userspace ABI Date: Wed, 28 Jun 2023 18:13:04 +0100 Message-Id: <20230628171306.2608480-1-shorne@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1769967631514820946?= X-GMAIL-MSGID: =?utf-8?q?1769967631514820946?= With commit 27267655c531 ("openrisc: Support floating point user api") I inproperly added an entry to the struct sigcontext which caused an unwanted to chagne to the userspace ABI. Revert this change to restore the ABI back to the pre kernel v6.4 ABI. This means that fpcsr will not be accessible in signal handlers, but that should be fine. Fixes: 27267655c531 ("openrisc: Support floating point user api") Reported-by: Szabolcs Nagy Closes: https://lore.kernel.org/openrisc/20230626213840.GA1236108@port70.net/ Signed-off-by: Stafford Horne --- arch/openrisc/include/uapi/asm/sigcontext.h | 1 - arch/openrisc/kernel/signal.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/arch/openrisc/include/uapi/asm/sigcontext.h b/arch/openrisc/include/uapi/asm/sigcontext.h index ca585e4af6b8..8ab775fc3450 100644 --- a/arch/openrisc/include/uapi/asm/sigcontext.h +++ b/arch/openrisc/include/uapi/asm/sigcontext.h @@ -28,7 +28,6 @@ struct sigcontext { struct user_regs_struct regs; /* needs to be first */ - struct __or1k_fpu_state fpu; unsigned long oldmask; }; diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 4664a18f0787..80f69740c731 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -50,7 +50,6 @@ static int restore_sigcontext(struct pt_regs *regs, err |= __copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long)); err |= __copy_from_user(®s->pc, &sc->regs.pc, sizeof(unsigned long)); err |= __copy_from_user(®s->sr, &sc->regs.sr, sizeof(unsigned long)); - err |= __copy_from_user(®s->fpcsr, &sc->fpu.fpcsr, sizeof(unsigned long)); /* make sure the SM-bit is cleared so user-mode cannot fool us */ regs->sr &= ~SPR_SR_SM; @@ -113,7 +112,6 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long)); err |= __copy_to_user(&sc->regs.pc, ®s->pc, sizeof(unsigned long)); err |= __copy_to_user(&sc->regs.sr, ®s->sr, sizeof(unsigned long)); - err |= __copy_to_user(&sc->fpu.fpcsr, ®s->fpcsr, sizeof(unsigned long)); return err; }