Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4208232iog; Tue, 21 Jun 2022 14:33:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tDm8gjB+m1E9TAGMS/TmjiAlVjgrrB4J48E3AoErNNDvG40cLNrg9vVFGISWIT2LpiILLm X-Received: by 2002:a17:907:962a:b0:711:d519:5ae3 with SMTP id gb42-20020a170907962a00b00711d5195ae3mr74732ejc.711.1655847230403; Tue, 21 Jun 2022 14:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655847230; cv=none; d=google.com; s=arc-20160816; b=RL2aAQlmikG1g2a7EnYl70LtuRKkjmx7hbmgS8aI0/gTvcrsBThFNn5HRWnYEWe3U0 5UdgBjYDAxgt6J2lwhvfv10Bk2ZmlGklM4CZB7ZZ0XtlbXG1Q2X6y2lIzvmpw1cCmEur X0WJZcgvfaCKCSrOlLQ4MGxZLtbrkjT7pA/WNx3n7m40MDbOxcWeiygwZWgOjWvyq93V xrJJgAQS6wU08pGDamNLkHwWcS/FH/8VrWRdUsFKdJWQX2C9bOHZUyyA6nkKDH+IJvI6 Q6dofzXXGa2Qj830/CdVl4xCx/c+GM1gLa29OL9+G5fkBRywUdWQIVfLbnlgzmPBBBxK +aAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=qN/NRwuIjgSkbq8gbi0E6mnXeTQgcHiZe1toNmvBcPw=; b=oBCfT4ulKfDRieUKWdIodScsLZLaXBOaiQ78xzHb6lzrJwD9pCbWaEZIDjIunD7bgP asRRoh1qkX42IDb8sgLrIp0QvFm77YVDbnWGKvJjQw0RVf+jNxfOT2I0WxyxZ5Z6Echk WaGsa38VBIvdX/XItIo/momWmHu1kMh0Idcw+XmCb2AKgXvMFAtCaYSBvKB2fyh74pNn QAFRF+OkX/2nyHtmGM55UXZ73zyeVOJJJDuhIuZ/O7MMt/yxnPxMFrPIejpMqmdAx4SN esoxLeoeIB73ARS8XkOxxPiMWbjNP/QbZM/uQvAThzjZt3hgsaimnIk5nWgTN0cVNtax S4Pg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a056402439300b0042e02caef0fsi13585108edc.28.2022.06.21.14.33.25; Tue, 21 Jun 2022 14:33:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355822AbiFUVTW (ORCPT + 99 others); Tue, 21 Jun 2022 17:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355816AbiFUVTC (ORCPT ); Tue, 21 Jun 2022 17:19:02 -0400 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D7A2F3A9 for ; Tue, 21 Jun 2022 14:04:38 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:59736) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o3l2y-008PZ1-37; Tue, 21 Jun 2022 15:04:28 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:57252 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o3l2w-00G9Ba-OZ; Tue, 21 Jun 2022 15:04:27 -0600 From: "Eric W. Biederman" To: Mathieu Desnoyers Cc: Derek Bruening , Kevin Malachowski , Alexander Mikhalitsyn , Florian Weimer , Carlos O'Donell , Paul Turner , Simon Marchi , Peter Oskolkov , Chris Kennelly , Pedro Alves , Bui Quang Minh , linux-kernel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86 , "H. Peter Anvin" , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Paul E. McKenney" , Boqun Feng , Kees Cook , "Chang S. Bae" , Brian Gerst , Andrei Vagin , Pavel Tikhomirov References: <20220618182515.95831-1-minhquangbui99@gmail.com> <258546133.12151.1655739550814.JavaMail.zimbra@efficios.com> <648712158.13199.1655748645141.JavaMail.zimbra@efficios.com> <87y1xper17.fsf@email.froward.int.ebiederm.org> <871717002.20576.1655841912053.JavaMail.zimbra@efficios.com> Date: Tue, 21 Jun 2022 16:04:18 -0500 In-Reply-To: <871717002.20576.1655841912053.JavaMail.zimbra@efficios.com> (Mathieu Desnoyers's message of "Tue, 21 Jun 2022 16:05:12 -0400 (EDT)") Message-ID: <87pmj1enjh.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1o3l2w-00G9Ba-OZ;;;mid=<87pmj1enjh.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX18zc+rDFOEBT4bWBnCryNsw5KoKma6AAho= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Mathieu Desnoyers X-Spam-Relay-Country: X-Spam-Timing: total 740 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 9 (1.2%), b_tie_ro: 7 (1.0%), parse: 0.90 (0.1%), extract_message_metadata: 14 (1.9%), get_uri_detail_list: 1.29 (0.2%), tests_pri_-1000: 25 (3.3%), tests_pri_-950: 1.22 (0.2%), tests_pri_-900: 1.09 (0.1%), tests_pri_-90: 340 (46.0%), check_bayes: 339 (45.8%), b_tokenize: 11 (1.5%), b_tok_get_all: 165 (22.3%), b_comp_prob: 3.0 (0.4%), b_tok_touch_all: 155 (21.0%), b_finish: 1.00 (0.1%), tests_pri_0: 338 (45.6%), check_dkim_signature: 0.56 (0.1%), check_dkim_adsp: 2.4 (0.3%), poll_dns_idle: 0.59 (0.1%), tests_pri_10: 2.1 (0.3%), tests_pri_500: 7 (0.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] rseq: x86: Fix rseq_cs get cleared when returning from signal handler X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Desnoyers writes: > ----- On Jun 21, 2022, at 3:48 PM, Eric W. Biederman ebiederm@xmission.com wrote: > >> Derek Bruening writes: >> >>> From the viewpoint of dynamic binary translation/instrumentation and >>> memtrace (go/memtrace), removing those RSEQ_CS_FLAG_NO_RESTART_ON_* flags >>> is a good thing as it reduces complexity and makes it easier to handle rseq >>> (which is painful enough to handle already). >> >> It sounds like there is consensus. >> >> Does someone want to code up a simple patch that detects when >> RSEQ_CS_NO_RESTART_ON_SIGNAL and does a WARN_ON_ONCE and fails if >> someone uses so it can be set to Linus in the next merge window. >> >> After no one screams at that patch it should be safe to remove the >> functionality, because you have empirical proof that no one uses >> that functionality. > > Sure, I can whip up something. > > I'll send it to Peter Zijlstra shortly. > > I plan to, as you suggest, WARN_ON_ONCE() when this happens, and return > an error when the rseq flags or rseq_cs flags contain either of the > RSEQ_CS_FLAG_NO_RESTART_ON_* flags. This error is handled by forcing a > killing the process with sigsegv: > > __rseq_handle_notify_resume() > [...] > error: > sig = ksig ? ksig->sig : 0; > force_sigsegv(sig); > > Does it look acceptable ? I think so. force_sigsegv preps things so that when you go into exit_to_user_mode_loop the signal handler kills the process. So assuming that happens after force_sigsegv that looks good. Eric