Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2191356ybl; Sat, 25 Jan 2020 19:18:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxqqe54P2ysfB6yAjDQ8MKmFPUc9pIvP13TBM/VABybZ+PYiOCSY39B/p5/T76z78qmwfkr X-Received: by 2002:aca:5303:: with SMTP id h3mr3781256oib.109.1580008699313; Sat, 25 Jan 2020 19:18:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580008699; cv=none; d=google.com; s=arc-20160816; b=vLlob267ilQey1H5QVk0DDtuhPSy8LW6332srReOvX0CVvf8gPKNVo8z2qjvNd3yb3 DR7nC8I+tCo0HYPQsbr1xPqmS52lT9OgpeB3ZOklNBo5Ep9KNXH2+kVnK7CwnOgykXNG zj7yseDr+dkf7pJmX5gPE3Xvh4aUfq6GP0oJBEBCGFONNHB9z5luqJpkgcZ5795kSXfO bujRfdMiLtbMJ15Otl+qs+4o7CLoCIEqnUX4O5Y6nxLnFyUaYHdQGmMmyAaSRU5UynCJ oEYp7TYcNVZhl/GY4b4qZYyCEs6NEPog34H3iwci4MZWMjPymH4FW2cgZhB7/JjfO6Ms bghg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:date:message-id :subject:from:cc:to:dkim-signature; bh=3xZp8vrOAuOOQ1xHL+BM+C43h6UE60eT1akLRCXtuAs=; b=Wr5ZRHmB2zHnHTCpkU7RXPyXM8pUsYubGGxtiaw//htuUTR/fQQuY+U6MDYyMltDkJ 7Kg7A3FoIvsAS7HpM0ZrtyIhKluGP6G1dljRMSrE6QEyRw2RWaykJQowV40tkqhIQz0d dis1INK0wDRJwLKw0YEdQzVM2+pM+DqTYrUUOEW5eU6wKVVqyJKA966EnbC4TUWLytU5 EbSUO1/P1+b2Y8GIY5L6qDPzuBRMpHEGNPqvXpxaWjvoL/mARcFDTb0eUd06me2px37Z uv9gTpP6gpXl2eud/NvDBWr973MfzF8byNuMDR2wMg/pRuecsJl9/F10D2RZaDye5tcy uIeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ACojz0Ii; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si5589972otq.250.2020.01.25.19.17.53; Sat, 25 Jan 2020 19:18:19 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=ACojz0Ii; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729100AbgAZDQK (ORCPT + 99 others); Sat, 25 Jan 2020 22:16:10 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45205 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728899AbgAZDQJ (ORCPT ); Sat, 25 Jan 2020 22:16:09 -0500 Received: by mail-qk1-f194.google.com with SMTP id x1so6282017qkl.12 for ; Sat, 25 Jan 2020 19:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version; bh=3xZp8vrOAuOOQ1xHL+BM+C43h6UE60eT1akLRCXtuAs=; b=ACojz0IiVuJBtkpcQqLGT/IsaS+GinlPsoTuAym83lDEvID2SKRiX+QgChFrf+J567 ALH30bb2TrUKZpst9eFSCu5YvcFQp62qGTWdb0eub7gXJA8wteeX7nkZOdEyaiV8E7lA CepyKHqdGAl87QXdbyGtsjeNhADXpgkuuEEu47aWKWxuYWVEjqhXNfUDW2wx/SUPKipb iVvRXtse0uInCYSykVXUs987MeHTT6OJINu5ei9IWOs/tt3iL0Yvnxexo0JUANzk3QIq n2IFqSsMfoBEpthqnrx3+EGe2tdmec9uwZ/UOCUBr/6knSK2fS7hM6C6BO/9W52nCOBE 5h5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version; bh=3xZp8vrOAuOOQ1xHL+BM+C43h6UE60eT1akLRCXtuAs=; b=sccvaHkAaIRKyGE415eN1qgKEwNBRZPH/g2Lm9VKZHpGSN5HlKX5RmAtsLZEYdjM7A 6cif6vJrode5satT6WVio7sY5MtVFYSL0/K/mxkXAqQW5nYtEpUR2/xMhWdQu5qnedl3 WOpT9+DvovfizvdG2vuNxoxoNgPAyB7+RF9rqDOr9uGMA3xvgl3NYKPGVFtuZfB8uq1T TRyEwnNWuT7/DTDH5b3Oj0pX3q61apvLqWH9eYRtCvY/DnLRvZGtMysRU6sJzef/q10y cq++t4I9lNjqoWmI+xD4XilrgnGLtlGUwsROfBQXVTECMPnY12l8ny7QGbRty5673gPE Vtlw== X-Gm-Message-State: APjAAAVoC9tKbmQ3q0Akz9aOPbeaiE9WcAsZsxzKMp/GsKQmP1HMQZQt PM/+XZOXNw+AISiSJmDdv9Fw3Kv75w== X-Received: by 2002:a37:9ed3:: with SMTP id h202mr11049971qke.456.1580008568432; Sat, 25 Jan 2020 19:16:08 -0800 (PST) Received: from [120.7.1.38] ([184.175.21.212]) by smtp.gmail.com with ESMTPSA id f97sm6921319qtb.18.2020.01.25.19.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jan 2020 19:16:07 -0800 (PST) To: LKML Cc: ben@decadent.org.uk From: Woody Suwalski Subject: [PATCH] fix 3.16 unknown rela relocation 4 error Message-ID: <48d562fd-f80a-69ae-56e5-d0bada0feeed@gmail.com> Date: Sat, 25 Jan 2020 22:16:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.5 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------556E9E7D66A6EAFDDCA5DC60" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------556E9E7D66A6EAFDDCA5DC60 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Trying to use an AMD64 3.16 kernel built on a new Debian system fails because most of the kernel modules can not be loaded. This patch handles the PLT32 relocation errors for kernels modules built with binutils newer then 2.31, similar to: [    5.742485] module: autofs4: Unknown rela relocation: 4 [    5.742536] systemd[1]: Failed to insert module 'autofs4': Exec format error This patch is based on a mainline kernel patch b21ebf2fb4cde1618915a97cc773e287ff49173e From: "H.J. Lu" Date: Wed, 7 Feb 2018 14:20:09 -0800 Subject: x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 Signed-off-by: Woody Suwalski --- a/arch/x86/tools/relocs.c    2020-01-24 18:48:09.477919152 -0500 +++ b/arch/x86/tools/relocs.c    2020-01-24 18:48:53.645612045 -0500 @@ -763,6 +763,7 @@ static int do_reloc64(struct section *se      switch (r_type) {      case R_X86_64_NONE:      case R_X86_64_PC32: +    case R_X86_64_PLT32:          /*           * NONE can be ignored and PC relative relocations don't           * need to be adjusted. --- a/arch/x86/kernel/module.c    2020-01-24 18:46:54.922670590 -0500 +++ b/arch/x86/kernel/module.c    2020-01-24 18:47:46.714112016 -0500 @@ -180,6 +180,7 @@ int apply_relocate_add(Elf64_Shdr *sechd                  goto overflow;              break;          case R_X86_64_PC32: +        case R_X86_64_PLT32:              val -= (u64)loc;              *(u32 *)loc = val;  #if 0 --------------556E9E7D66A6EAFDDCA5DC60 Content-Type: text/x-patch; name="reloc_PLT32_3.16.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="reloc_PLT32_3.16.diff" Handle the PLT32 reloacation errors for kernels binaries built with binutils newer then 2.31, similar to: [ 5.742485] module: autofs4: Unknown rela relocation: 4 [ 5.742536] systemd[1]: Failed to insert module 'autofs4': Exec format error This patch is based on a mainline kernel patch b21ebf2fb4cde1618915a97cc773e287ff49173e From: "H.J. Lu" Date: Wed, 7 Feb 2018 14:20:09 -0800 Subject: x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 Signed-off-by: Woody Suwalski --- a/arch/x86/tools/relocs.c 2020-01-24 18:48:09.477919152 -0500 +++ b/arch/x86/tools/relocs.c 2020-01-24 18:48:53.645612045 -0500 @@ -763,6 +763,7 @@ static int do_reloc64(struct section *se switch (r_type) { case R_X86_64_NONE: case R_X86_64_PC32: + case R_X86_64_PLT32: /* * NONE can be ignored and PC relative relocations don't * need to be adjusted. --- a/arch/x86/kernel/module.c 2020-01-24 18:46:54.922670590 -0500 +++ b/arch/x86/kernel/module.c 2020-01-24 18:47:46.714112016 -0500 @@ -180,6 +180,7 @@ int apply_relocate_add(Elf64_Shdr *sechd goto overflow; break; case R_X86_64_PC32: + case R_X86_64_PLT32: val -= (u64)loc; *(u32 *)loc = val; #if 0 --------------556E9E7D66A6EAFDDCA5DC60--