Skip to contentSkip to conversation

user-space unaligned accesses

PATCH Bjorn Helgaas 5 participants 8 messages Oct 8, 2003 – Oct 13, 2003

lore
Share & tools
lore
#0 lore raw

I got this from somebody at Red Hat. Anybody want to comment on it?

-------------------------------------------------------
...
The ia64 architecture does a tty_write
on a userspace unaligned access. Not only is this extremenly annoying, it's also very broken since the tty may well be suspended etc etc. Doing a printk on such an access by default is very broken already, lets not make it worse

arch/ia64/kernel/unaligned.c renamed from arch/ia64/kernel/unaligned.c~ +0 -6
@@ -1340,12 +1340,6 @@
 			len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
 				      "ip=0x%016lx\n\r", current->comm, current->pid,
 				      ifa, regs->cr_iip + ipsr->ri);
-			/*
-			 * Don't call tty_write_message() if we're in the kernel; we might
-			 * be holding locks...
-			 */
-			if (user_mode(regs))
-				tty_write_message(current->tty, buf);
 			buf[len-1] = '\0';	/* drop '\r' */
 			printk(KERN_WARNING "%s", buf);	/* watch for command names containing %s */
 		}

-------------------------------------------------------

#1 lore raw
Quoted 6 lines · Bjorn Helgaas

...
The ia64 architecture does a tty_write
on a userspace unaligned access. Not only is this extremenly annoying, it's also very broken since the tty may well be suspended etc etc. Doing a printk on such an access by default is very broken already, lets not make it worse

This was beat to death on linux-ia64 already where davidm and davem decided to disagree on the utility of printing unaligned accesses to the tty.

davidm wrote:

| At the moment, there are two ways to control the unaligned message printing:
| 
|  - use the dmesg command to lower the printing threshold below KERN_WARNING
|     ("dmesg -n4", IIRC)
| 
|  - use prctl --unalign=silent to turn off unaligned printing for a
|    particular task and its children

Running prctl on relevant gettys at boot time would have the same effect.

grant

#2 lore raw
In reply to Bjorn Helgaas
Quoted 11 lines · Grant Grundler
Quoted 6 lines · Bjorn Helgaas

...
The ia64 architecture does a tty_write
on a userspace unaligned access. Not only is this extremenly annoying, it's also very broken since the tty may well be suspended etc etc. Doing a printk on such an access by default is very broken already, lets not make it worse

This was beat to death on linux-ia64 already where davidm and davem decided to disagree on the utility of printing unaligned accesses to the tty.

I thought that discussion was mainly about messages printed by the kernel using printk. The Red Hat concern was specifically about writing to the user tty.

Quoted 12 lines

davidm wrote:

| At the moment, there are two ways to control the unaligned message printing:
| 
|  - use the dmesg command to lower the printing threshold below KERN_WARNING
|     ("dmesg -n4", IIRC)
| 
|  - use prctl --unalign=silent to turn off unaligned printing for a
|    particular task and its children

Running prctl on relevant gettys at boot time would have the same effect.

grant

#3 lore raw
In reply to Bjorn Helgaas
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Bjorn Helgaas
Quoted 11 lines · Grant Grundler
Quoted 11 lines · Bjorn Helgaas
Quoted 6 lines

...
The ia64 architecture does a tty_write
on a userspace unaligned access. Not only is this extremenly annoying, it's also very broken since the tty may well be suspended etc etc. Doing a printk on such an access by default is very broken already, lets not make it worse

This was beat to death on linux-ia64 already where davidm and davem decided to disagree on the utility of printing unaligned accesses to the tty.

Bjorn> I thought that discussion was mainly about messages printed by the Bjorn> kernel using printk.

Correct.

Bjorn> The Red Hat concern was specifically about writing to the Bjorn> user tty.

There are users (other than me ;-) that find the messages helpful. If there is something wrong about the current printing code, I'd rather fix that instead (and as Grant pointed out, if someone doesn't like the message, prctl can be used to turn it off). The mail you forwarded was unclear on whether there was a real security/correctness bug. If there is, please ask for/provide details.

	--david
#4 lore raw
In reply to Bjorn Helgaas
Quoted 9 lines · David Mosberger

Bjorn> The Red Hat concern was specifically about writing to the Bjorn> user tty.

There are users (other than me ;-) that find the messages helpful. If there is something wrong about the current printing code, I'd rather fix that instead (and as Grant pointed out, if someone doesn't like the message, prctl can be used to turn it off). The mail you forwarded was unclear on whether there was a real security/correctness bug. If there is, please ask for/provide details.

I did ask Red Hat to post the patch themselves. I just posted it to make sure it didn't get completely dropped when I cleaned out my inbox. Perhaps this will provide an opening for them to give more details :-)

Bjorn

#5 lore raw
In reply to Bjorn Helgaas
Quoted 5 lines

The ia64 architecture does a tty_write
on a userspace unaligned access. Not only is this extremenly annoying, it's also very broken since the tty may well be suspended etc etc. Doing a printk on such an access by default is very broken already, lets not make it worse

I too see no reason to do a tty_write here. Most other error messages of the same level (KERN_WARNING) do not do a tty_write, and syslogd can be configured to write KERN_WARNING messages to the console or anywhere else if you care. Smells like old debug code, and looks messy to the end user.

[email protected]

#6 lore raw
In reply to Bjorn Helgaas
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Micah Parrish

Micah> Smells like old debug code,

Not at all.

Micah> and looks messy to the end user.

Distributors have the choice to turn it off with prctl.

	--david
#7 lore raw
In reply to Bjorn Helgaas
Quoted 4 lines · David Mosberger

Micah> and looks messy to the end user.

Distributors have the choice to turn it off with prctl.

It is pretty useless though. What we need is unaligned/FPSWA-per-second gkrellm plugin. 8)

Duraid

(just kidding)