Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5659355imm; Tue, 26 Jun 2018 15:34:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJpG+m2qeveb3fXYZcXo3zbZ8+qwWV5Wo7B9MhbVjPwU+Wh9RXM2X6EoQRGyK5wHbU/JmXD X-Received: by 2002:a17:902:7202:: with SMTP id ba2-v6mr3348014plb.119.1530052495340; Tue, 26 Jun 2018 15:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530052495; cv=none; d=google.com; s=arc-20160816; b=JDIn05Naojaoc6iMmJu7NMTeOp3dMcqxnxl9SpVJsCg4OumecvD9RZznyAVhp5g0xt L16E1KYgbt6AOrgd5G1kTUZBjJdPqG2mgULUPV6YAG6LahWzcca/MwPupNbzQvZG4AB5 CVVwRE3+6QpaRrTB9T3fIGj8Q6RiET4yF2Uvd9Olz+2SmNw+aRyLwH2GMraNmA5ipRcY cDLezVUXWUIeu4b4Un7oktV60F3NXq5HCBVsbQm5IibuXF7Ya5FwpVB+DOK29NgnqW2s bpasYykFuZZeB/HdU96yw7u0JBH0a7mNkZkP0RAE/ywlrVu3Ib746k9nLFxO/j0h8pdi /3iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-topic:thread-index :content-transfer-encoding:mime-version:subject:message-id:cc:to :from:date:dkim-signature:dkim-filter:arc-authentication-results; bh=v6PnW4UX6KvghPW0ILK+Jy04kDUb5cB5okomDu7ZbnQ=; b=bMO5xImfvBqPv09JvFWXmcL6e2AzVMCGF9UhB0w0b7IhpGNynhNPn2aSni72IRDYDn 4W78iUqgHmQs88i8NPESAXtY3r3uTqV/l8u2PFs2xg2+M6cB5x6jVVtS0r8BsRe3wplB BnvZw3Ns/CLF5cw1/zhytyGRHrajRu9bPPNhiV7OdVQISj1UBNq3OgbIRuVexpCYAeIy dKD0zFjkg91jlgr1tCT6h+5fPj/IEvxm2FZUL3m6qglVCKlDVM3O5ifylwalr7apU3EJ mOXHJ4Eh5iuPTEplGN62eoKT9c4DLfpc2RvpKn5E97rDHIHr+eW1jzdGyanslfXt2nH6 JkmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Xbb9T4KQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f67-v6si2425615plb.460.2018.06.26.15.34.41; Tue, 26 Jun 2018 15:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Xbb9T4KQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933959AbeFZRiK (ORCPT + 99 others); Tue, 26 Jun 2018 13:38:10 -0400 Received: from mail.efficios.com ([167.114.142.138]:55444 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933919AbeFZRiJ (ORCPT ); Tue, 26 Jun 2018 13:38:09 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 9999B22A833; Tue, 26 Jun 2018 13:38:08 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id eUAOqsexk4nw; Tue, 26 Jun 2018 13:38:08 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 1E05722A830; Tue, 26 Jun 2018 13:38:08 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 1E05722A830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530034688; bh=v6PnW4UX6KvghPW0ILK+Jy04kDUb5cB5okomDu7ZbnQ=; h=Date:From:To:Message-ID:MIME-Version; b=Xbb9T4KQzox73psHs6e981XbkLnm9wxG6OiMhzvOrAUjtaTC3SUYkVPNiaUptKv5o J8QTb5RHLHTMSskjRUi1i794j6lniYleaA6AVqtzZ2YtYPGhyRqT9WGNA1Ax36s7gE NKt4nG56ycTqleMg5UTzMOUWO7JHejqYtFWkL+g2ECciq5mSkTaSzIWbJI/lkp0hlK osaixfJpGIBXdbsce4J4Y3+DFLCd0KpEzy7ZE6TPTOIltzXDDuhszVX9wz1xug4MEL fhuvbyto8Y7OzV767OoaZKcw7cBXKvH24vbJnDwx+CtknqhND97xaLTnM4x3AyzK2u QxDWA4RTp/Y+w== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id d5TknIPKt2B7; Tue, 26 Jun 2018 13:38:08 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 0A0EF22A828; Tue, 26 Jun 2018 13:38:08 -0400 (EDT) Date: Tue, 26 Jun 2018 13:38:07 -0400 (EDT) From: Mathieu Desnoyers To: Andy Lutomirski Cc: Peter Zijlstra , Boqun Feng , linux-kernel , "Paul E. McKenney" , Thomas Gleixner Message-ID: <1514459655.4190.1530034687884.JavaMail.zimbra@efficios.com> Subject: rseq: How to test for compat task at signal delivery MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.8_GA_2096 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_1703) Thread-Index: F0bW3mNX5qaSbdCuC2GA2EC17JUeiA== Thread-Topic: rseq: How to test for compat task at signal delivery Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, I would like to make the behavior rseq on compat tasks more robust by ensuring that kernel/rseq.c:rseq_get_rseq_cs() clears the high bits of rseq_cs->abort_ip, rseq_cs->start_ip and rseq_cs->post_commit_offset when a 32-bit binary is run on a 64-bit kernel. The intent here is that if user-space has garbage rather than zeroes in its struct rseq_cs fields padding, the behavior will be the same whether the binary is run on 32-bit or 64 kernels. I know that internally, the kernel is making a transition from is_compat_task() to in_compat_syscall(). I'm fine with using in_compat_syscall() when rseq_get_rseq_cs() is invoked from a system call, but is it OK to call it when it is invoked from signal delivery ? AFAIU, signals can be delivered upon return from interrupt as well. If not, what strategy do you recommend for arch-agnostic code ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com