24 Mar, 2012
40 commits
-
PTRACE_SEIZE code is tested and ready for production use, remove the
code which requires special bit in data argument to make PTRACE_SEIZE
work.Strace team prepares for a new release of strace, and we would like to
ship the code which uses PTRACE_SEIZE, preferably after this change goes
into released kernel.Signed-off-by: Denys Vlasenko
Acked-by: Tejun Heo
Acked-by: Oleg Nesterov
Cc: Pedro Alves
Cc: Jan Kratochvil
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
PTRACE_EVENT_foo and PTRACE_O_TRACEfoo used to match.
New PTRACE_EVENT_STOP is the first event which has no corresponding
PTRACE_O_TRACE option. If we will ever want to add another such option,
its PTRACE_EVENT's value will collide with PTRACE_EVENT_STOP's value.This patch changes PTRACE_EVENT_STOP value to prevent this.
While at it, added a comment - the one atop PTRACE_EVENT block, saying
"Wait extended result codes for the above trace options", is not true
for PTRACE_EVENT_STOP.Signed-off-by: Denys Vlasenko
Cc: Tejun Heo
Reviewed-by: Oleg Nesterov
Cc: Pedro Alves
Cc: Jan Kratochvil
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This can be used to close a few corner cases in strace where we get
unwanted racy behavior after attach, but before we have a chance to set
options (the notorious post-execve SIGTRAP comes to mind), and removes
the need to track "did we set opts for this task" state in strace
internals.While we are at it:
Make it possible to extend SEIZE in the future with more functionality
by passing non-zero 'addr' parameter. To that end, error out if 'addr'
is non-zero. PTRACE_ATTACH did not (and still does not) have such
check, and users (strace) do pass garbage there... let's avoid
repeating this mistake with SEIZE.Set all task->ptrace bits in one operation - before this change, we were
adding PT_SEIZED and PT_PTRACE_CAP with task->ptrace |= BIT ops. This
was probably ok (not a bug), but let's be on a safer side.Changes since v2: use (unsigned long) casts instead of (long) ones, move
PTRACE_SEIZE_DEVEL-related code to separate lines of code.Signed-off-by: Denys Vlasenko
Acked-by: Tejun Heo
Cc: Pedro Alves
Reviewed-by: Oleg Nesterov
Cc: Jan Kratochvil
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Exchange PT_TRACESYSGOOD and PT_PTRACE_CAP bit positions, which makes
PT_option bits contiguous and therefore makes code in
ptrace_setoptions() much simpler.Every PTRACE_O_TRACEevent is defined to (1 << PTRACE_EVENT_event)
instead of using explicit numeric constants, to ensure we don't mess up
relationship between bit positions and event ids.PT_EVENT_FLAG_SHIFT was not particularly useful, PT_OPT_FLAG_SHIFT with
value of PT_EVENT_FLAG_SHIFT-1 is easier to use.PT_TRACE_MASK constant is nuked, the only its use is replaced by
(PTRACE_O_MASK << PT_OPT_FLAG_SHIFT).Signed-off-by: Denys Vlasenko
Acked-by: Tejun Heo
Reviewed-by: Oleg Nesterov
Cc: Pedro Alves
Cc: Jan Kratochvil
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
On ptrace(PTRACE_SETOPTIONS, pid, 0, ), we used to set those
option bits which are known, and then fail with -EINVAL if there are
some unknown bits in .This is inconsistent with typical error handling, which does not change
any state if input is invalid.This patch changes PTRACE_SETOPTIONS behavior so that in this case, we
return -EINVAL and don't change any bits in task->ptrace.It's very unlikely that there is userspace code in the wild which will
be affected by this change: it should have the formptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_BOGUSOPT)
where PTRACE_O_BOGUSOPT is a constant unknown to the kernel. But kernel
headers, naturally, don't contain any PTRACE_O_BOGUSOPTs, thus the only
way userspace can use one if it defines one itself. I can't see why
anyone would do such a thing deliberately.Signed-off-by: Denys Vlasenko
Acked-by: Tejun Heo
Reviewed-by: Oleg Nesterov
Cc: Pedro Alves
Cc: Jan Kratochvil
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
ptrace_event(PTRACE_EVENT_EXEC) sends SIGTRAP if PT_TRACE_EXEC is not
set. This is because this SIGTRAP predates PTRACE_O_TRACEEXEC option,
we do not need/want this with PT_SEIZED which can set the options during
attach.Suggested-by: Pedro Alves
Signed-off-by: Oleg Nesterov
Cc: Chris Evans
Cc: Indan Zupancic
Cc: Denys Vlasenko
Cc: Tejun Heo
Cc: Pedro Alves
Cc: Jan Kratochvil
Cc: Steven Rostedt
Cc: Frederic Weisbecker
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Another old/known problem. If the tracee is killed after it reports
syscall_entry, it starts the syscall and debugger can't control this.
This confuses the users and this creates the security problems for
ptrace jailers.Change tracehook_report_syscall_entry() to return non-zero if killed,
this instructs syscall_trace_enter() to abort the syscall.Reported-by: Chris Evans
Tested-by: Indan Zupancic
Signed-off-by: Oleg Nesterov
Cc: Denys Vlasenko
Cc: Tejun Heo
Cc: Pedro Alves
Cc: Jan Kratochvil
Cc: Steven Rostedt
Cc: Frederic Weisbecker
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since '*outlen' is initialized to zero, it is currently possible to
create a filename of length (FAT_LFN_LEN + 1) when utf8 is not enabled.
To enforce the FAT_LFN_LEN limit, we must perform one less iteration.Signed-off-by: Namjae Jeon
Signed-off-by: Ravishankar N
Acked-by: OGAWA Hirofumi
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
xlate_to_uni() is called by vfat_build_slots() with sbi->nls_io as the
final argument. nls_io can never be null at this point because the
check is already being done in fat_fill_super() wherein the mount fails
if it is null.Signed-off-by: Namjae Jeon
Signed-off-by: Ravishankar N
Acked-by: OGAWA Hirofumi
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Generalise NVRAM to support RAM with other size and offset, such as the
64 bytes of SRAM on the mcp7941x.[rdunlap@xenotime.net: fix printk format warning]
Signed-off-by: Austin Boyle
Signed-off-by: Wolfram Sang
Signed-off-by: Randy Dunlap
Cc: David Anders
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Do some cleanup of the comment sections as well as correct some
formatting issues reported by checkpatch.pl.Signed-off-by: David Anders
Signed-off-by: Wolfram Sang
Cc: Austin Boyle
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
No need to have two seperate if-blocks for setting up the irq.
Signed-off-by: Wolfram Sang
Tested-by: David Anders
Cc: Austin Boyle
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The chip_desc table is suboptimal. Currently it requires an entry for
every new chip type, even if it is empty. This has already been
forgotten for the ds1388. Refactor the code, so new entries are only
needed, when they chip type really needs a (non-empty) description.
Also make the table visually more appealing.Signed-off-by: Wolfram Sang
Cc: Austin Boyle
Cc: David Anders
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
RTC Driver for Dialog Semiconductor DA9052/53 PMICs.
This patch is functionally tested on Samsung SMDKV6410.
[akpm@linux-foundation.org: clean up file header layout, remove unneeded initialisation of local arrays]
Signed-off-by: David Dajun Chen
Signed-off-by: Ashish Jangam
Cc: Paul Gortmaker
Cc: David Dajun Chen
Cc: Samuel Ortiz
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
…max8925_rtc_set_alarm
max8925_rtc_read_alarm() should set alrm->enabled based on both
ALARM_IRQ_MASK and ALARM_CTRL setting. max8925_rtc_set_alarm() should
enable/disable alarm according to ALARM_CTRL reg setting.Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -
max8925_rtc_read_alarm should always return 0 with success
Signed-off-by: Kevin Liu
Signed-off-by: Haojian Zhuang
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Navin P
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since commit e58aa3d2d0cc ("genirq: run irq handlers with interrupts
disabled") we run all interrupt handlers with interrupts disabled and we
even check and yell when an interrupt handler returns with interrupts
enabled - see commit b738a50a2026 ("genirq: warn when handler enables
interrupts").So now this flag is a NOOP and can be removed.
Signed-off-by: Yong Zhang
Acked-by: Linus Walleij
Acked-by: Wan ZongShun
Cc: Alessandro Zummo
Cc: Thomas Gleixner
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Following changes are made as part of this change:
1. As TWL RTC supports periodic interrupt, the correct event should be
RTC_PF instead of RTC_UF.2. No need to initialize variable "events" to 0 & then OR it with the
event values. Hence fixing it.Signed-off-by: Venu Byravarasu
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
For clearing RTC interrupt, programming ALARM bit only is sufficient, as
all other bits are any way not affected by writing 0 to them.Hence removed unwanted OR operation.
Signed-off-by: Venu Byravarasu
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
As part of probe, before enabling RTC, RTC_CTRL register is read to check
if it is already running. If RTC is used by kernel alone, then this read
is not required. Even if RTC was enabled already by boot loader, setting
STOP_RTC bit again should not harm. Hence removed unwanted read
operation.Signed-off-by: Venu Byravarasu
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
As the TWL RTC driver has a cached copy of enabled RTC interrupt bits in
variable rtc_irq_bits, that can be checked before really setting or
masking any of the interrupt bits.Signed-off-by: Venu Byravarasu
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add RTC support(TOY counter0) for loongson1B SOC
Signed-off-by: zhao zhang
Cc: Alessandro Zummo
Cc: Ralf Baechle
Acked-by: Linus Walleij
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Factor out some boilerplate code for i2c driver registration into
module_i2c_driver.Signed-off-by: Axel Lin
Cc: Piotr Ziecik
Cc: Alessandro Zummo
Cc: Scott Wood
Cc: Srikanth Srinivasan
Cc: Mike Rapoport
Cc: Sergey Lapin
Cc: Roman Fietze
Cc: Herbert Valerio Riedel
Cc: Alexander Bigga
Cc: Dale Farnsworth
Cc: Gregory Hermant
Cc: Wolfgang Grandegger
Cc: Martyn Welch
Cc: Byron Bradley
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Factor out some boilerplate code for spi driver registration into
module_spi_driver.Signed-off-by: Axel Lin
Cc: Mark Jackson
Cc: Dennis Aberilla
Cc: Nikolaus Voss
Cc: "Kim B. Heino"
Cc: Raphael Assenat
Cc: Chris Verges
Cc: Magnus Damm
Cc: Atsushi Nemoto
Cc: Alessandro Zummo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
rtc_device_register() calls rtc-spear routines internally. These
routines call dev_get_drvdata() to get struct spear_rtc_config.
Currently, platform_set_drvdata is called after rtc device is
registered. This causes system to crash, as dev_get_drvdata returns
NULL.For this we need to call platform_set_drvdata() before registering rtc
device. This requires further cleanup, that leads to removal of
dev_set_drvdata on rtc->dev, which was just not required at all.Also, we change the parameter to request_irq and pass pointer to config
instead of pointer to rtc struct.This patch brings all above changes.
Signed-off-by: Viresh Kumar
Cc: Shiraz Hashim
Cc: Deepak Sikri
Acked-by: Rajeev Kumar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Define API for '.alarm_irq_enable' to enable and disable alarm irq. This
is required by the framework else RTC_AIE_ON and RTC_AIE_OFF ioctls
return errors.Signed-off-by: Shiraz Hashim
Signed-off-by: Viresh Kumar
Cc: Deepak Sikri
Acked-by: Rajeev Kumar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Handle the fix for unbalanced irq for the cases when enable_irq_wake
fails, and a warning related to same is displayed on the console. The
workaround is handled at the driver level.Signed-off-by: Deepak Sikri
Signed-off-by: Viresh Kumar
Acked-by: Rajeev Kumar
Cc: Shiraz Hashim
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Printing the error code makes it easier to debug the cause of a mount
failure. For example I had the problem that the root file system could
not be mounted read-writeable because my SD card was write-protected.
Without an error code it looks like the SD card was not detected at all.Signed-off-by: Bernhard Walle
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Otherwise the 'Calibration skipped' message gets printed everytime a CPU
is hotplugged in, cluttering console for systems that frequently hotplug
CPUs.Signed-off-by: Diwakar Tundlam
Cc: Phil Carmody
Cc: Russell King
Cc: Greg KH
Cc: Sameer Nanda
Cc: Peter De Schrijver
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We never use the length variable.
Signed-off-by: Dan Carpenter
Acked-by: Jason Baron
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Looking for a bug in -rt, I stumbled across this code here from: commit
2dfa4eeab0fc ("epoll keyed wakeups: teach epoll about hints coming with
the wakeup key"), specifically:#ifdef CONFIG_DEBUG_LOCK_ALLOC
static inline void ep_wake_up_nested(wait_queue_head_t *wqueue,
unsigned long events, int subclass)
{
unsigned long flags;spin_lock_irqsave_nested(&wqueue->lock, flags, subclass);
wake_up_locked_poll(wqueue, events);
spin_unlock_irqrestore(&wqueue->lock, flags);
}
#else
static inline void ep_wake_up_nested(wait_queue_head_t *wqueue,
unsigned long events, int subclass)
{
wake_up_poll(wqueue, events);
}
#endifYou change the function of ep_wake_up_nested() depending on whether
CONFIG_DEBUG_LOCK_ALLOC is set or not. This looks awfully suspicious,
and there's no comment to explain why. I initially thought that this
was trying to fool lockdep, and hiding a real bug.Investigating it, I found the creation of wake_up_nested() (which no
longer exists) but was created for the sole purpose of epoll and its
strange wake ups, as explained in commit 0ccf831cbee9 ("lockdep:
annotate epoll")Although the commit message says "annotate epoll" the change log is much
better at explaining what is happening than what is in the actual code.
Thus a comment is really necessary here. And to save the time of other
developers from having to go trudging through the git logs trying to
figure out why this code exists.I took parts of the change log and placed it into a comment above the
affected code. This will make the description of what is happening more
visible to new developers that have to look at this code for the first
time.Signed-off-by: Steven Rostedt
Cc: Davide Libenzi
Cc: Peter Zijlstra
Cc: Alan Cox
Cc: Ingo Molnar
Cc: David Miller
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
In some cases the poll() implementation in a driver has to do different
things depending on the events the caller wants to poll for. An example
is when a driver needs to start a DMA engine if the caller polls for
POLLIN, but doesn't want to do that if POLLIN is not requested but instead
only POLLOUT or POLLPRI is requested. This is something that can happen
in the video4linux subsystem among others.Unfortunately, the current epoll/poll/select implementation doesn't
provide that information reliably. The poll_table_struct does have it: it
has a key field with the event mask. But once a poll() call matches one
or more bits of that mask any following poll() calls are passed a NULL
poll_table pointer.Also, the eventpoll implementation always left the key field at ~0 instead
of using the requested events mask.This was changed in eventpoll.c so the key field now contains the actual
events that should be polled for as set by the caller.The solution to the NULL poll_table pointer is to set the qproc field to
NULL in poll_table once poll() matches the events, not the poll_table
pointer itself. That way drivers can obtain the mask through a new
poll_requested_events inline.The poll_table_struct can still be NULL since some kernel code calls it
internally (netfs_state_poll() in ./drivers/staging/pohmelfs/netfs.h). In
that case poll_requested_events() returns ~0 (i.e. all events).Very rarely drivers might want to know whether poll_wait will actually
wait. If another earlier file descriptor in the set already matched the
events the caller wanted to wait for, then the kernel will return from the
select() call without waiting. This might be useful information in order
to avoid doing expensive work.A new helper function poll_does_not_wait() is added that drivers can use
to detect this situation. This is now used in sock_poll_wait() in
include/net/sock.h. This was the only place in the kernel that needed
this information.Drivers should no longer access any of the poll_table internals, but use
the poll_requested_events() and poll_does_not_wait() access functions
instead. In order to enforce that the poll_table fields are now prepended
with an underscore and a comment was added warning against using them
directly.This required a change in unix_dgram_poll() in unix/af_unix.c which used
the key field to get the requested events. It's been replaced by a call
to poll_requested_events().For qproc it was especially important to change its name since the
behavior of that field changes with this patch since this function pointer
can now be NULL when that wasn't possible in the past.Any driver accessing the qproc or key fields directly will now fail to compile.
Some notes regarding the correctness of this patch: the driver's poll()
function is called with a 'struct poll_table_struct *wait' argument. This
pointer may or may not be NULL, drivers can never rely on it being one or
the other as that depends on whether or not an earlier file descriptor in
the select()'s fdset matched the requested events.There are only three things a driver can do with the wait argument:
1) obtain the key field:
events = wait ? wait->key : ~0;
This will still work although it should be replaced with the new
poll_requested_events() function (which does exactly the same).
This will now even work better, since wait is no longer set to NULL
unnecessarily.2) use the qproc callback. This could be deadly since qproc can now be
NULL. Renaming qproc should prevent this from happening. There are no
kernel drivers that actually access this callback directly, BTW.3) test whether wait == NULL to determine whether poll would return without
waiting. This is no longer sufficient as the correct test is now
wait == NULL || wait->_qproc == NULL.However, the worst that can happen here is a slight performance hit in
the case where wait != NULL and wait->_qproc == NULL. In that case the
driver will assume that poll_wait() will actually add the fd to the set
of waiting file descriptors. Of course, poll_wait() will not do that
since it tests for wait->_qproc. This will not break anything, though.There is only one place in the whole kernel where this happens
(sock_poll_wait() in include/net/sock.h) and that code will be replaced
by a call to poll_does_not_wait() in the next patch.Note that even if wait->_qproc != NULL drivers cannot rely on poll_wait()
actually waiting. The next file descriptor from the set might match the
event mask and thus any possible waits will never happen.Signed-off-by: Hans Verkuil
Reviewed-by: Jonathan Corbet
Reviewed-by: Al Viro
Cc: Davide Libenzi
Signed-off-by: Hans de Goede
Cc: Mauro Carvalho Chehab
Cc: David Miller
Cc: Eric Dumazet
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Allow the kernel builder to choose a crc32* algorithm for the kernel.
Signed-off-by: Darrick J. Wong
Cc: Bob Pearson
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add self-test code for crc32c.
Signed-off-by: Darrick J. Wong
Cc: Bob Pearson
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since lib/crc32.c now provides crc32c, remove the software implementation
here and call the library function instead.Signed-off-by: Darrick J. Wong
Cc: Herbert Xu
Cc: Bob Pearson
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Reuse the existing crc32 code to stamp out a crc32c implementation.
Signed-off-by: Darrick J. Wong
Cc: Herbert Xu
Cc: Bob Pearson
Cc: Randy Dunlap
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add a comment at the top of crc32.c
[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson
Signed-off-by: Darrick J. Wong
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add two changes that improve the performance of x86 systems
1. replace main loop with incrementing counter this change improves
the performance of the selftest by about 5-6% on Nehalem CPUs. The
apparent reason is that the compiler can use the loop index to perform
an indexed memory access. This is reported to make the performance of
PowerPC CPUs to get worse.2. replace the rem_len loop with incrementing counter this change
improves the performance of the selftest, which has more than the usual
number of occurances, by about 1-2% on x86 CPUs. In actual work loads
the length is most often a multiple of 4 bytes and this code does not
get executed as often if at all. Again this change is reported to make
the performance of PowerPC get worse.[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson
Signed-off-by: Darrick J. Wong
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add slicing-by-8 algorithm to the existing slicing-by-4 algorithm. This
consists of:- extend largest BITS size from 32 to 64
- extend tables from tab[4][256] to up to tab[8][256]
- Add code for inner loop.[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson
Signed-off-by: Darrick J. Wong
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds