Skip to contentSkip to conversation

kbd: Limit the kbdrate application to x86, mips and sparc

PATCH Superseded [email protected] 4 participants 7 messages Jun 24, 2013 – Jun 25, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover kbd: Limit the kbdrate application to x86, mips and sparc

From: Jackie Huang <[email protected]>

Tested with:
1)
MACHINE = "qemux86-64"
IMAGE_INSTALL_append = " kbd"

2)
MACHINE = "qemuppc"
IMAGE_INSTALL_append = " kbd"

3)
MACHINE = "qemuarm"
IMAGE_INSTALL_append = " kbd"

4)
MACHINE = "qemumips"
IMAGE_INSTALL_append = " kbd"

build:

$ bitbake core-image-minimal
$ runqemu qemux86-64 core-image-minimal ext3 nographic

run on qemu targets:

# kbdrate

--
The following changes since commit 47bbd0a32e6a70e191539e221c8cbfafb28e747b:

Add Upstream-Status for libxml2-CVE-2012-2871.patch (2013-06-21 10:19:36 +0800)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib jhuang0/r_bbappend_kbd_0621_2
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/r_bbappend_kbd_0621_2

Jackie Huang (1):
Limit the kbdrate application to x86, mips and sparc.

 .../0001-Limit-kbdrate-to-x86-mips-and-sparc.patch |   48 ++++++++++++++++++++
 meta/recipes-core/kbd/kbd_1.15.2.bb                |    6 ++-
 2 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/kbd/files/0001-Limit-kbdrate-to-x86-mips-and-sparc.patch
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 Limit the kbdrate application to x86, mips and sparc.

From: Jackie Huang <[email protected]>

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple Desktop Bus) device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

---
 .../0001-Limit-kbdrate-to-x86-mips-and-sparc.patch |   48 ++++++++++++++++++++
 meta/recipes-core/kbd/kbd_1.15.2.bb                |    6 ++-
 2 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/kbd/files/0001-Limit-kbdrate-to-x86-mips-and-sparc.patch
meta/recipes-core/kbd/files/0001-Limit-kbdrate-to-x86-mips-and-sparc.patch new file +48 -0
new file mode 100644
index 0000000..0283202
@@ -0,0 +1,48 @@
+From 4a679f16a3728a9323d23a8466d22a984a58c7af Mon Sep 17 00:00:00 2001
+From: Dennis Hall <[email protected]>
+Date: Fri, 31 Aug 2012 10:15:13 -0400
+Subject: [PATCH] Limit kbdrate to x86, mips and sparc.
+
+Upstream-Status: Pending
+
+The application will exit with an error if it runs on any other architecture.
+
+The code relies on hardware specific memory locations to access
+and modify the keyboard repeat rate.  It also requires read/write
+access to /dev/port which doesn't exist on every architecture's
+root fs.  The CQ was raised for Qemu PowerPC but it also fails on
+ARM.  The keyboard emulation in qemuppc is for an ADB (Apple Desktop Bus)
+device and not compatible with an Intel driver.  There's also no
+indication in the documentation that the code should work on
+anything other than Intel architecture but it also works on MIPS32.
+MIPS64 is not supported at this time so it was not tested.
+
+Signed-off-by: Dennis Hall <[email protected]>
+---
+ src/kbdrate.c |   10 ++++++++++
+ 1 files changed, 10 insertions(+), 0 deletions(-)
+
+diff --git a/src/kbdrate.c b/src/kbdrate.c
+index 95ff723..9a79774 100644
+--- a/src/kbdrate.c
++++ b/src/kbdrate.c
+@@ -241,6 +241,16 @@ main( int argc, char **argv ) {
+ 	unsigned int i;
+ 	extern char *optarg;
+
++#if !(  defined(__i386__)   \
++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))
++
++	fprintf(stderr,
++		"ERROR:  %s should only be used on MIPS, x86 and Sparc archicture boards\n", basename(argv[0]));
++        exit(1);
++#endif
++ 	set_progname(argv[0]);
+ 	set_progname(argv[0]);
+
+ 	setlocale(LC_ALL, "");
+--
+1.7.1
+
meta/recipes-core/kbd/kbd_1.15.2.bb +4 -2
index 79ea468..2fddf0a 100644
@@ -10,9 +10,11 @@ RREPLACES_${PN} = "console-tools"
 RPROVIDES_${PN} = "console-tools"
 RCONFLICTS_${PN} = "console-tools"
 
-PR = "r4"
+PR = "r5"
 
-SRC_URI="${KERNELORG_MIRROR}/linux/utils/kbd/kbd-1.15.2.tar.bz2"
+SRC_URI="${KERNELORG_MIRROR}/linux/utils/kbd/kbd-1.15.2.tar.bz2 \
+         file://0001-Limit-kbdrate-to-x86-mips-and-sparc.patch \
+"
 SRC_URI[md5sum] = "e850eb91e4d3b94b194efe8e953204c5"
 SRC_URI[sha256sum] = "b3602d191eef7a6a8317fc3cd231efa40a89ac235dce57a77cac825a2a21eba6"
 
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/1] Limit the kbdrate application to x86, mips and sparc.

Quoted 13 lines · On 24 Jun 2013 07:28, <[email protected]> wrote:

From: Jackie Huang <[email protected]>

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple Desktop Bus) device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

Quoted 7 lines

++#if !( defined(__i386__) \

++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))

++
++ fprintf(stderr,
++ "ERROR: %s should only be used on MIPS, x86 and Sparc

archicture boards\n", basename(argv[0]));

Quoted 2 lines

++ exit(1);
++#endif

Would it be better to detect the target platform in the build system and skip building the kbdrate program for architectures it won't work on rather than building and installing a known broken program?

Quoted 2 lines

++ set_progname(argv[0]);
+ set_progname(argv[0]);

Accidental repeat?

--

Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk

author
#3 lore raw

Re: [PATCH 1/1] Limit the kbdrate application to x86, mips and sparc.

Quoted 23 lines · Paul Barker
Quoted 2 lines · On 24 Jun 2013 07:28, <[email protected]…

From: Jackie Huang <[email protected]

<mailto:[email protected]>>

Quoted 11 lines

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple Desktop Bus) device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

Quoted 7 lines

++#if !( defined(__i386__) \

++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))

++
++ fprintf(stderr,
++ "ERROR: %s should only be used on MIPS, x86 and

Quoted 7 lines

Sparc archicture boards\n", basename(argv[0]));

Quoted 2 lines

++ exit(1);
++#endif

Would it be better to detect the target platform in the build system and skip building the kbdrate program for architectures it won't work on rather than building and installing a known broken program?

Yeah, it should be better, I will check if we can do that.

Quoted 5 lines
Quoted 3 lines

++ set_progname(argv[0]);
+ set_progname(argv[0]);

Accidental repeat?

Indeed, thanks for pointing this out.

Thanks,
Jackie

Quoted 8 lines

--

Paul Barker

Email: [email protected] <mailto:[email protected]>
http://www.paulbarker.me.uk

Signature · 5 lines
Jackie Huang
WIND RIVER | China Development Center
MSN:[email protected]
Tel: +86 8477 8594
Mobile: +86 138 1027 4745
#4 lore raw

Re: [PATCH 1/1] Limit the kbdrate application to x86, mips and sparc.

Quoted 31 lines · On 06/24/2013 12:45 AM, jhuang0 wrote:
Quoted 28 lines · Paul Barker
Quoted 2 lines · On 24 Jun 2013 07:28, <[email protected]…

From: Jackie Huang <[email protected]

<mailto:[email protected]>>

Quoted 6 lines

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple

Desktop Bus)

Quoted 5 lines

device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

Quoted 7 lines

++#if !( defined(__i386__) \

++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))

++
++ fprintf(stderr,
++ "ERROR: %s should only be used on MIPS, x86 and

Sparc archicture boards\n", basename(argv[0]));

Quoted 2 lines

++ exit(1);
++#endif

Quoted 6 lines
Quoted 3 lines

Would it be better to detect the target platform in the build system and skip building the kbdrate program for architectures it won't work on rather than building and installing a known broken program?

Yeah, it should be better, I will check if we can do that.

Use COMPATIBLE_MACHINE

Sau!

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines

++ set_progname(argv[0]);
+ set_progname(argv[0]);

Accidental repeat?

Indeed, thanks for pointing this out.

Thanks,
Jackie

Quoted 8 lines

--

Paul Barker

Email: [email protected] <mailto:[email protected]>
http://www.paulbarker.me.uk

#5 lore raw

Re: [PATCH 1/1] Limit the kbdrate application to x86, mips and sparc.

Quoted 32 lines · Saul Wold
Quoted 31 lines · On 06/24/2013 12:45 AM, jhuang0 wrote:
Quoted 28 lines · Paul Barker
Quoted 2 lines · On 24 Jun 2013 07:28, <[email protected]…

From: Jackie Huang <[email protected]

<mailto:[email protected]>>

Quoted 6 lines

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple

Desktop Bus)

Quoted 5 lines

device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

Quoted 7 lines

++#if !( defined(__i386__) \

++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))

++
++ fprintf(stderr,
++ "ERROR: %s should only be used on MIPS, x86 and

Sparc archicture boards\n", basename(argv[0]));

Quoted 2 lines

++ exit(1);
++#endif

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Would it be better to detect the target platform in the build system and skip building the kbdrate program for architectures it won't work on rather than building and installing a known broken program?

Yeah, it should be better, I will check if we can do that.

Use COMPATIBLE_MACHINE

We're after to take out a single binary, not the whole recipe?

Cheers,

Richard

author
#6 lore raw

Re: [PATCH 1/1] Limit the kbdrate application to x86, mips and sparc.

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Saul Wold
Quoted 35 lines · On 06/24/2013 12:45 AM, jhuang0 wrote:
Quoted 31 lines · Paul Barker
Quoted 2 lines · On 24 Jun 2013 07:28, <[email protected]…

From: Jackie Huang <[email protected]

<mailto:[email protected]>>

Quoted 6 lines

The code relies on hardware specific memory locations to access and modify the keyboard repeat rate. It also requires read/write access to /dev/port which doesn't exist on every architecture's root fs. The defect was raised for Qemu PowerPC but it also fails on ARM. The keyboard emulation in qemuppc is for an ADB (Apple

Desktop Bus)

Quoted 5 lines

device and not compatible with an Intel driver. There's also no indication in the documentation that the code should work on anything other than Intel architecture but it also works on MIPS.

Quoted 7 lines

++#if !( defined(__i386__) \

++     || defined(__x86_64__) \
++     || defined(__mips__)   \
++     || defined(__sparc___))

++
++ fprintf(stderr,
++ "ERROR: %s should only be used on MIPS, x86 and

Sparc archicture boards\n", basename(argv[0]));

Quoted 2 lines

++ exit(1);
++#endif

Would it be better to detect the target platform in the build system and skip building the kbdrate program for architectures it won't work on rather than building and installing a known broken program?

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

Yeah, it should be better, I will check if we can do that.

Use COMPATIBLE_MACHINE

We're after to take out a single binary, not the whole recipe?

Yes, not the whole recipe, kbdrate is just one of the biaries provided by the kbd package, so I think it's not appropriate to use COMPATIBLE_MACHINE here.

Thanks,
Jackie

Quoted 6 lines

Cheers,

Richard

Signature · 5 lines
Jackie Huang
WIND RIVER | China Development Center
MSN:[email protected]
Tel: +86 8477 8594
Mobile: +86 138 1027 4745