From patchwork Fri Jan 17 08:15:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 23296 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F21E2202FA for ; Fri, 17 Jan 2014 08:15:59 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id m10sf5776975vbh.4 for ; Fri, 17 Jan 2014 00:15:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=CHXNN5MpIaNomUoPZ38hZ23LbWCbHRCrahbMKBtxnAo=; b=DZqcRnIEbz1DUmtzzEx7z/sI3xYlDHoMN3zFjiyjJW8Rv35w5PL8/A8PC8LYqKRBHG rljIl+JqUo6cP1apTNy1fL/S9jP3spPUnoMiLCPrs/47KuLGKyTSsTfyYJ/FthF+lu2E c1PCgXUcosjd6K+F0Iwj4DFcwTJ0kF1ajawlJG3Nukvpd0vgZqp+uE3Q/Z9w6OzF1b3l 2gc/66uN7/1DFdOdtTPHRKzDBcW1KSPGlME3VvJW12ScVDZ/1LbIG7PTROVdklY3239r D8dO5Y9e611yW0LHkyq370fHIxXNM1PSWP7uWvop4VPPcwSv19EFQwd37++fonjfx8lW HMXA== X-Gm-Message-State: ALoCoQnsSbnLLJNqVXDHzm+IKzSTiWF/c+4+tcn122ZOnhrbHLgZfUTOSAnGDZKI5flSPRfY9Req X-Received: by 10.236.228.228 with SMTP id f94mr154971yhq.43.1389946559142; Fri, 17 Jan 2014 00:15:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.19 with SMTP id q19ls389295qgq.35.gmail; Fri, 17 Jan 2014 00:15:59 -0800 (PST) X-Received: by 10.58.119.161 with SMTP id kv1mr216500veb.21.1389946559024; Fri, 17 Jan 2014 00:15:59 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id uy8si4555158vcb.55.2014.01.17.00.15.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 00:15:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ie18so1394712vcb.26 for ; Fri, 17 Jan 2014 00:15:58 -0800 (PST) X-Received: by 10.220.76.201 with SMTP id d9mr214783vck.33.1389946558700; Fri, 17 Jan 2014 00:15:58 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp2436ved; Fri, 17 Jan 2014 00:15:58 -0800 (PST) X-Received: by 10.66.121.201 with SMTP id lm9mr695284pab.80.1389946557515; Fri, 17 Jan 2014 00:15:57 -0800 (PST) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id eb3si9502922pbd.17.2014.01.17.00.15.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 00:15:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of takahiro.akashi@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id w10so3734250pde.33 for ; Fri, 17 Jan 2014 00:15:57 -0800 (PST) X-Received: by 10.66.179.143 with SMTP id dg15mr726907pac.52.1389946557124; Fri, 17 Jan 2014 00:15:57 -0800 (PST) Received: from localhost.localdomain (KD182250177246.au-net.ne.jp. [182.250.177.246]) by mx.google.com with ESMTPSA id ki1sm20698957pbd.1.2014.01.17.00.15.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 00:15:55 -0800 (PST) From: AKASHI Takahiro To: linux-audit@redhat.com Cc: will.deacon@arm.com, arndb@arndb.de, patches@linaro.org, AKASHI Takahiro Subject: [PATCH v2 2/3] audit(userspace): Add arm LE/aarch64 BE support Date: Fri, 17 Jan 2014 17:15:28 +0900 Message-Id: <1389946529-4590-3-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389946529-4590-1-git-send-email-takahiro.akashi@linaro.org> References: <1384846140-5716-1-git-send-email-takahiro.akashi@linaro.org> <1389946529-4590-1-git-send-email-takahiro.akashi@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For arm/aarch64(or arm64 in kernel), endianness does not have any differences in term of system call tables. So this patch made some changes to treat LE and BE binaries equally by re-using existing conversion tables. In addition, all the machine names matching "arm*l" were classified to MACH_ARM (instead of MACH_ARMEB) because they represent LE. This patch works with the kernel patch I submitted for AArch64 support, which advertises AUDIT_ARCH_ARM/AARCH64 for LE and AUDIT_ARCH_ARMEB/ AARCH64EB for BE. Alternatively, however, we might better use single macros, AUTH_ARCH_ARM and AUTH_ARCH_AARCH64 only, for both LE and BE as discussed here: http://permalink.gmane.org/gmane.linux.ports.arm.kerenl/165266 Signed-off-by: AKASHI Takahiro --- lib/libaudit.c | 2 ++ lib/libaudit.h | 4 +++- lib/lookup_table.c | 14 ++++++++++---- lib/machinetab.h | 12 +++++++----- swig/audit.py | 2 ++ tools/ausyscall/ausyscall.c | 3 ++- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/libaudit.c b/lib/libaudit.c index f7b6bef..77b3f9b 100644 --- a/lib/libaudit.c +++ b/lib/libaudit.c @@ -1329,6 +1329,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, return -6; break; #ifdef WITH_ARMEB + case MACH_ARM: case MACH_ARMEB: if (bits == __AUDIT_ARCH_64BIT) return -6; @@ -1336,6 +1337,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, #endif #ifdef WITH_AARCH64 case MACH_AARCH64: + case MACH_AARCH64EB: if (bits != __AUDIT_ARCH_64BIT) return -6; break; diff --git a/lib/libaudit.h b/lib/libaudit.h index 338b2df..07fffb3 100644 --- a/lib/libaudit.h +++ b/lib/libaudit.h @@ -416,8 +416,10 @@ typedef enum { MACH_S390X, MACH_S390, MACH_ALPHA, + MACH_ARM, MACH_ARMEB, - MACH_AARCH64 + MACH_AARCH64, + MACH_AARCH64EB } machine_t; /* These are the valid audit failure tunable enum values */ diff --git a/lib/lookup_table.c b/lib/lookup_table.c index 4f4c0ae..d9ecb3a 100644 --- a/lib/lookup_table.c +++ b/lib/lookup_table.c @@ -77,10 +77,12 @@ static const struct int_transtab elftab[] = { { MACH_ALPHA, AUDIT_ARCH_ALPHA }, #endif #ifdef WITH_ARMEB + { MACH_ARM, AUDIT_ARCH_ARM }, { MACH_ARMEB, AUDIT_ARCH_ARMEB }, #endif #ifdef WITH_AARCH64 { MACH_AARCH64, AUDIT_ARCH_AARCH64}, + { MACH_AARCH64EB, AUDIT_ARCH_AARCH64}, #endif }; #define AUDIT_ELF_NAMES (sizeof(elftab)/sizeof(elftab[0])) @@ -138,12 +140,14 @@ int audit_name_to_syscall(const char *sc, int machine) break; #endif #ifdef WITH_ARMEB - case MACH_ARMEB: + case MACH_ARM: + case MACH_ARMEB: found = armeb_syscall_s2i(sc, &res); break; #endif #ifdef WITH_AARCH64 - case MACH_AARCH64: + case MACH_AARCH64: + case MACH_AARCH64EB: found = aarch64_syscall_s2i(sc, &res); break; #endif @@ -180,11 +184,13 @@ const char *audit_syscall_to_name(int sc, int machine) return alpha_syscall_i2s(sc); #endif #ifdef WITH_ARMEB - case MACH_ARMEB: + case MACH_ARM: + case MACH_ARMEB: return armeb_syscall_i2s(sc); #endif #ifdef WITH_AARCH64 - case MACH_AARCH64: + case MACH_AARCH64: + case MACH_AARCH64EB: return aarch64_syscall_i2s(sc); #endif } diff --git a/lib/machinetab.h b/lib/machinetab.h index 48eaf50..c7033a6 100644 --- a/lib/machinetab.h +++ b/lib/machinetab.h @@ -35,11 +35,13 @@ _S(MACH_ALPHA, "alpha" ) #endif #ifdef WITH_ARMEB _S(MACH_ARMEB, "armeb" ) -_S(MACH_ARMEB, "armv5tejl") -_S(MACH_ARMEB, "armv5tel") -_S(MACH_ARMEB, "armv6l") -_S(MACH_ARMEB, "armv7l") +_S(MACH_ARM, "arm") +_S(MACH_ARM, "armv5tejl") +_S(MACH_ARM, "armv5tel") +_S(MACH_ARM, "armv6l") +_S(MACH_ARM, "armv7l") #endif #ifdef WITH_AARCH64 -_S(MACH_AARCH64, "aarch64" ) +_S(MACH_AARCH64, "aarch64") +_S(MACH_AARCH64EB, "aarch64eb") #endif diff --git a/swig/audit.py b/swig/audit.py index 1feae68..152d90f 100644 --- a/swig/audit.py +++ b/swig/audit.py @@ -695,8 +695,10 @@ MACH_PPC = _audit.MACH_PPC MACH_S390X = _audit.MACH_S390X MACH_S390 = _audit.MACH_S390 MACH_ALPHA = _audit.MACH_ALPHA +MACH_ARM = _audit.MACH_ARM MACH_ARMEB = _audit.MACH_ARMEB MACH_AARCH64 = _audit.MACH_AARCH64 +MACH_AARCH64EB = _audit.MACH_AARCH64EB FAIL_IGNORE = _audit.FAIL_IGNORE FAIL_LOG = _audit.FAIL_LOG FAIL_TERMINATE = _audit.FAIL_TERMINATE diff --git a/tools/ausyscall/ausyscall.c b/tools/ausyscall/ausyscall.c index 8d2a4b3..ba78a2e 100644 --- a/tools/ausyscall/ausyscall.c +++ b/tools/ausyscall/ausyscall.c @@ -72,7 +72,8 @@ int main(int argc, char *argv[]) exit(1); #endif #ifndef WITH_ARMEB - } else if (strcmp("armeb", argv[i]) == 0) { + } else if (strcmp("armeb", argv[i]) == 0 || + strcmp("arm", argv[i]) == 0) { fputs("Arm eabi processor support is not enabled\n", stderr); exit(1);