Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1484668ybj; Tue, 5 May 2020 22:33:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKHLObGI+lLBGEJLTCeBV5oERWQ028rDz/prW7jjfp90/D3ADEODe02vcElKBoxWTO//9Wt X-Received: by 2002:a17:906:d7a2:: with SMTP id pk2mr6136327ejb.272.1588743200584; Tue, 05 May 2020 22:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588743200; cv=none; d=google.com; s=arc-20160816; b=OP4zRzv3zt1pvC4kM2heDoB2ZYoa6KeHPgBKkAN0uiUd7XGldVMvfvvd3sTrYZ+Bqu wOTP9TGaEvum3PV+oMxBXFw/071VqXuaHLZkhzc9jN4JSLOBBjZbwR9oAloQ53x974Kn Nd1cJF2sfAxUJXKSxLBxmEjCQlcp8XdNtXI32Ibzm9jobMTjAxAgPIbvAXEGuUYX6T8Y Nxp7NBLCNw2GD7LlPgAjffdhoC2+FnX2tIRfFWYAfhBk4lnLgMZx4Po/GH7O2X5gZL1T rAAUU3eufJADZaYhsubJ/s/7Q7QVYcC6icig74AVKHqL/0os9r1CT5v1GmztBPOKnk5u aqig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=quwvHOpGIAi8OsWd9GoHESXppy3kU5zsjuWawgAHmkc=; b=N6kB2R3xzcWUrzNnSIHB2Z43BuSk0WgAjUZJYiP8Ff62KjaJbDWMZHSdl3FxrSEhvl y4kSgATh0PYUIIBoL82K08zoozt0LH/JcPnfJXzxUGOoPzzexpfaPBC0Pl9turc6XYlG HORyehy0IAEnzE4fC4qnV7vCASK5+aP0snoMEPFeC+IQe2dkLwaUL8jbPlctGJCt18Cw xAO6X1GnZXzkj6F6GBa0UPMgCcjVpwnF3vY5wHmvvp3j0zfkAlY7GHBVx5bmI6UG22ab d3y9/90NW9EhLHD9eLovd6E5JZHwAYVb1dXY8+1vQuM7J+EpFQfnK51528X4hiaHqo4g NcMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si528062eju.232.2020.05.05.22.32.57; Tue, 05 May 2020 22:33:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgEFFam (ORCPT + 99 others); Wed, 6 May 2020 01:30:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:6634 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgEFFam (ORCPT ); Wed, 6 May 2020 01:30:42 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04653OOR128725; Wed, 6 May 2020 01:30:05 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 30u8sp1hge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 May 2020 01:30:05 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04655q7w135977; Wed, 6 May 2020 01:30:04 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 30u8sp1hf0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 May 2020 01:30:04 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 0465U1F5003746; Wed, 6 May 2020 05:30:02 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 30s0g5rdxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 May 2020 05:30:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0465Txts45088912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 May 2020 05:29:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E15F4C044; Wed, 6 May 2020 05:29:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FEFD4C04E; Wed, 6 May 2020 05:29:56 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 6 May 2020 05:29:56 +0000 (GMT) Date: Wed, 6 May 2020 10:59:55 +0530 From: Srikar Dronamraju To: Oleg Nesterov Cc: Guo Ren , Christian Borntraeger , "David S. Miller" , Linus Torvalds , Steven Rostedt , "Eric W. Biederman" , Peter Zijlstra , Ingo Molnar , Jann Horn , Al Viro , Jens Axboe , Security Officers , Andrea Arcangeli , Ananth N Mavinakayanahalli , Naveen Rao , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] uprobes: ensure that uprobe->offset and ->ref_ctr_offset are properly aligned Message-ID: <20200506052955.GA8259@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20200428091149.GB19958@linux.vnet.ibm.com> <20200428123914.GA27920@redhat.com> <20200504164724.GA28697@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20200504164724.GA28697@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-05-06_01:2020-05-04,2020-05-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 bulkscore=0 impostorscore=0 priorityscore=1501 phishscore=0 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005060038 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Oleg Nesterov [2020-05-04 18:47:25]: > uprobe_write_opcode() must not cross page boundary; prepare_uprobe() > relies on arch_uprobe_analyze_insn() which should validate "vaddr" but > some architectures (csky, s390, and sparc) don't do this. > > We can remove the BUG_ON() check in prepare_uprobe() and validate the > offset early in __uprobe_register(). The new IS_ALIGNED() check matches > the alignment check in arch_prepare_kprobe() on supported architectures, > so I think that all insns must be aligned to UPROBE_SWBP_INSN_SIZE. > > Another problem is __update_ref_ctr() which was wrong from the very > beginning, it can read/write outside of kmap'ed page unless "vaddr" is > aligned to sizeof(short), __uprobe_register() should check this too. > > Cc: stable@vger.kernel.org > Reported-by: Linus Torvalds > Suggested-by: Linus Torvalds > Signed-off-by: Oleg Nesterov Thanks Oleg. Looks good to me. Reviewed-by: Srikar Dronamraju > --- -- Thanks and Regards Srikar Dronamraju